Skip to content

Commit b960306

Browse files
committed
fix: member role validation on create and update
- Unlike in Project Service endpoints, in this processor we should let create members with any roles because Project Service may create members with any roles implicitly, when accepting invitations. - Also, updated the list of possible user roles, with recently added new roles.
1 parent e189bbe commit b960306

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/constants.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ const PROJECT_MEMBER_ROLE = {
5656
OBSERVER: 'observer',
5757
CUSTOMER: 'customer',
5858
COPILOT: 'copilot',
59-
ACCOUNT_MANAGER: 'account_manager'
59+
ACCOUNT_MANAGER: 'account_manager',
60+
PROGRAM_MANAGER: 'program_manager',
61+
ACCOUNT_EXECUTIVE: 'account_executive',
62+
SOLUTION_ARCHITECT: 'solution_architect',
63+
PROJECT_MANAGER: 'project_manager'
6064
}
6165

6266
const MILESTONE_TEMPLATE_REFERENCES = {

src/services/ProcessorServiceProjectMember.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ function createIdSchema () {
2727
function updateSchema () {
2828
return createIdSchema().keys({
2929
isPrimary: Joi.boolean(),
30-
role: Joi.any().valid(PROJECT_MEMBER_ROLE.CUSTOMER, PROJECT_MEMBER_ROLE.MANAGER,
31-
PROJECT_MEMBER_ROLE.ACCOUNT_MANAGER, PROJECT_MEMBER_ROLE.COPILOT, PROJECT_MEMBER_ROLE.OBSERVER).required()
30+
// unlike in Project Service endpoints, in this processor we should let create members with any roles
31+
// because Project Service may create members with any roles implicitly, when accepting invitations
32+
role: Joi.string().valid(_.values(PROJECT_MEMBER_ROLE)).required()
3233
})
3334
}
3435

@@ -38,8 +39,7 @@ function updateSchema () {
3839
*/
3940
function createSchema () {
4041
return createIdSchema().keys({
41-
role: Joi.any()
42-
.valid(PROJECT_MEMBER_ROLE.MANAGER, PROJECT_MEMBER_ROLE.ACCOUNT_MANAGER, PROJECT_MEMBER_ROLE.COPILOT)
42+
role: Joi.string().valid(_.values(PROJECT_MEMBER_ROLE))
4343
})
4444
}
4545

0 commit comments

Comments
 (0)