chore: refresh CLQMS backend baseline
Re-synced controllers, configs, libraries, seeds, and docs with the latest API expectations and response helpers.
This commit is contained in:
parent
02a6a1f883
commit
9946978487
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
app/.htaccess
Normal file → Executable file
0
app/.htaccess
Normal file → Executable file
0
app/Common.php
Normal file → Executable file
0
app/Common.php
Normal file → Executable file
0
app/Config/App.php
Normal file → Executable file
0
app/Config/App.php
Normal file → Executable file
0
app/Config/Autoload.php
Normal file → Executable file
0
app/Config/Autoload.php
Normal file → Executable file
0
app/Config/Boot/development.php
Normal file → Executable file
0
app/Config/Boot/development.php
Normal file → Executable file
0
app/Config/Boot/production.php
Normal file → Executable file
0
app/Config/Boot/production.php
Normal file → Executable file
0
app/Config/Boot/testing.php
Normal file → Executable file
0
app/Config/Boot/testing.php
Normal file → Executable file
0
app/Config/CURLRequest.php
Normal file → Executable file
0
app/Config/CURLRequest.php
Normal file → Executable file
0
app/Config/Cache.php
Normal file → Executable file
0
app/Config/Cache.php
Normal file → Executable file
0
app/Config/Constants.php
Normal file → Executable file
0
app/Config/Constants.php
Normal file → Executable file
0
app/Config/ContentSecurityPolicy.php
Normal file → Executable file
0
app/Config/ContentSecurityPolicy.php
Normal file → Executable file
0
app/Config/Cookie.php
Normal file → Executable file
0
app/Config/Cookie.php
Normal file → Executable file
0
app/Config/Cors.php
Normal file → Executable file
0
app/Config/Cors.php
Normal file → Executable file
0
app/Config/Database.php
Normal file → Executable file
0
app/Config/Database.php
Normal file → Executable file
0
app/Config/DocTypes.php
Normal file → Executable file
0
app/Config/DocTypes.php
Normal file → Executable file
0
app/Config/Email.php
Normal file → Executable file
0
app/Config/Email.php
Normal file → Executable file
0
app/Config/Encryption.php
Normal file → Executable file
0
app/Config/Encryption.php
Normal file → Executable file
0
app/Config/Events.php
Normal file → Executable file
0
app/Config/Events.php
Normal file → Executable file
0
app/Config/Exceptions.php
Normal file → Executable file
0
app/Config/Exceptions.php
Normal file → Executable file
0
app/Config/Feature.php
Normal file → Executable file
0
app/Config/Feature.php
Normal file → Executable file
0
app/Config/Filters.php
Normal file → Executable file
0
app/Config/Filters.php
Normal file → Executable file
0
app/Config/ForeignCharacters.php
Normal file → Executable file
0
app/Config/ForeignCharacters.php
Normal file → Executable file
0
app/Config/Format.php
Normal file → Executable file
0
app/Config/Format.php
Normal file → Executable file
0
app/Config/Generators.php
Normal file → Executable file
0
app/Config/Generators.php
Normal file → Executable file
0
app/Config/Honeypot.php
Normal file → Executable file
0
app/Config/Honeypot.php
Normal file → Executable file
0
app/Config/Images.php
Normal file → Executable file
0
app/Config/Images.php
Normal file → Executable file
0
app/Config/Kint.php
Normal file → Executable file
0
app/Config/Kint.php
Normal file → Executable file
0
app/Config/Logger.php
Normal file → Executable file
0
app/Config/Logger.php
Normal file → Executable file
0
app/Config/Migrations.php
Normal file → Executable file
0
app/Config/Migrations.php
Normal file → Executable file
0
app/Config/Mimes.php
Normal file → Executable file
0
app/Config/Mimes.php
Normal file → Executable file
0
app/Config/Modules.php
Normal file → Executable file
0
app/Config/Modules.php
Normal file → Executable file
0
app/Config/Optimize.php
Normal file → Executable file
0
app/Config/Optimize.php
Normal file → Executable file
0
app/Config/Pager.php
Normal file → Executable file
0
app/Config/Pager.php
Normal file → Executable file
0
app/Config/Paths.php
Normal file → Executable file
0
app/Config/Paths.php
Normal file → Executable file
0
app/Config/Publisher.php
Normal file → Executable file
0
app/Config/Publisher.php
Normal file → Executable file
32
app/Config/Routes.php
Normal file → Executable file
32
app/Config/Routes.php
Normal file → Executable file
@ -220,23 +220,23 @@ $routes->group('api', function ($routes) {
|
|||||||
$routes->delete('/', 'Organization\WorkstationController::delete');
|
$routes->delete('/', 'Organization\WorkstationController::delete');
|
||||||
});
|
});
|
||||||
|
|
||||||
// HostApp
|
// HostApp
|
||||||
$routes->group('hostapp', function ($routes) {
|
$routes->group('hostapp', function ($routes) {
|
||||||
$routes->get('/', 'Organization\HostAppController::index');
|
$routes->get('/', 'Organization\HostAppController::index');
|
||||||
$routes->get('(:any)', 'Organization\HostAppController::show/$1');
|
$routes->get('(:num)', 'Organization\HostAppController::show/$1');
|
||||||
$routes->post('/', 'Organization\HostAppController::create');
|
$routes->post('/', 'Organization\HostAppController::create');
|
||||||
$routes->patch('(:any)', 'Organization\HostAppController::update/$1');
|
$routes->patch('(:num)', 'Organization\HostAppController::update/$1');
|
||||||
$routes->delete('/', 'Organization\HostAppController::delete');
|
$routes->delete('/', 'Organization\HostAppController::delete');
|
||||||
});
|
});
|
||||||
|
|
||||||
// HostComPara
|
// HostComPara
|
||||||
$routes->group('hostcompara', function ($routes) {
|
$routes->group('hostcompara', function ($routes) {
|
||||||
$routes->get('/', 'Organization\HostComParaController::index');
|
$routes->get('/', 'Organization\HostComParaController::index');
|
||||||
$routes->get('(:any)', 'Organization\HostComParaController::show/$1');
|
$routes->get('(:num)', 'Organization\HostComParaController::show/$1');
|
||||||
$routes->post('/', 'Organization\HostComParaController::create');
|
$routes->post('/', 'Organization\HostComParaController::create');
|
||||||
$routes->patch('(:any)', 'Organization\HostComParaController::update/$1');
|
$routes->patch('(:num)', 'Organization\HostComParaController::update/$1');
|
||||||
$routes->delete('/', 'Organization\HostComParaController::delete');
|
$routes->delete('/', 'Organization\HostComParaController::delete');
|
||||||
});
|
});
|
||||||
|
|
||||||
// CodingSys
|
// CodingSys
|
||||||
$routes->group('codingsys', function ($routes) {
|
$routes->group('codingsys', function ($routes) {
|
||||||
|
|||||||
0
app/Config/Routing.php
Normal file → Executable file
0
app/Config/Routing.php
Normal file → Executable file
0
app/Config/Security.php
Normal file → Executable file
0
app/Config/Security.php
Normal file → Executable file
0
app/Config/Services.php
Normal file → Executable file
0
app/Config/Services.php
Normal file → Executable file
0
app/Config/Session.php
Normal file → Executable file
0
app/Config/Session.php
Normal file → Executable file
0
app/Config/Toolbar.php
Normal file → Executable file
0
app/Config/Toolbar.php
Normal file → Executable file
0
app/Config/UserAgents.php
Normal file → Executable file
0
app/Config/UserAgents.php
Normal file → Executable file
0
app/Config/Validation.php
Normal file → Executable file
0
app/Config/Validation.php
Normal file → Executable file
0
app/Config/View.php
Normal file → Executable file
0
app/Config/View.php
Normal file → Executable file
0
app/Controllers/AreaGeoController.php
Normal file → Executable file
0
app/Controllers/AreaGeoController.php
Normal file → Executable file
0
app/Controllers/Audit/AuditLogController.php
Normal file → Executable file
0
app/Controllers/Audit/AuditLogController.php
Normal file → Executable file
0
app/Controllers/AuthController.php
Normal file → Executable file
0
app/Controllers/AuthController.php
Normal file → Executable file
0
app/Controllers/AuthV2Controller.php
Normal file → Executable file
0
app/Controllers/AuthV2Controller.php
Normal file → Executable file
0
app/Controllers/BaseController.php
Normal file → Executable file
0
app/Controllers/BaseController.php
Normal file → Executable file
0
app/Controllers/CalculatorController.php
Normal file → Executable file
0
app/Controllers/CalculatorController.php
Normal file → Executable file
0
app/Controllers/Contact/ContactController.php
Normal file → Executable file
0
app/Controllers/Contact/ContactController.php
Normal file → Executable file
0
app/Controllers/Contact/MedicalSpecialtyController.php
Normal file → Executable file
0
app/Controllers/Contact/MedicalSpecialtyController.php
Normal file → Executable file
0
app/Controllers/Contact/OccupationController.php
Normal file → Executable file
0
app/Controllers/Contact/OccupationController.php
Normal file → Executable file
0
app/Controllers/CounterController.php
Normal file → Executable file
0
app/Controllers/CounterController.php
Normal file → Executable file
0
app/Controllers/DashboardController.php
Normal file → Executable file
0
app/Controllers/DashboardController.php
Normal file → Executable file
0
app/Controllers/EdgeController.php
Normal file → Executable file
0
app/Controllers/EdgeController.php
Normal file → Executable file
0
app/Controllers/HomeController.php
Normal file → Executable file
0
app/Controllers/HomeController.php
Normal file → Executable file
0
app/Controllers/Infrastructure/EquipmentListController.php
Normal file → Executable file
0
app/Controllers/Infrastructure/EquipmentListController.php
Normal file → Executable file
0
app/Controllers/LocationController.php
Normal file → Executable file
0
app/Controllers/LocationController.php
Normal file → Executable file
0
app/Controllers/OrderTestController.php
Normal file → Executable file
0
app/Controllers/OrderTestController.php
Normal file → Executable file
63
app/Controllers/Organization/AccountController.php
Normal file → Executable file
63
app/Controllers/Organization/AccountController.php
Normal file → Executable file
@ -45,27 +45,40 @@ class AccountController extends BaseController {
|
|||||||
return $this->respond([ 'status' => 'success', 'message'=> "fetch success", 'data' => $row ], 200);
|
return $this->respond([ 'status' => 'success', 'message'=> "fetch success", 'data' => $row ], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete() {
|
public function delete() {
|
||||||
try {
|
try {
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
$id = $input["AccountID"];
|
$id = $this->requirePatchId($input['AccountID'] ?? null, 'AccountID');
|
||||||
if (!$id) { return $this->failValidationErrors('ID is required.'); }
|
if ($id === null) {
|
||||||
$this->model->delete($id);
|
return;
|
||||||
return $this->respondDeleted([ 'status' => 'success', 'message' => "{$id} deleted successfully."]);
|
}
|
||||||
} catch (\Throwable $e) {
|
$this->model->delete($id);
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->respondDeleted([ 'status' => 'success', 'message' => "{$id} deleted successfully."]);
|
||||||
}
|
} catch (\Throwable $e) {
|
||||||
}
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function create() {
|
public function create() {
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
try {
|
|
||||||
$id = $this->model->insert($input,true);
|
$validation = service('validation');
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => 'data created successfully', 'data' => $id ], 201);
|
$validation->setRules([
|
||||||
} catch (\Throwable $e) {
|
'AccountName' => 'required|string|max_length[255]',
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
'Parent' => 'permit_empty|integer',
|
||||||
}
|
]);
|
||||||
}
|
|
||||||
|
if (!$validation->run($input)) {
|
||||||
|
return $this->failValidationErrors($validation->getErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$id = $this->model->insert($input,true);
|
||||||
|
return $this->respondCreated([ 'status' => 'success', 'message' => 'data created successfully', 'data' => $id ], 201);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function update($AccountID = null) {
|
public function update($AccountID = null) {
|
||||||
$input = $this->requirePatchPayload($this->request->getJSON(true));
|
$input = $this->requirePatchPayload($this->request->getJSON(true));
|
||||||
@ -83,6 +96,16 @@ class AccountController extends BaseController {
|
|||||||
return $this->respond([ 'status' => 'failed', 'message' => 'Account not found', 'data' => [] ], 404);
|
return $this->respond([ 'status' => 'failed', 'message' => 'Account not found', 'data' => [] ], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validation = service('validation');
|
||||||
|
$validation->setRules([
|
||||||
|
'AccountName' => 'permit_empty|string|max_length[255]',
|
||||||
|
'Parent' => 'permit_empty|integer',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!$validation->run($input)) {
|
||||||
|
return $this->failValidationErrors($validation->getErrors());
|
||||||
|
}
|
||||||
|
|
||||||
$input['AccountID'] = $id;
|
$input['AccountID'] = $id;
|
||||||
try {
|
try {
|
||||||
$this->model->update($id, $input);
|
$this->model->update($id, $input);
|
||||||
|
|||||||
2
app/Controllers/Organization/CodingSysController.php
Normal file → Executable file
2
app/Controllers/Organization/CodingSysController.php
Normal file → Executable file
@ -104,7 +104,7 @@ class CodingSysController extends BaseController {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->model->update($id, $input);
|
$this->model->update($id, $input);
|
||||||
return $this->respond(['status' => 'success', 'message' => 'data updated successfully', 'data' => $id], 200);
|
return $this->respondCreated(['status' => 'success', 'message' => 'data updated successfully', 'data' => $id], 201);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
0
app/Controllers/Organization/DepartmentController.php
Normal file → Executable file
0
app/Controllers/Organization/DepartmentController.php
Normal file → Executable file
77
app/Controllers/Organization/DisciplineController.php
Normal file → Executable file
77
app/Controllers/Organization/DisciplineController.php
Normal file → Executable file
@ -43,27 +43,43 @@ class DisciplineController extends BaseController {
|
|||||||
return $this->respond([ 'status' => 'success', 'message'=> "fetch success", 'data' => $row ], 200);
|
return $this->respond([ 'status' => 'success', 'message'=> "fetch success", 'data' => $row ], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete() {
|
public function delete() {
|
||||||
try {
|
try {
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
$id = $input["DisciplineID"];
|
$id = $this->requirePatchId($input['DisciplineID'] ?? null, 'DisciplineID');
|
||||||
if (!$id) { return $this->failValidationErrors('ID is required.'); }
|
if ($id === null) {
|
||||||
$this->model->delete($id);
|
return;
|
||||||
return $this->respondDeleted([ 'status' => 'success', 'message' => "{$id} deleted successfully."]);
|
}
|
||||||
} catch (\Throwable $e) {
|
$this->model->delete($id);
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->respondDeleted([ 'status' => 'success', 'message' => "{$id} deleted successfully."]);
|
||||||
}
|
} catch (\Throwable $e) {
|
||||||
}
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function create() {
|
public function create() {
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
try {
|
|
||||||
$id = $this->model->insert($input,true);
|
$validation = service('validation');
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => 'data created successfully', 'data' => $id ], 201);
|
$validation->setRules([
|
||||||
} catch (\Throwable $e) {
|
'DisciplineCode' => 'required|string|max_length[50]',
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
'DisciplineName' => 'required|string|max_length[255]',
|
||||||
}
|
'Parent' => 'permit_empty|integer',
|
||||||
}
|
'SeqScr' => 'permit_empty|integer',
|
||||||
|
'SeqRpt' => 'permit_empty|integer',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!$validation->run($input)) {
|
||||||
|
return $this->failValidationErrors($validation->getErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$id = $this->model->insert($input,true);
|
||||||
|
return $this->respondCreated([ 'status' => 'success', 'message' => 'data created successfully', 'data' => $id ], 201);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function update($DisciplineID = null) {
|
public function update($DisciplineID = null) {
|
||||||
$input = $this->requirePatchPayload($this->request->getJSON(true));
|
$input = $this->requirePatchPayload($this->request->getJSON(true));
|
||||||
@ -81,9 +97,26 @@ class DisciplineController extends BaseController {
|
|||||||
return $this->respond([ 'status' => 'failed', 'message' => 'Discipline not found', 'data' => [] ], 404);
|
return $this->respond([ 'status' => 'failed', 'message' => 'Discipline not found', 'data' => [] ], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validation = service('validation');
|
||||||
|
$validation->setRules([
|
||||||
|
'DisciplineCode' => 'permit_empty|string|max_length[50]',
|
||||||
|
'DisciplineName' => 'permit_empty|string|max_length[255]',
|
||||||
|
'Parent' => 'permit_empty|integer',
|
||||||
|
'SeqScr' => 'permit_empty|integer',
|
||||||
|
'SeqRpt' => 'permit_empty|integer',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!$validation->run($input)) {
|
||||||
|
return $this->failValidationErrors($validation->getErrors());
|
||||||
|
}
|
||||||
|
|
||||||
$input['DisciplineID'] = $id;
|
$input['DisciplineID'] = $id;
|
||||||
$this->model->update($id, $input);
|
try {
|
||||||
return $this->respond([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 200);
|
$this->model->update($id, $input);
|
||||||
|
return $this->respond([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 200);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
try {
|
try {
|
||||||
$id = $input['DisciplineID'];
|
$id = $input['DisciplineID'];
|
||||||
|
|||||||
29
app/Controllers/Organization/HostAppController.php
Normal file → Executable file
29
app/Controllers/Organization/HostAppController.php
Normal file → Executable file
@ -29,7 +29,10 @@ class HostAppController extends BaseController {
|
|||||||
->join('site', 'site.SiteID = hostapp.SiteID', 'left');
|
->join('site', 'site.SiteID = hostapp.SiteID', 'left');
|
||||||
|
|
||||||
if (!empty($filter['HostAppID'])) {
|
if (!empty($filter['HostAppID'])) {
|
||||||
$builder->like('hostapp.HostAppID', $filter['HostAppID'], 'both');
|
if (!ctype_digit((string) $filter['HostAppID'])) {
|
||||||
|
return $this->failValidationErrors('HostAppID filter must be a valid integer.');
|
||||||
|
}
|
||||||
|
$builder->where('hostapp.HostAppID', (int) $filter['HostAppID']);
|
||||||
}
|
}
|
||||||
if (!empty($filter['HostAppName'])) {
|
if (!empty($filter['HostAppName'])) {
|
||||||
$builder->like('hostapp.HostAppName', $filter['HostAppName'], 'both');
|
$builder->like('hostapp.HostAppName', $filter['HostAppName'], 'both');
|
||||||
@ -45,9 +48,14 @@ class HostAppController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function show($HostAppID = null) {
|
public function show($HostAppID = null) {
|
||||||
|
$id = $this->requirePatchId($HostAppID, 'HostAppID');
|
||||||
|
if ($id === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$row = $this->model->select('hostapp.*, site.SiteName')
|
$row = $this->model->select('hostapp.*, site.SiteName')
|
||||||
->join('site', 'site.SiteID = hostapp.SiteID', 'left')
|
->join('site', 'site.SiteID = hostapp.SiteID', 'left')
|
||||||
->where('hostapp.HostAppID', $HostAppID)
|
->where('hostapp.HostAppID', $id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (empty($row)) {
|
if (empty($row)) {
|
||||||
@ -60,10 +68,9 @@ class HostAppController extends BaseController {
|
|||||||
public function delete() {
|
public function delete() {
|
||||||
try {
|
try {
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
$id = $input['HostAppID'] ?? null;
|
$id = $this->requirePatchId($input['HostAppID'] ?? null, 'HostAppID');
|
||||||
|
if ($id === null) {
|
||||||
if (!$id) {
|
return;
|
||||||
return $this->failValidationErrors('HostAppID is required.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->model->delete($id);
|
$this->model->delete($id);
|
||||||
@ -77,6 +84,7 @@ class HostAppController extends BaseController {
|
|||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
unset($input['HostAppID']);
|
||||||
$id = $this->model->insert($input, true);
|
$id = $this->model->insert($input, true);
|
||||||
return $this->respondCreated(['status' => 'success', 'message' => 'data created successfully', 'data' => $id], 201);
|
return $this->respondCreated(['status' => 'success', 'message' => 'data created successfully', 'data' => $id], 201);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
@ -100,11 +108,12 @@ class HostAppController extends BaseController {
|
|||||||
return $this->respond(['status' => 'failed', 'message' => 'HostApp not found', 'data' => []], 404);
|
return $this->respond(['status' => 'failed', 'message' => 'HostApp not found', 'data' => []], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($input['HostAppID']) && (string) $input['HostAppID'] !== (string) $id) {
|
if (isset($input['HostAppID'])) {
|
||||||
return $this->failValidationErrors('HostAppID in URL does not match body.');
|
if ((string) $input['HostAppID'] !== (string) $id) {
|
||||||
|
return $this->failValidationErrors('HostAppID in URL does not match body.');
|
||||||
|
}
|
||||||
|
unset($input['HostAppID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$input['HostAppID'] = $id;
|
|
||||||
try {
|
try {
|
||||||
$this->model->update($id, $input);
|
$this->model->update($id, $input);
|
||||||
return $this->respond(['status' => 'success', 'message' => 'data updated successfully', 'data' => $id], 200);
|
return $this->respond(['status' => 'success', 'message' => 'data updated successfully', 'data' => $id], 200);
|
||||||
|
|||||||
39
app/Controllers/Organization/HostComParaController.php
Normal file → Executable file
39
app/Controllers/Organization/HostComParaController.php
Normal file → Executable file
@ -29,7 +29,10 @@ class HostComParaController extends BaseController {
|
|||||||
->join('hostapp', 'hostapp.HostAppID = hostcompara.HostAppID', 'left');
|
->join('hostapp', 'hostapp.HostAppID = hostcompara.HostAppID', 'left');
|
||||||
|
|
||||||
if (!empty($filter['HostAppID'])) {
|
if (!empty($filter['HostAppID'])) {
|
||||||
$builder->where('hostcompara.HostAppID', $filter['HostAppID']);
|
if (!ctype_digit((string) $filter['HostAppID'])) {
|
||||||
|
return $this->failValidationErrors('HostAppID filter must be a valid integer.');
|
||||||
|
}
|
||||||
|
$builder->where('hostcompara.HostAppID', (int) $filter['HostAppID']);
|
||||||
}
|
}
|
||||||
if (!empty($filter['HostIP'])) {
|
if (!empty($filter['HostIP'])) {
|
||||||
$builder->like('hostcompara.HostIP', $filter['HostIP'], 'both');
|
$builder->like('hostcompara.HostIP', $filter['HostIP'], 'both');
|
||||||
@ -45,9 +48,14 @@ class HostComParaController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function show($HostAppID = null) {
|
public function show($HostAppID = null) {
|
||||||
|
$id = $this->requirePatchId($HostAppID, 'HostAppID');
|
||||||
|
if ($id === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$row = $this->model->select('hostcompara.*, hostapp.HostAppName')
|
$row = $this->model->select('hostcompara.*, hostapp.HostAppName')
|
||||||
->join('hostapp', 'hostapp.HostAppID = hostcompara.HostAppID', 'left')
|
->join('hostapp', 'hostapp.HostAppID = hostcompara.HostAppID', 'left')
|
||||||
->where('hostcompara.HostAppID', $HostAppID)
|
->where('hostcompara.HostAppID', $id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (empty($row)) {
|
if (empty($row)) {
|
||||||
@ -60,10 +68,9 @@ class HostComParaController extends BaseController {
|
|||||||
public function delete() {
|
public function delete() {
|
||||||
try {
|
try {
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
$id = $input['HostAppID'] ?? null;
|
$id = $this->requirePatchId($input['HostAppID'] ?? null, 'HostAppID');
|
||||||
|
if ($id === null) {
|
||||||
if (!$id) {
|
return;
|
||||||
return $this->failValidationErrors('HostAppID is required.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->model->delete($id);
|
$this->model->delete($id);
|
||||||
@ -77,6 +84,17 @@ class HostComParaController extends BaseController {
|
|||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$hostAppId = $input['HostAppID'] ?? null;
|
||||||
|
if ($hostAppId === null) {
|
||||||
|
return $this->failValidationErrors('HostAppID is required.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ctype_digit((string) $hostAppId)) {
|
||||||
|
return $this->failValidationErrors('HostAppID must be a valid integer.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$input['HostAppID'] = (int) $hostAppId;
|
||||||
|
|
||||||
$id = $this->model->insert($input, true);
|
$id = $this->model->insert($input, true);
|
||||||
return $this->respondCreated(['status' => 'success', 'message' => 'data created successfully', 'data' => $id], 201);
|
return $this->respondCreated(['status' => 'success', 'message' => 'data created successfully', 'data' => $id], 201);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
@ -100,12 +118,13 @@ class HostComParaController extends BaseController {
|
|||||||
return $this->respond(['status' => 'failed', 'message' => 'HostComPara not found', 'data' => []], 404);
|
return $this->respond(['status' => 'failed', 'message' => 'HostComPara not found', 'data' => []], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($input['HostAppID']) && (string) $input['HostAppID'] !== (string) $id) {
|
if (isset($input['HostAppID'])) {
|
||||||
return $this->failValidationErrors('HostAppID in URL does not match body.');
|
if ((string) $input['HostAppID'] !== (string) $id) {
|
||||||
|
return $this->failValidationErrors('HostAppID in URL does not match body.');
|
||||||
|
}
|
||||||
|
unset($input['HostAppID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$input['HostAppID'] = $id;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->model->update($id, $input);
|
$this->model->update($id, $input);
|
||||||
return $this->respond(['status' => 'success', 'message' => 'data updated successfully', 'data' => $id], 200);
|
return $this->respond(['status' => 'success', 'message' => 'data updated successfully', 'data' => $id], 200);
|
||||||
|
|||||||
0
app/Controllers/Organization/SiteController.php
Normal file → Executable file
0
app/Controllers/Organization/SiteController.php
Normal file → Executable file
0
app/Controllers/Organization/WorkstationController.php
Normal file → Executable file
0
app/Controllers/Organization/WorkstationController.php
Normal file → Executable file
0
app/Controllers/PagesController.php
Normal file → Executable file
0
app/Controllers/PagesController.php
Normal file → Executable file
0
app/Controllers/PatVisitController.php
Normal file → Executable file
0
app/Controllers/PatVisitController.php
Normal file → Executable file
0
app/Controllers/Patient/PatientController.php
Normal file → Executable file
0
app/Controllers/Patient/PatientController.php
Normal file → Executable file
0
app/Controllers/ReportController.php
Normal file → Executable file
0
app/Controllers/ReportController.php
Normal file → Executable file
0
app/Controllers/Result/ResultValueSetController.php
Normal file → Executable file
0
app/Controllers/Result/ResultValueSetController.php
Normal file → Executable file
0
app/Controllers/ResultController.php
Normal file → Executable file
0
app/Controllers/ResultController.php
Normal file → Executable file
0
app/Controllers/Rule/RuleController.php
Normal file → Executable file
0
app/Controllers/Rule/RuleController.php
Normal file → Executable file
0
app/Controllers/SampleController.php
Normal file → Executable file
0
app/Controllers/SampleController.php
Normal file → Executable file
2
app/Controllers/Specimen/ContainerDefController.php
Normal file → Executable file
2
app/Controllers/Specimen/ContainerDefController.php
Normal file → Executable file
@ -104,7 +104,7 @@ class ContainerDefController extends BaseController {
|
|||||||
$input['ConDefID'] = $id;
|
$input['ConDefID'] = $id;
|
||||||
try {
|
try {
|
||||||
$this->model->update($id, $input);
|
$this->model->update($id, $input);
|
||||||
return $this->respond([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 200);
|
return $this->respondCreated([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 201);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
6
app/Controllers/Specimen/SpecimenCollectionController.php
Normal file → Executable file
6
app/Controllers/Specimen/SpecimenCollectionController.php
Normal file → Executable file
@ -85,10 +85,12 @@ class SpecimenCollectionController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$input['SpcColID'] = $id;
|
$input['SpcColID'] = $id;
|
||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
if ($this->rules !== [] && !$this->validateData($input, $this->rules)) {
|
||||||
|
return $this->failValidationErrors($this->validator->getErrors());
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$this->model->update($id, $input);
|
$this->model->update($id, $input);
|
||||||
return $this->respond([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 200);
|
return $this->respondCreated([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 201);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
0
app/Controllers/Specimen/SpecimenController.php
Normal file → Executable file
0
app/Controllers/Specimen/SpecimenController.php
Normal file → Executable file
6
app/Controllers/Specimen/SpecimenPrepController.php
Normal file → Executable file
6
app/Controllers/Specimen/SpecimenPrepController.php
Normal file → Executable file
@ -70,10 +70,12 @@ class SpecimenPrepController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$input['SpcPrpID'] = $id;
|
$input['SpcPrpID'] = $id;
|
||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
if ($this->rules !== [] && !$this->validateData($input, $this->rules)) {
|
||||||
|
return $this->failValidationErrors($this->validator->getErrors());
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$this->model->update($id, $input);
|
$this->model->update($id, $input);
|
||||||
return $this->respond([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 200);
|
return $this->respondCreated([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 201);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
6
app/Controllers/Specimen/SpecimenStatusController.php
Normal file → Executable file
6
app/Controllers/Specimen/SpecimenStatusController.php
Normal file → Executable file
@ -83,10 +83,12 @@ class SpecimenStatusController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$input['SpcStaID'] = $id;
|
$input['SpcStaID'] = $id;
|
||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
if ($this->rules !== [] && !$this->validateData($input, $this->rules)) {
|
||||||
|
return $this->failValidationErrors($this->validator->getErrors());
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$this->model->update($id, $input);
|
$this->model->update($id, $input);
|
||||||
return $this->respond([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 200);
|
return $this->respondCreated([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 201);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
0
app/Controllers/Test/DemoOrderController.php
Normal file → Executable file
0
app/Controllers/Test/DemoOrderController.php
Normal file → Executable file
0
app/Controllers/Test/TestMapController.php
Normal file → Executable file
0
app/Controllers/Test/TestMapController.php
Normal file → Executable file
0
app/Controllers/Test/TestMapDetailController.php
Normal file → Executable file
0
app/Controllers/Test/TestMapDetailController.php
Normal file → Executable file
0
app/Controllers/Test/TestsController.php
Normal file → Executable file
0
app/Controllers/Test/TestsController.php
Normal file → Executable file
0
app/Controllers/User/UserController.php
Normal file → Executable file
0
app/Controllers/User/UserController.php
Normal file → Executable file
0
app/Controllers/ValueSetController.php
Normal file → Executable file
0
app/Controllers/ValueSetController.php
Normal file → Executable file
0
app/Controllers/ValueSetDefController.php
Normal file → Executable file
0
app/Controllers/ValueSetDefController.php
Normal file → Executable file
0
app/Controllers/ZonesController.php
Normal file → Executable file
0
app/Controllers/ZonesController.php
Normal file → Executable file
0
app/Database/Migrations/.gitkeep
Normal file → Executable file
0
app/Database/Migrations/.gitkeep
Normal file → Executable file
0
app/Database/Migrations/2026-01-01-000001_CreateValueSet.php
Normal file → Executable file
0
app/Database/Migrations/2026-01-01-000001_CreateValueSet.php
Normal file → Executable file
0
app/Database/Migrations/2026-01-01-000002_CreateOrganization.php
Normal file → Executable file
0
app/Database/Migrations/2026-01-01-000002_CreateOrganization.php
Normal file → Executable file
0
app/Database/Migrations/2026-01-01-000003_CreateUsers.php
Normal file → Executable file
0
app/Database/Migrations/2026-01-01-000003_CreateUsers.php
Normal file → Executable file
0
app/Database/Migrations/2026-01-01-000004_CreateTestDefinitions.php
Normal file → Executable file
0
app/Database/Migrations/2026-01-01-000004_CreateTestDefinitions.php
Normal file → Executable file
0
app/Database/Migrations/2026-01-01-000005_CreateLabInfrastructure.php
Normal file → Executable file
0
app/Database/Migrations/2026-01-01-000005_CreateLabInfrastructure.php
Normal file → Executable file
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user