FIX: UserSeeder

ADD: Get-Self endpoint for users
ADD: Category and Role Seeder
FIX: Login Check Bug
ADD: Extra fields for documents and images in belonging model
ADD: localhost:5173 to cors
ADD: SuperAdmin ID to env
This commit is contained in:
2025-01-03 17:45:09 +03:30
parent bda5bca9de
commit 465b678357
11 changed files with 180 additions and 12 deletions
+3 -1
View File
@@ -7,7 +7,8 @@ exports.loginProtect = async (req, res, next) => {
// 1) Getting token and check if it's there
let token
token = req.cookies.jwt || req.cookies['crm-jwt']
token = req.cookies['bm-token']
if (req.headers.authorization && req.headers.authorization.startsWith('Bearer')) {
token = req.headers.authorization.split(' ')[1]
@@ -30,6 +31,7 @@ exports.loginProtect = async (req, res, next) => {
// 3) check if user still exist
const loggedInUser = await User.findById(decodedToken.id).populate('role')
if (!loggedInUser) {
return next(new AppError('TokenUserNotExist', 401, {}))
}