Skip to content

Commit 4cbcfcd

Browse files
committed
Merge conflicts
2 parents 3c02f68 + 26edbd1 commit 4cbcfcd

File tree

22 files changed

+443
-349
lines changed

22 files changed

+443
-349
lines changed

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
QN_RETRIEVED_MESSAGE,
1313
PAGE_LIMIT_REQUIRED_MESSAGE,
1414
PAGE_LIMIT_INCORRECT_FORMAT_MESSAGE,
15-
CATEGORIES_NOT_FOUND_MESSAGE,
1615
CATEGORIES_RETRIEVED_MESSAGE,
1716
} from "../utils/constants.ts";
1817

@@ -196,19 +195,14 @@ export const readQuestionsList = async (
196195
};
197196
}
198197

199-
const filteredTotalQuestions = await Question.countDocuments(query);
200-
if (filteredTotalQuestions == 0) {
201-
res.status(404).json({ message: QN_NOT_FOUND_MESSAGE });
202-
return;
203-
}
204-
198+
const filteredQuestionCount = await Question.countDocuments(query);
205199
const filteredQuestions = await Question.find(query)
206200
.skip((pageInt - 1) * qnLimitInt)
207201
.limit(qnLimitInt);
208202

209203
res.status(200).json({
210204
message: QN_RETRIEVED_MESSAGE,
211-
totalQns: filteredTotalQuestions,
205+
questionCount: filteredQuestionCount,
212206
questions: filteredQuestions.map(formatQuestionResponse),
213207
});
214208
} catch (error) {
@@ -239,14 +233,11 @@ export const readQuestionIndiv = async (
239233
};
240234

241235
export const readCategories = async (
242-
req: Request,
236+
_req: Request,
243237
res: Response,
244238
): Promise<void> => {
245239
try {
246240
const uniqueCats = await Question.distinct("category");
247-
if (!uniqueCats || uniqueCats.length == 0) {
248-
res.status(404).json({ message: CATEGORIES_NOT_FOUND_MESSAGE });
249-
}
250241

251242
res.status(200).json({
252243
message: CATEGORIES_RETRIEVED_MESSAGE,

backend/question-service/src/utils/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,5 @@ export const PAGE_LIMIT_REQUIRED_MESSAGE =
2222
export const PAGE_LIMIT_INCORRECT_FORMAT_MESSAGE =
2323
"Page number and question limit per page should be positive integers.";
2424

25-
export const CATEGORIES_NOT_FOUND_MESSAGE = "No categories found.";
26-
2725
export const CATEGORIES_RETRIEVED_MESSAGE =
2826
"Categories retrieved successfully.";

backend/question-service/swagger.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ paths:
176176
message:
177177
type: string
178178
description: Message
179-
totalQns:
179+
questionCount:
180180
type: integer
181181
description: Total number of questions
182182
questions:
@@ -189,12 +189,6 @@ paths:
189189
application/json:
190190
schema:
191191
$ref: "#/definitions/Error"
192-
404:
193-
description: Question Not Found
194-
content:
195-
application/json:
196-
schema:
197-
$ref: "#/definitions/Error"
198192
500:
199193
description: Internal Server Error
200194
content:
@@ -290,7 +284,7 @@ paths:
290284
required: true
291285
description: Question id
292286
responses:
293-
200:
287+
200:
294288
description: Successful Response
295289
content:
296290
application/json:
@@ -302,7 +296,7 @@ paths:
302296
description: Message
303297
question:
304298
$ref: "#/definitions/Question"
305-
404:
299+
404:
306300
description: Question Not Found
307301
content:
308302
application/json:
@@ -321,7 +315,7 @@ paths:
321315
summary: Returns question categories
322316
description: Returns list of unique question categories
323317
responses:
324-
200:
318+
200:
325319
description: Successful Response
326320
content:
327321
application/json:
@@ -336,12 +330,6 @@ paths:
336330
items:
337331
type: string
338332
description: Categories
339-
404:
340-
description: Categories Not Found
341-
content:
342-
application/json:
343-
schema:
344-
$ref: "#/definitions/Error"
345333
500:
346334
description: Internal Server Error
347335
content:

frontend/__mocks__/styleMock.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const styleMock = {};
2+
3+
export default styleMock;

frontend/jest.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ const config: Config = {
9191

9292
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
9393
moduleNameMapper: {
94-
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
94+
'\\.(css)$': '<rootDir>/__mocks__/styleMock.ts',
95+
'\\.(svg)$': '<rootDir>/__mocks__/styleMock.ts',
9596
},
9697

9798
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader

0 commit comments

Comments
 (0)