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