From f0e40c1dcaa090bf930082dc34f16aff19c394dd Mon Sep 17 00:00:00 2001 From: himaniraghav3 Date: Wed, 30 Apr 2025 17:11:08 +0530 Subject: [PATCH] PM-1068 refactor: allow PMs to view all copilot requests --- src/routes/copilotRequest/list.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/routes/copilotRequest/list.js b/src/routes/copilotRequest/list.js index 66f36606..a36a3d7b 100644 --- a/src/routes/copilotRequest/list.js +++ b/src/routes/copilotRequest/list.js @@ -1,7 +1,6 @@ import _ from 'lodash'; import models from '../../models'; -import { ADMIN_ROLES } from '../../constants'; import util from '../../util'; import { PERMISSION } from '../../permissions/constants'; @@ -16,9 +15,6 @@ module.exports = [ return next(err); } - const isAdmin = util.hasRoles(req, ADMIN_ROLES); - - const userId = req.authUser.userId; const projectId = _.parseInt(req.params.projectId); let sort = req.query.sort ? decodeURIComponent(req.query.sort) : 'createdAt desc'; @@ -31,11 +27,7 @@ module.exports = [ } const sortParams = sort.split(' '); - // Admin can see all requests and the PM can only see requests created by them - const whereCondition = _.assign({}, - isAdmin ? {} : { createdBy: userId }, - projectId ? { projectId } : {}, - ); + const whereCondition = projectId ? { projectId } : {}; return models.CopilotRequest.findAll({ where: whereCondition,