GWM:CHANGE-IN-REST-API

This commit is contained in:
bitbucket 2024-03-18 20:09:46 +05:30
parent d43e2ca101
commit 62eec1f44c
2 changed files with 24 additions and 1 deletions

View File

@ -227,6 +227,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
$routes->post("createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount");
$routes->get("deleteDependence", "EmployeeRestController::deleteDependence");
$routes->get("getEmployeeAndDependenceByClientId", "EmployeeRestController::getEmployeeAndDependenceByClientId");
$routes->get("getClientPolicy", "EmployeeRestController::getClientPolicy");
});
$routes->post("sendEmail", "EmployeeRestController::send_email");

View File

@ -52,7 +52,7 @@ class EmployeeRestController extends AdminController
$this->policesModel = new PolicesModel();
$this->relationshipModel = new RelationshipModel();
$this->fileModel= new FileModel();
$this->clientPolicyModel= new ClientPolicyModel();
$this->clientPolicyModel = new ClientPolicyModel();
}
@ -245,6 +245,28 @@ class EmployeeRestController extends AdminController
}
public function getClientPolicy()
{
try {
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id,, policies.id as policy_id, policies.name as policy_name')
->join('policies', 'client_policy.policy_id = policies.id', 'left')
->where('client_policy.client_id', $this->request->getGet('client_id') )
->findAll();
// You probably meant to check $result, not $data
if ($ClientPolicyData) {
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $ClientPolicyData], 200);
} else {
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
}
}
public function getEmployeePolicy()
{