update hospital information condition
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().required().label("Hospital Logo"),
|
logo: Joi.string().allow(null,"").label("Hospital Logo"),
|
||||||
};
|
};
|
||||||
|
|
||||||
interface FileUploadRequest extends Request {
|
interface FileUploadRequest extends Request {
|
||||||
@ -139,13 +139,15 @@ 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;
|
||||||
|
|
||||||
let hospitalinformation = new HospitalInformation();
|
let hospitalinformation = new HospitalInformation();
|
||||||
hospitalinformation.id = param.id;
|
hospitalinformation.id = param.id;
|
||||||
hospitalinformation.name = param.name;
|
hospitalinformation.name = param.name;
|
||||||
hospitalinformation.address = param.address;
|
hospitalinformation.address = param.address;
|
||||||
hospitalinformation.phone = param.phone;
|
hospitalinformation.phone = param.phone;
|
||||||
hospitalinformation.logo = param.logo;
|
hospitalinformation.logo = param.logo ? param.logo : hospital.logo;
|
||||||
hospitalinformation.updated_by = req.auth.data.name;
|
hospitalinformation.updated_by = req.auth?.data.name;
|
||||||
await queryRunner.manager.save(hospitalinformation);
|
await queryRunner.manager.save(hospitalinformation);
|
||||||
|
|
||||||
await queryRunner.commitTransaction();
|
await queryRunner.commitTransaction();
|
||||||
|
|||||||
Reference in New Issue
Block a user