uodate
This commit is contained in:
@ -24,7 +24,7 @@ const hospitalCreateUpdateSchema = {
|
|||||||
name: Joi.string().required().label("Hospital Name"),
|
name: Joi.string().required().label("Hospital Name"),
|
||||||
address: Joi.string().required().label("Hospital Address"),
|
address: Joi.string().required().label("Hospital Address"),
|
||||||
phone: Joi.string().required().label("Hospital Phone"),
|
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 {
|
interface FileUploadRequest extends Request {
|
||||||
@ -140,7 +140,7 @@ export class HospitalInformationController {
|
|||||||
|
|
||||||
if (!hospital) throw { message: "Hospital " + Language.lang.failed_not_found };
|
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();
|
let hospitalinformation = new HospitalInformation();
|
||||||
hospitalinformation.id = param.id;
|
hospitalinformation.id = param.id;
|
||||||
@ -205,9 +205,15 @@ export class HospitalInformationController {
|
|||||||
const file = req.files.file as fileUpload.UploadedFile;
|
const file = req.files.file as fileUpload.UploadedFile;
|
||||||
|
|
||||||
// Validate file size (max 1MB)
|
// Validate file size (max 1MB)
|
||||||
const maxSize = 1024 * 1024; // 1MB
|
const maxSize = 10 * 1024 * 1024; // 10MB
|
||||||
if (file.size > maxSize) {
|
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
|
// Validate file type
|
||||||
|
|||||||
@ -84,7 +84,7 @@ export class RegistrationFeeController {
|
|||||||
const data = new RegistrationFee();
|
const data = new RegistrationFee();
|
||||||
data.type = param.type;
|
data.type = param.type;
|
||||||
data.service = Array.isArray(param.service) ? param.service : [];
|
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);
|
await OrmHelper.DB.getRepository(RegistrationFee).save(data);
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ export class RegistrationFeeController {
|
|||||||
|
|
||||||
registrationfee.type = param.type;
|
registrationfee.type = param.type;
|
||||||
registrationfee.service = Array.isArray(param.service) ? param.service : [];
|
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);
|
await OrmHelper.DB.manager.save(registrationfee);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user