This commit is contained in:
wayanrivan
2026-04-16 07:04:38 +07:00
parent 043858d790
commit e57bee0311
2 changed files with 12 additions and 6 deletions

View File

@ -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