Skip to content

Commit

Permalink
Task #218003 [BE] Added context for events in lms get certificate (#1052
Browse files Browse the repository at this point in the history
)

* events

* events

* events
  • Loading branch information
Tusharmahajan12 authored Apr 24, 2024
1 parent 6ea1f60 commit 6bf84a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/src/lms/lms.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,9 @@ export class LMSController {
@UseGuards(new AuthGuard())
public async getList(
@Req() req: any,
@Body() body: any,
@Param('id') id: any,
@Res() res: any,
) {
return this.lmsService.getList(req, body, id, res);
return this.lmsService.getList(req, id, res);
}
}
9 changes: 7 additions & 2 deletions src/src/lms/lms.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,13 +569,18 @@ export class LMSService {
});
}
}
public async getList(req, body, user_id, res) {
public async getList(req, user_id, res) {
const body = req?.query;
const page = isNaN(body.page) ? 1 : parseInt(body.page);
const limit = isNaN(body.limit) ? 6 : parseInt(body.limit);
let offset = page > 1 ? limit * (page - 1) : 0;
let skip = page > 1 ? limit * (page - 1) : 0;
const context = req?.query?.context || 'events';
const context = body.context || 'events';
let filterQuery = [`context: {_eq: ${context}}`];
//add filter if context_id present
if (body.context_id) {
filterQuery.push(`context_id: {_eq: ${body?.context_id}}`);
}

const data = {
query: `query MyQuery($limit:Int, $offset:Int) {
Expand Down

0 comments on commit 6bf84a2

Please sign in to comment.