update hospital information condition
This commit is contained in:
@ -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().required().label("Hospital Logo"),
|
||||
logo: Joi.string().allow(null,"").label("Hospital Logo"),
|
||||
};
|
||||
|
||||
interface FileUploadRequest extends Request {
|
||||
@ -66,7 +66,7 @@ export class HospitalInformationController {
|
||||
} catch (e: unknown) {
|
||||
log.error(e);
|
||||
const err = e as Error;
|
||||
return ReturnHelper.errorResponse(res,400,401,Language.lang.failed_view,err.message);
|
||||
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_view, err.message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,13 +139,15 @@ 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;
|
||||
|
||||
let hospitalinformation = new HospitalInformation();
|
||||
hospitalinformation.id = param.id;
|
||||
hospitalinformation.name = param.name;
|
||||
hospitalinformation.address = param.address;
|
||||
hospitalinformation.phone = param.phone;
|
||||
hospitalinformation.logo = param.logo;
|
||||
hospitalinformation.updated_by = req.auth.data.name;
|
||||
hospitalinformation.logo = param.logo ? param.logo : hospital.logo;
|
||||
hospitalinformation.updated_by = req.auth?.data.name;
|
||||
await queryRunner.manager.save(hospitalinformation);
|
||||
|
||||
await queryRunner.commitTransaction();
|
||||
@ -231,7 +233,7 @@ export class HospitalInformationController {
|
||||
// md5: file.md5
|
||||
};
|
||||
|
||||
const folder_path ='uploads/hospital-logo/';
|
||||
const folder_path = 'uploads/hospital-logo/';
|
||||
const file_path = path.join(folder_path, name);
|
||||
|
||||
// Create directory if it doesn't exist
|
||||
|
||||
Reference in New Issue
Block a user