swagger feedback controller
This commit is contained in:
parent
04dbf410df
commit
9d255ab9bb
@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user