From e57bee0311d9483648633475a7e271af14803f66 Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Thu, 16 Apr 2026 07:04:38 +0700 Subject: [PATCH] uodate --- src/controllers/hospital_information.ts | 14 ++++++++++---- src/controllers/registrationfee.ts | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/controllers/hospital_information.ts b/src/controllers/hospital_information.ts index 2e5bd61..5165553 100644 --- a/src/controllers/hospital_information.ts +++ b/src/controllers/hospital_information.ts @@ -24,7 +24,7 @@ const hospitalCreateUpdateSchema = { name: Joi.string().required().label("Hospital Name"), address: Joi.string().required().label("Hospital Address"), phone: Joi.string().required().label("Hospital Phone"), - logo: Joi.string().allow(null,"").label("Hospital Logo"), + logo: Joi.string().allow(null, "").label("Hospital Logo"), }; interface FileUploadRequest extends Request { @@ -140,7 +140,7 @@ export class HospitalInformationController { if (!hospital) throw { message: "Hospital " + Language.lang.failed_not_found }; - if(param.logo == "" || param.logo == null || param.logo == undefined) param.logo = hospital.logo; + if (param.logo == "" || param.logo == null || param.logo == undefined) param.logo = hospital.logo; let hospitalinformation = new HospitalInformation(); hospitalinformation.id = param.id; @@ -205,9 +205,15 @@ export class HospitalInformationController { const file = req.files.file as fileUpload.UploadedFile; // Validate file size (max 1MB) - const maxSize = 1024 * 1024; // 1MB + const maxSize = 10 * 1024 * 1024; // 10MB if (file.size > maxSize) { - return ReturnHelper.errorResponse(res, 400, 400, Language.lang.failed_insert, "File size exceeds 1MB limit"); + return ReturnHelper.errorResponse( + res, + 400, + 400, + Language.lang.failed_insert, + "File size exceeds 10MB limit" + ); } // Validate file type diff --git a/src/controllers/registrationfee.ts b/src/controllers/registrationfee.ts index 20d2d09..fc8a524 100644 --- a/src/controllers/registrationfee.ts +++ b/src/controllers/registrationfee.ts @@ -84,7 +84,7 @@ export class RegistrationFeeController { const data = new RegistrationFee(); data.type = param.type; data.service = Array.isArray(param.service) ? param.service : []; - data.created_by = req.auth.data.name; + data.created_by = req.auth?.data.name; await OrmHelper.DB.getRepository(RegistrationFee).save(data); @@ -132,7 +132,7 @@ export class RegistrationFeeController { registrationfee.type = param.type; registrationfee.service = Array.isArray(param.service) ? param.service : []; - registrationfee.updated_by = req.auth.data.name; + registrationfee.updated_by = req.auth?.data.name; await OrmHelper.DB.manager.save(registrationfee);