feat: add delete notification
This commit is contained in:
parent
b4b7d633d1
commit
549410e9e3
1 changed files with 4 additions and 3 deletions
|
|
@ -17,6 +17,7 @@ import HttpStatus from "../interfaces/http-status";
|
||||||
import prisma from "../db";
|
import prisma from "../db";
|
||||||
import { Prisma } from "@prisma/client";
|
import { Prisma } from "@prisma/client";
|
||||||
import { queryOrNot } from "../utils/relation";
|
import { queryOrNot } from "../utils/relation";
|
||||||
|
import { notFoundError } from "../utils/error";
|
||||||
|
|
||||||
type NotificationCreate = {};
|
type NotificationCreate = {};
|
||||||
type NotificationUpdate = {};
|
type NotificationUpdate = {};
|
||||||
|
|
@ -95,8 +96,8 @@ export class NotificationController extends Controller {
|
||||||
@Delete("{notificationId}")
|
@Delete("{notificationId}")
|
||||||
@Security("keycloak")
|
@Security("keycloak")
|
||||||
async deleteNotification(@Request() req: RequestWithUser, @Path() notificationId: string) {
|
async deleteNotification(@Request() req: RequestWithUser, @Path() notificationId: string) {
|
||||||
// TODO: implement
|
const record = await prisma.notification.deleteMany({ where: { id: notificationId } });
|
||||||
|
if (record.count === 0) throw notFoundError("Notification");
|
||||||
return {};
|
return record;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue