From 9d255ab9bbf815f12e524e70b12580b12e4f5137 Mon Sep 17 00:00:00 2001 From: harshithnrao Date: Tue, 11 Mar 2025 11:03:39 +0530 Subject: [PATCH] swagger feedback controller --- src/feedback/feedback.controller.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/feedback/feedback.controller.ts b/src/feedback/feedback.controller.ts index 4c81877..3721de2 100644 --- a/src/feedback/feedback.controller.ts +++ b/src/feedback/feedback.controller.ts @@ -19,9 +19,28 @@ export class FeedbackController { @ApiResponse({ status: 404, description: 'No feedback found', + example:{ + "notification": { + "exception": true, + "exceptionSeverity": "HIGH", + "exceptionMessage": "ERR.NOT_FOUND", + "stackTrace": "No feedback found" + }, + "data": null + } }) async getAllFeedbacks(@Res() res: Response) { const response = await this.feedbackService.findAll() || []; + if (!response) { + const httpResponse = new GenericResponse({ + exception: true, + exceptionSeverity: 'HIGH', + exceptionMessage: 'ERR.NOT_FOUND', + stackTrace: 'No feedback found' + }, null); + res.status(404).send(httpResponse); + return; + } const httpResponse = new GenericResponse(null, response); res.status(200).send(httpResponse); }