Compare commits

...

1 Commits

Author SHA1 Message Date
b5e015a6fe [mod] Del method for employee 2018-08-15 03:30:23 -06:00
2 changed files with 11 additions and 4 deletions

View File

@ -504,7 +504,14 @@ class EmployeeApplication{
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");
try {

View File

@ -65,12 +65,12 @@ $app->put('/api/employee', function ($request, $response) {
->write(json_encode($this->employeeApplication->updateEmployeeData($requestData)));
});
$app->DELETE('/api/employee/{idEmployee}', function (Request $request, Response $response, array $args) {
$idEmployee = $args['idEmployee'];
$app->DELETE('/api/employee/{code}', function (Request $request, Response $response, array $args) {
$code = $args['code'];
return $response->withStatus(200)
->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) {