[mod] Del method for employee
This commit is contained in:
parent
ee168bd637
commit
b5e015a6fe
@ -504,7 +504,14 @@ class EmployeeApplication{
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
function disableEmployeeRecord($idEmployee){
|
/**
|
||||||
|
* @param $code string
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
function disableEmployeeRecord($code){
|
||||||
|
$this->asserts->isNotEmpty($code, "The code can't be empty.");
|
||||||
|
|
||||||
|
$idEmployee = $this->getIdEmployeeByCode($code);
|
||||||
$this->asserts->higherThanZero($idEmployee, "idEmployee must be higher than 0");
|
$this->asserts->higherThanZero($idEmployee, "idEmployee must be higher than 0");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -65,12 +65,12 @@ $app->put('/api/employee', function ($request, $response) {
|
|||||||
->write(json_encode($this->employeeApplication->updateEmployeeData($requestData)));
|
->write(json_encode($this->employeeApplication->updateEmployeeData($requestData)));
|
||||||
});
|
});
|
||||||
|
|
||||||
$app->DELETE('/api/employee/{idEmployee}', function (Request $request, Response $response, array $args) {
|
$app->DELETE('/api/employee/{code}', function (Request $request, Response $response, array $args) {
|
||||||
$idEmployee = $args['idEmployee'];
|
$code = $args['code'];
|
||||||
|
|
||||||
return $response->withStatus(200)
|
return $response->withStatus(200)
|
||||||
->withHeader('Content-Type', 'application/json')
|
->withHeader('Content-Type', 'application/json')
|
||||||
->write(json_encode($this->employeeApplication->disableEmployeeRecord($idEmployee)));
|
->write(json_encode($this->employeeApplication->disableEmployeeRecord($code)));
|
||||||
});
|
});
|
||||||
|
|
||||||
$app->get('/api/employee/type/{code}', function (Request $request, Response $response, array $args) {
|
$app->get('/api/employee/type/{code}', function (Request $request, Response $response, array $args) {
|
||||||
|
Loading…
Reference in New Issue
Block a user