Skip to content

Commit da0938f

Browse files
committed
change readQuestionsList return field
- return total number of questions instead of pages
1 parent 454ed1f commit da0938f

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

backend/question-service/src/controllers/questionController.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,14 @@ export const readQuestionsList = async (
200200
res.status(404).json({ message: QN_NOT_FOUND_MESSAGE });
201201
return;
202202
}
203-
const filteredTotalPages = Math.ceil(filteredTotalQuestions / qnLimitInt);
204203

205204
const filteredQuestions = await Question.find(query)
206205
.skip((pageInt - 1) * qnLimitInt)
207206
.limit(qnLimitInt);
208207

209208
res.status(200).json({
210209
message: QN_RETRIEVED_MESSAGE,
211-
pages: filteredTotalPages,
210+
totalQns: filteredTotalQuestions,
212211
questions: filteredQuestions,
213212
});
214213
} catch (error) {

backend/question-service/swagger.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ paths:
176176
message:
177177
type: string
178178
description: Message
179-
pages:
179+
totalQns:
180180
type: integer
181-
description: Total number of pages of questions
181+
description: Total number of questions
182182
questions:
183183
type: array
184184
items:

0 commit comments

Comments
 (0)