feat: add endpoint skeleton

This commit is contained in:
Methapon Metanipat 2024-10-29 15:21:09 +07:00
parent 3391a53daf
commit 7ff88a2487
2 changed files with 81 additions and 0 deletions

View file

@ -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 {};
}
}

View file

@ -18,6 +18,7 @@
{ "name": "OpenAPI" }, { "name": "OpenAPI" },
{ "name": "Config" }, { "name": "Config" },
{ "name": "Single-Sign On" }, { "name": "Single-Sign On" },
{ "name": "Notification" },
{ "name": "Permission" }, { "name": "Permission" },
{ "name": "Address" }, { "name": "Address" },
{ "name": "Branch" }, { "name": "Branch" },