swagger feedback controller

This commit is contained in:
harshithnrao 2025-03-11 11:03:39 +05:30
parent 04dbf410df
commit 9d255ab9bb

View File

@ -19,9 +19,28 @@ export class FeedbackController {
@ApiResponse({ @ApiResponse({
status: 404, status: 404,
description: 'No feedback found', 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) { async getAllFeedbacks(@Res() res: Response) {
const response = await this.feedbackService.findAll() || []; 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); const httpResponse = new GenericResponse(null, response);
res.status(200).send(httpResponse); res.status(200).send(httpResponse);
} }