adding the order service delete on the plan api

This commit is contained in:
2026-04-26 18:57:33 +06:00
parent 4c1614601a
commit 107b94bc97
6 changed files with 17 additions and 7 deletions
+4
View File
@@ -161,6 +161,10 @@ const update_order_into_db = async (req: Request) => {
const delete_order_from_db = async (req: Request) => {
// define your own login here
const { id } = req.params as { id: string };
const user = req.user;
if (user?.role !== "ADMIN") {
throw new AppError("You are not authorized to perform this action", 403);
}
const result = await prisma.order.delete({ where: { id } });
return result;
};
+6 -2
View File
@@ -3,7 +3,11 @@ export const orderSwaggerDocs = {
post: {
tags: ["order"],
summary: "Create new order",
description: "",
description: ` INITIATED
CONFIRMED
ONGOING
DELIVERED
CANCELLED`,
requestBody: {
required: true,
content: {
@@ -116,7 +120,7 @@ export const orderSwaggerDocs = {
},
patch: {
tags: ["order"],
summary: "Update order",
summary: "Update order -(Admin route)",
description: "",
parameters: [
{