♻️ refactor(account, order, plan, profile, support, email): restructure application modules and enhance error handling
Updated Docker configuration, refactored middleware for improved error handling, and restructured account, order, plan, profile, and support modules, including their routes, services, and validations. Enhanced email processing queues and utilities for token generation, pagination, and response management to streamline the application architecture and enhance maintainability.
This commit is contained in:
+60
@@ -0,0 +1,60 @@
|
||||
import catchAsync from "../../utils/catch_async.js";
|
||||
import manageResponse from "../../utils/manage_response.js";
|
||||
import { plan_service } from "./plan.service.js";
|
||||
const get_all_plan = catchAsync(async (req, res) => {
|
||||
const result = await plan_service.get_all_plan_from_db(req);
|
||||
manageResponse(res, {
|
||||
success: true,
|
||||
statusCode: 200,
|
||||
message: "All plan fetched successfully.",
|
||||
data: result,
|
||||
meta: {},
|
||||
});
|
||||
});
|
||||
const get_single_plan = catchAsync(async (req, res) => {
|
||||
const result = await plan_service.get_single_plan_from_db(req);
|
||||
manageResponse(res, {
|
||||
success: true,
|
||||
statusCode: 200,
|
||||
message: "Single plan fetched successfully.",
|
||||
data: result,
|
||||
meta: {},
|
||||
});
|
||||
});
|
||||
const create_plan = catchAsync(async (req, res) => {
|
||||
const result = await plan_service.create_plan_into_db(req);
|
||||
manageResponse(res, {
|
||||
success: true,
|
||||
statusCode: 200,
|
||||
message: "plan created successfully.",
|
||||
data: result,
|
||||
meta: {},
|
||||
});
|
||||
});
|
||||
const update_plan = catchAsync(async (req, res) => {
|
||||
const result = await plan_service.update_plan_into_db(req);
|
||||
manageResponse(res, {
|
||||
success: true,
|
||||
statusCode: 200,
|
||||
message: "plan updated successfully.",
|
||||
data: result,
|
||||
meta: {},
|
||||
});
|
||||
});
|
||||
const delete_plan = catchAsync(async (req, res) => {
|
||||
const result = await plan_service.delete_plan_from_db(req);
|
||||
manageResponse(res, {
|
||||
success: true,
|
||||
statusCode: 200,
|
||||
message: "plan deleted successfully.",
|
||||
data: result,
|
||||
meta: {},
|
||||
});
|
||||
});
|
||||
export const plan_controller = {
|
||||
get_all_plan,
|
||||
get_single_plan,
|
||||
create_plan,
|
||||
update_plan,
|
||||
delete_plan,
|
||||
};
|
||||
Reference in New Issue
Block a user