update responsible party consent to add type
This commit is contained in:
@ -48,6 +48,7 @@ export class ResponsiblePartyConsentController {
|
||||
try {
|
||||
const schema = Joi.object().keys({
|
||||
bodytext: Joi.string().required().label("Body Text"),
|
||||
type: Joi.string().required().label("Type"),
|
||||
});
|
||||
|
||||
let param: any = await schema.validateAsync(req.body);
|
||||
@ -63,6 +64,7 @@ export class ResponsiblePartyConsentController {
|
||||
|
||||
let responsiblepartyconsent = new ResponsiblePartyConsent();
|
||||
responsiblepartyconsent.body = param.bodytext;
|
||||
responsiblepartyconsent.type = param.type;
|
||||
responsiblepartyconsent.created_by = req.auth?.data.name;
|
||||
responsiblepartyconsent.updated_by = req.auth?.data.name;
|
||||
await queryRunner.manager.save(responsiblepartyconsent);
|
||||
@ -93,16 +95,18 @@ export class ResponsiblePartyConsentController {
|
||||
const schema = Joi.object().keys({
|
||||
id: Joi.string().uuid().required().label("Room ID"),
|
||||
bodytext: Joi.string().required().label("Body Text"),
|
||||
type: Joi.string().required().label("Type"),
|
||||
});
|
||||
let param: any = await schema.validateAsync(req.body);
|
||||
|
||||
let responsiblepartyconsent = await OrmHelper.DB.getRepository(ResponsiblePartyConsent)
|
||||
.createQueryBuilder("Room")
|
||||
.where("Room.id = :id", { id: param.id })
|
||||
.createQueryBuilder("ResponsiblePartyConsent")
|
||||
.where("ResponsiblePartyConsent.id = :id", { id: param.id })
|
||||
.getOne();
|
||||
if (!responsiblepartyconsent) throw { message: "Responsible Party Consent " + Language.lang.failed_not_found };
|
||||
|
||||
responsiblepartyconsent.body = param.bodytext;
|
||||
responsiblepartyconsent.type = param.type;
|
||||
responsiblepartyconsent.updated_by = req.auth?.data.name;
|
||||
responsiblepartyconsent.updated_at = moment().toDate();
|
||||
await queryRunner.manager.save(responsiblepartyconsent);
|
||||
|
||||
@ -496,6 +496,7 @@ const doc = {
|
||||
},
|
||||
responsiblepartyconsent: {
|
||||
$bodytext: "string",
|
||||
$type: "string",
|
||||
},
|
||||
},
|
||||
parameters: {},
|
||||
|
||||
Reference in New Issue
Block a user