diff --git a/api-payroll/src/application/EmployeeApplication.php b/api-payroll/src/application/EmployeeApplication.php index 5573b9b..5c0fcdc 100644 --- a/api-payroll/src/application/EmployeeApplication.php +++ b/api-payroll/src/application/EmployeeApplication.php @@ -269,6 +269,16 @@ class EmployeeApplication{ return $response; } + /** + * @param $code string + * @return array + */ + function getEmployeeDataByCode($code){ + $idEmployee = $this->getIdEmployeeTypeByCode($code); + + return $this->proxyGetEmployeeDataById($idEmployee); + } + /** * @param $idPerson integer * @param $firstName binary diff --git a/api-payroll/src/routes.php b/api-payroll/src/routes.php index f36b17a..7d28e55 100644 --- a/api-payroll/src/routes.php +++ b/api-payroll/src/routes.php @@ -79,10 +79,18 @@ $app->get('/api/employee/type/{code}', function (Request $request, Response $res ->write(json_encode($this->employeeApplication->getIdEmployeeTypeByCode($code))); }); -$app->get('/api/employee/{idEmployee}', function (Request $request, Response $response, array $args) { +$app->get('/api/employee/id/{idEmployee}', function (Request $request, Response $response, array $args) { $idEmployee = $args['idEmployee']; return $response->withStatus(200) ->withHeader('Content-Type', 'application/json') ->write(json_encode($this->employeeApplication->proxyGetEmployeeDataById($idEmployee))); +}); + +$app->get('/api/employee/code/{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->getEmployeeDataByCode($code))); }); \ No newline at end of file diff --git a/api-payroll/src/settings.php b/api-payroll/src/settings.php index 10ea7c9..435f286 100644 --- a/api-payroll/src/settings.php +++ b/api-payroll/src/settings.php @@ -43,7 +43,7 @@ return [ // Employee settings 'employee' => [ - 'codeLength' => '5', + 'codeLength' => '3', ], ], ];