Skip to content

Commit 6bf84a2

Browse files
Task #218003 [BE] Added context for events in lms get certificate (#1052)
* events * events * events
1 parent 6ea1f60 commit 6bf84a2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/src/lms/lms.controller.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,9 @@ export class LMSController {
9999
@UseGuards(new AuthGuard())
100100
public async getList(
101101
@Req() req: any,
102-
@Body() body: any,
103102
@Param('id') id: any,
104103
@Res() res: any,
105104
) {
106-
return this.lmsService.getList(req, body, id, res);
105+
return this.lmsService.getList(req, id, res);
107106
}
108107
}

src/src/lms/lms.service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,13 +569,18 @@ export class LMSService {
569569
});
570570
}
571571
}
572-
public async getList(req, body, user_id, res) {
572+
public async getList(req, user_id, res) {
573+
const body = req?.query;
573574
const page = isNaN(body.page) ? 1 : parseInt(body.page);
574575
const limit = isNaN(body.limit) ? 6 : parseInt(body.limit);
575576
let offset = page > 1 ? limit * (page - 1) : 0;
576577
let skip = page > 1 ? limit * (page - 1) : 0;
577-
const context = req?.query?.context || 'events';
578+
const context = body.context || 'events';
578579
let filterQuery = [`context: {_eq: ${context}}`];
580+
//add filter if context_id present
581+
if (body.context_id) {
582+
filterQuery.push(`context_id: {_eq: ${body?.context_id}}`);
583+
}
579584

580585
const data = {
581586
query: `query MyQuery($limit:Int, $offset:Int) {

0 commit comments

Comments
 (0)