update
This commit is contained in:
@ -18,18 +18,33 @@ export class ResponsiblePartyConsentController {
|
|||||||
/*
|
/*
|
||||||
#swagger.tags = ['Responsible Party Consent']
|
#swagger.tags = ['Responsible Party Consent']
|
||||||
#swagger.security = [{ "bearerAuth": [] }]
|
#swagger.security = [{ "bearerAuth": [] }]
|
||||||
|
#swagger.parameters['type'] = { in: 'query', required: false, type: 'string' }
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
const data = await OrmHelper.DB.getRepository(ResponsiblePartyConsent)
|
const schema = Joi.object({
|
||||||
.createQueryBuilder("ResponsiblePartyConsent")
|
type: Joi.string().optional().allow("").label("Type"),
|
||||||
.getMany();
|
});
|
||||||
|
|
||||||
const count_data = data.length;
|
const { type } = await schema.validateAsync(req.query);
|
||||||
const current_page = 1;
|
|
||||||
const total_count_data = count_data;
|
|
||||||
const mapped_data = data;
|
|
||||||
|
|
||||||
return ReturnHelper.successResponselist(res, 200, Language.lang.success_view, count_data, current_page, total_count_data, mapped_data);
|
let query = OrmHelper.DB.getRepository(ResponsiblePartyConsent)
|
||||||
|
.createQueryBuilder("ResponsiblePartyConsent");
|
||||||
|
|
||||||
|
if (type && type !== "") {
|
||||||
|
query = query.where("ResponsiblePartyConsent.type = :type", { type });
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await query.getMany();
|
||||||
|
|
||||||
|
return ReturnHelper.successResponselist(
|
||||||
|
res,
|
||||||
|
200,
|
||||||
|
Language.lang.success_view,
|
||||||
|
data.length,
|
||||||
|
1,
|
||||||
|
data.length,
|
||||||
|
data
|
||||||
|
);
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
const err = e as Error;
|
const err = e as Error;
|
||||||
|
|||||||
Reference in New Issue
Block a user