Skip to content

Commit 0994e2d

Browse files
committed
Merge
2 parents 32165a8 + 69fe32b commit 0994e2d

File tree

21 files changed

+389
-22
lines changed

21 files changed

+389
-22
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ workflows:
149149
context : org-global
150150
filters:
151151
branches:
152-
only: ['develop', 'migration-setup']
152+
only: ['develop', 'migration-setup', 'pm-1378']
153153
- deployProd:
154154
context : org-global
155155
filters:

config/custom-environment-variables.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"dbConfig": {
3131
"masterUrl": "DB_MASTER_URL",
3232
"maxPoolSize": "DB_MAX_POOL_SIZE",
33-
"minPoolSize": "DB_MIN_POOL_SIZE"
33+
"minPoolSize": "DB_MIN_POOL_SIZE",
34+
"schema": "DB_SCHEMA_NAME"
3435
},
3536
"kafkaConfig": {
3637
"groupId": "KAFKA_GROUP_ID",

config/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"inviteEmailSubject": "You are invited to Topcoder",
5555
"inviteEmailSectionTitle": "Project Invitation",
5656
"workManagerUrl": "https://challenges.topcoder-dev.com",
57+
"copilotPortalUrl": "https://copilots.topcoder-dev.com",
5758
"accountsAppUrl": "https://accounts.topcoder-dev.com",
5859
"MAX_REVISION_NUMBER": 100,
5960
"UNIQUE_GMAIL_VALIDATION": false,

config/development.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"pubsubExchangeName": "dev.projects",
44
"attachmentsS3Bucket": "topcoder-dev-media",
55
"workManagerUrl": "https://challenges.topcoder-dev.com",
6+
"copilotPortalUrl": "https://copilots.topcoder-dev.com",
67
"fileServiceEndpoint": "https://api.topcoder-dev.com/v5/files",
78
"memberServiceEndpoint": "https://api.topcoder-dev.com/v5/members",
89
"identityServiceEndpoint": "https://api.topcoder-dev.com/v3/",

config/production.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"authDomain": "topcoder.com",
33
"workManagerUrl": "https://challenges.topcoder.com",
4+
"copilotPortalUrl": "https://copilots.topcoder.com",
45
"sfdcBillingAccountNameField": "Billing_Account_name__c",
56
"sfdcBillingAccountMarkupField": "Mark_up__c",
67
"sfdcBillingAccountActiveField": "Active__c"

src/constants.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const COPILOT_APPLICATION_STATUS = {
2222
PENDING: 'pending',
2323
INVITED: 'invited',
2424
ACCEPTED: 'accepted',
25+
CANCELED: 'canceled',
2526
};
2627

2728
export const COPILOT_OPPORTUNITY_STATUS = {
@@ -301,8 +302,16 @@ export const CONNECT_NOTIFICATION_EVENT = {
301302
TOPIC_UPDATED: 'connect.notification.project.topic.updated',
302303
POST_CREATED: 'connect.notification.project.post.created',
303304
POST_UPDATED: 'connect.notification.project.post.edited',
305+
306+
// External action email
307+
EXTERNAL_ACTION_EMAIL: 'external.action.email',
304308
};
305309

310+
export const TEMPLATE_IDS = {
311+
APPLY_COPILOT: 'd-d7c1f48628654798a05c8e09e52db14f',
312+
CREATE_REQUEST: 'd-3efdc91da580479d810c7acd50a4c17f',
313+
PROJECT_MEMBER_INVITED: 'd-b47a25b103604bc28fc0ce77e77fb681',
314+
}
306315
export const REGEX = {
307316
URL: /^(http(s?):\/\/)?(www\.)?[a-zA-Z0-9\.\-\_]+(\.[a-zA-Z]{2,15})+(\:[0-9]{2,5})?(\/[a-zA-Z0-9\_\-\s\.\/\?\%\#\&\=;]*)?$/, // eslint-disable-line
308317
};
@@ -360,6 +369,11 @@ export const INVITE_STATUS = {
360369
CANCELED: 'canceled',
361370
};
362371

372+
export const INVITE_SOURCE = {
373+
WORK_MANAGER: "work_manager",
374+
COPILOT_PORTAL: "copilot_portal",
375+
};
376+
363377
export const SCOPE_CHANGE_REQ_STATUS = {
364378
PENDING: 'pending',
365379
APPROVED: 'approved',

src/events/busApi.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,7 @@ module.exports = (app, logger) => {
997997
const email = resource.email;
998998
const status = resource.status;
999999
const role = resource.role;
1000+
const source = resource.source;
10001001

10011002
models.Project.findOne({
10021003
where: { id: projectId },
@@ -1011,6 +1012,7 @@ module.exports = (app, logger) => {
10111012
role,
10121013
initiatorUserId: req.authUser.userId,
10131014
isSSO: util.isSSO(project),
1015+
source,
10141016
}, logger);
10151017
} else {
10161018
// send event to bus api
@@ -1021,6 +1023,7 @@ module.exports = (app, logger) => {
10211023
role,
10221024
initiatorUserId: req.authUser.userId,
10231025
isSSO: util.isSSO(project),
1026+
source,
10241027
});
10251028
createEvent(CONNECT_NOTIFICATION_EVENT.PROJECT_MEMBER_INVITE_CREATED, {
10261029
projectId,
@@ -1029,6 +1032,7 @@ module.exports = (app, logger) => {
10291032
role,
10301033
initiatorUserId: req.authUser.userId,
10311034
isSSO: util.isSSO(project),
1035+
source,
10321036
}, logger);
10331037
}
10341038
}).catch(err => logger.error(err)); // eslint-disable-line no-unused-vars

src/models/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const operatorsAliases = {
2929

3030
const sequelize = new Sequelize(config.get('dbConfig.masterUrl'), {
3131
operatorsAliases,
32+
schema: config.get('dbConfig.schema'),
3233
logging: false,
3334
dialectOptions: {
3435
ssl: false,

src/models/projectMember.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ module.exports = function defineProjectMember(sequelize, DataTypes) {
3434
],
3535
});
3636

37+
ProjectMember.associate = (models) => {
38+
ProjectMember.belongsTo(models.Project, { foreignKey: 'projectId' });
39+
};
40+
3741
ProjectMember.getProjectIdsForUser = userId => ProjectMember.findAll({
3842
where: {
3943
deletedAt: { $eq: null },

src/permissions/constants.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,19 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
288288
],
289289
scopes: SCOPES_PROJECTS_WRITE,
290290
},
291+
292+
CANCEL_COPILOT_OPPORTUNITY: {
293+
meta: {
294+
title: 'Cancel copilot opportunity',
295+
group: 'Cancel copilot opportunity',
296+
description: 'Who can cancel copilot opportunity.',
297+
},
298+
topcoderRoles: [
299+
USER_ROLE.PROJECT_MANAGER,
300+
USER_ROLE.TOPCODER_ADMIN,
301+
],
302+
scopes: SCOPES_PROJECTS_WRITE,
303+
},
291304

292305
LIST_COPILOT_OPPORTUNITY: {
293306
meta: {

0 commit comments

Comments
 (0)