✨ feat(account, order, plan, profile, redis): enhance functionality and security
- Updated CORS settings for frontend compatibility. - Integrated Redis URL configuration. - Improved login response structure in account service. - Added role-based authorization for order and plan management. - Enhanced error handling and logging in profile and plan services. - Updated Swagger documentation for clarity on order statuses. - Configured Redis connection for better performance.
This commit is contained in:
+4
@@ -147,6 +147,10 @@ const update_order_into_db = async (req) => {
|
||||
const delete_order_from_db = async (req) => {
|
||||
// define your own login here
|
||||
const { id } = req.params;
|
||||
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
@@ -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: {
|
||||
@@ -115,7 +119,7 @@ export const orderSwaggerDocs = {
|
||||
},
|
||||
patch: {
|
||||
tags: ["order"],
|
||||
summary: "Update order",
|
||||
summary: "Update order -(Admin route)",
|
||||
description: "",
|
||||
parameters: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user