Skip to content

Commit 6fb8f34

Browse files
committed
fix: project object optional
1 parent 3d2216a commit 6fb8f34

File tree

1 file changed

+7
-4
lines changed
  • src/routes/copilotOpportunity

1 file changed

+7
-4
lines changed

src/routes/copilotOpportunity/list.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,18 @@ module.exports = [
6868
const plainOpportunity = opportunity.get({ plain: true });
6969

7070
req.log.debug(isAdminOrManager, 'admin or manager', plainOpportunity);
71+
72+
const formatted = Object.assign({}, plainOpportunity,
73+
plainOpportunity.copilotRequest ? plainOpportunity.copilotRequest.data : {},
74+
{ copilotRequest: undefined },
75+
);
76+
7177
// For users who are not admin or manager, we dont want to expose
7278
// the project id
7379
if (!isAdminOrManager) {
7480
delete plainOpportunity.projectId;
7581
}
76-
return Object.assign({}, plainOpportunity,
77-
plainOpportunity.copilotRequest ? plainOpportunity.copilotRequest.data : {},
78-
{ copilotRequest: undefined },
79-
);
82+
return formatted;
8083
});
8184
return util.setPaginationHeaders(req, res, {
8285
count: copilotOpportunities.count,

0 commit comments

Comments
 (0)