Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
fix: #17
Browse files Browse the repository at this point in the history
  • Loading branch information
NotHydra committed Feb 9, 2024
1 parent 23c9cb6 commit 82d18f7
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 1 deletion.
12 changes: 11 additions & 1 deletion apps/api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@ import { SubTrashBinModule } from "./model/sub-trash-bin/sub-trash-bin.module";
import { TrashModule } from "./model/trash/trash.module";
import { HistoryModule } from "./model/history/history.module";
import { ReportModule } from "./model/report/report.module";
import { FeedbackModule } from "./model/feedback/feedback.module";

@Module({
imports: [ConfigModule, UserModule, TrashBinModule, SubTrashBinModule, TrashModule, HistoryModule, ReportModule],
imports: [
ConfigModule,
UserModule,
TrashBinModule,
SubTrashBinModule,
TrashModule,
HistoryModule,
ReportModule,
FeedbackModule,
],
})
export class AppModule {}
31 changes: 31 additions & 0 deletions apps/api/src/model/feedback/feedback.controller.ts
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");
}
}
12 changes: 12 additions & 0 deletions apps/api/src/model/feedback/feedback.module.ts
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 {}
22 changes: 22 additions & 0 deletions apps/api/src/model/feedback/feedback.rest
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

###

0 comments on commit 82d18f7

Please sign in to comment.