This repository has been archived by the owner on Aug 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Body, Controller, ForbiddenException, Param, ParseIntPipe, UseInterceptors } from "@nestjs/common"; | ||
import { FeedbackCreateDTO, FeedbackModel, FeedbackUpdateDTO, ResponseFormatInterface } from "@trashtrack/common"; | ||
|
||
import { ResponseFormatInterceptor } from "../../interceptor/response-format.interceptor"; | ||
|
||
import { BaseController } from "../base.controller"; | ||
|
||
import { FeedbackService } from "./feedback.service"; | ||
|
||
interface FeedbackControllerInterface {} | ||
|
||
@Controller("feedback") | ||
@UseInterceptors(ResponseFormatInterceptor) | ||
export class FeedbackController | ||
extends BaseController<FeedbackModel, FeedbackCreateDTO, FeedbackUpdateDTO, FeedbackService> | ||
implements FeedbackControllerInterface | ||
{ | ||
constructor(modelService: FeedbackService) { | ||
super(FeedbackController.name, modelService); | ||
} | ||
|
||
public async change( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
@Param("id", ParseIntPipe) id: number, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
@Body() payload: FeedbackUpdateDTO | ||
): Promise<ResponseFormatInterface<FeedbackModel>> { | ||
this.loggerService.error(`Change: Method Is Disabled`); | ||
throw new ForbiddenException("Method Is Disabled"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Module } from "@nestjs/common"; | ||
|
||
import { PrismaService } from "../../provider/prisma.service"; | ||
|
||
import { FeedbackController } from "./feedback.controller"; | ||
import { FeedbackService } from "./feedback.service"; | ||
|
||
@Module({ | ||
controllers: [FeedbackController], | ||
providers: [PrismaService, FeedbackService], | ||
}) | ||
export class FeedbackModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
GET http://localhost:3001/api/feedback | ||
|
||
### | ||
|
||
GET http://localhost:3001/api/feedback/id/1 | ||
|
||
### | ||
|
||
POST http://localhost:3001/api/feedback | ||
Content-Type: application/json | ||
|
||
{ | ||
"reportId": 1, | ||
"title": "First Response", | ||
"description": "First Description" | ||
} | ||
|
||
### | ||
|
||
DELETE http://localhost:3001/api/feedback/1 | ||
|
||
### |