This commit is contained in:
Muhammad Rayhan Ardiansyah
2026-03-17 16:52:27 +07:00
parent 4cc8db4484
commit 8939d47b6c
3 changed files with 50 additions and 0 deletions

View File

@ -336,4 +336,28 @@ export class PatientGroupController {
return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_restore, err.message); return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_restore, err.message);
} }
} }
static async detail(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
/*
#swagger.tags = ['PatientGroup']
#swagger.security = [{ "bearerAuth": [] }]
#swagger.parameters['id'] = { description: '', in: 'path', type: 'string' }
*/
try {
const schema = Joi.object().keys({
id: Joi.string().uuid().required().label("Patient Group Id"),
});
let param: any = await schema.validateAsync(req.params);
let data = await PatientGroupModel.list({ "id": param.id }).then((q) => q.getOne());
if (!data) throw { message: "Patient Group Not Found" };
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_view, data);
} catch (e: unknown) {
log.error(e);
const err = e as Error;
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_not_found, err.message);
}
}
} }

View File

@ -371,4 +371,28 @@ export class PatientGuarantorController {
return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_restore, err.message); return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_restore, err.message);
} }
} }
static async detail(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
/*
#swagger.tags = ['PatientGuarantor']
#swagger.security = [{ "bearerAuth": [] }]
#swagger.parameters['id'] = { description: '', in: 'path', type: 'string' }
*/
try {
const schema = Joi.object().keys({
id: Joi.string().uuid().required().label("Patient Guarantor Id"),
});
let param: any = await schema.validateAsync(req.params);
let data = await PatientGuarantorModel.list({ "id": param.id }).then((q) => q.getOne());
if (!data) throw { message: "Patient Guarantor Not Found" };
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_view, data);
} catch (e: unknown) {
log.error(e);
const err = e as Error;
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_not_found, err.message);
}
}
} }

View File

@ -403,6 +403,7 @@ export class RoutePrivate {
app.put('/api/patient-group/update/:id', PatientGroupController.update) app.put('/api/patient-group/update/:id', PatientGroupController.update)
app.delete('/api/patient-group/delete/:id/:hard', PatientGroupController.delete) app.delete('/api/patient-group/delete/:id/:hard', PatientGroupController.delete)
app.put('/api/patient-group/restore/:id', PatientGroupController.restore) app.put('/api/patient-group/restore/:id', PatientGroupController.restore)
app.get('/api/patient-group/view/:id', PatientGuarantorController.detail)
app.get('/api/patient-guarantor/list', PatientGuarantorController.list) app.get('/api/patient-guarantor/list', PatientGuarantorController.list)
app.get('/api/patient-guarantor/export', PatientGuarantorController.export) app.get('/api/patient-guarantor/export', PatientGuarantorController.export)
@ -410,6 +411,7 @@ export class RoutePrivate {
app.put('/api/patient-guarantor/update/:id', PatientGuarantorController.update) app.put('/api/patient-guarantor/update/:id', PatientGuarantorController.update)
app.delete('/api/patient-guarantor/delete/:id/:hard', PatientGuarantorController.delete) app.delete('/api/patient-guarantor/delete/:id/:hard', PatientGuarantorController.delete)
app.put('/api/patient-guarantor/restore/:id', PatientGuarantorController.restore) app.put('/api/patient-guarantor/restore/:id', PatientGuarantorController.restore)
app.get('/api/patient-guarantor/view/:id', PatientGuarantorController.detail)
app.get('/api/refferal-hospital/list', RefferalHospitalController.list) app.get('/api/refferal-hospital/list', RefferalHospitalController.list)
app.get('/api/refferal-hospital/export', RefferalHospitalController.export) app.get('/api/refferal-hospital/export', RefferalHospitalController.export)