Spaces:
Sleeping
Sleeping
Kuruva Laxmi commited on
Commit ·
d2fec9a
1
Parent(s): a79d1fb
Fix getPhotographerById to support dual-role accounts
Browse files
server/src/controllers/userController.js
CHANGED
|
@@ -92,7 +92,7 @@ const removePortfolioItem = async (req, res) => {
|
|
| 92 |
const getPhotographerById = async (req, res) => {
|
| 93 |
try {
|
| 94 |
const user = await User.findById(req.params.id).select('-password');
|
| 95 |
-
if (user && user.role === 'photographer') {
|
| 96 |
res.json(user);
|
| 97 |
} else {
|
| 98 |
res.status(404).json({ message: 'Photographer not found' });
|
|
|
|
| 92 |
const getPhotographerById = async (req, res) => {
|
| 93 |
try {
|
| 94 |
const user = await User.findById(req.params.id).select('-password');
|
| 95 |
+
if (user && (user.role === 'photographer' || (user.roles && user.roles.includes('photographer')))) {
|
| 96 |
res.json(user);
|
| 97 |
} else {
|
| 98 |
res.status(404).json({ message: 'Photographer not found' });
|