diff --git a/src/controllers/00-notification-controller.ts b/src/controllers/00-notification-controller.ts new file mode 100644 index 0000000..1718e04 --- /dev/null +++ b/src/controllers/00-notification-controller.ts @@ -0,0 +1,80 @@ +import { + Body, + Controller, + Delete, + Get, + Path, + Post, + Put, + Query, + Request, + Route, + Security, + Tags, +} from "tsoa"; +import { RequestWithUser } from "../interfaces/user"; +import HttpStatus from "../interfaces/http-status"; + +type NotificationCreate = {}; +type NotificationUpdate = {}; + +@Route("/api/v1/notification") +@Tags("Notification") +export class NotificationController extends Controller { + @Get() + @Security("keycloak") + async getNotificationList( + @Request() req: RequestWithUser, + @Query() page: number = 1, + @Query() pageSize: number = 30, + @Query() query = "", + ) { + const total = 0; + + // TODO: implement + + return { + result: [], + page, + pageSize, + total, + }; + } + + @Get("{notificationId}") + @Security("keycloak") + async getNotification(@Request() req: RequestWithUser, @Path() notificationId: string) { + // TODO: implement + + return {}; + } + + @Post() + @Security("keycloak") + async createNotification(@Request() req: RequestWithUser, @Body() body: NotificationCreate) { + // TODO: implement + + this.setStatus(HttpStatus.CREATED); + return {}; + } + + @Put("{notificationId}") + @Security("keycloak") + async updateNotification( + @Request() req: RequestWithUser, + @Path() notificationId: string, + @Body() body: NotificationUpdate, + ) { + // TODO: implement + + return {}; + } + + @Delete("{notificationId}") + @Security("keycloak") + async deleteNotification(@Request() req: RequestWithUser, @Path() notificationId: string) { + // TODO: implement + + return {}; + } +} diff --git a/tsoa.json b/tsoa.json index 593d3cb..9b46a33 100644 --- a/tsoa.json +++ b/tsoa.json @@ -18,6 +18,7 @@ { "name": "OpenAPI" }, { "name": "Config" }, { "name": "Single-Sign On" }, + { "name": "Notification" }, { "name": "Permission" }, { "name": "Address" }, { "name": "Branch" },