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:
abumahid
2026-04-26 19:14:37 +06:00
parent 2d54031c33
commit 61fd639faf
12 changed files with 54 additions and 19 deletions
+24 -1
View File
@@ -60,6 +60,10 @@ const create_account_into_db = async (req) => {
subject: "Welcome to Quick Launch - Verification OTP",
email: payload.email,
textBody: "You can use otp or verification link for verifying your account"
}, {
attempts: 1,
removeOnComplete: true,
removeOnFail: true,
});
return null;
};
@@ -143,6 +147,15 @@ const login_user_into_db = async (req) => {
where: {
email: payload.email,
},
select: {
id: true,
email: true,
role: true,
isAccountVerified: true,
isDeleted: true,
password: true,
profile: true,
},
});
// check if account exists
if (!account) {
@@ -167,7 +180,17 @@ const login_user_into_db = async (req) => {
role: account.role,
accountId: account.id,
}, configs.jwt.access_token, configs.jwt.access_expires);
return accessToken;
const finalOutputData = {
id: account.id,
email: account.email,
role: account.role,
shopName: account?.profile?.shopName,
shopLogo: account?.profile?.shopLogo,
};
return {
accessToken,
profile: finalOutputData
};
};
const get_user_account_from_db = async (req) => {
const user = req?.user;