Skip to content

Commit 8fc83b8

Browse files
committed
merge dev
2 parents 4f99606 + 6190399 commit 8fc83b8

27 files changed

+70
-39
lines changed

config/default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"TOKEN_CACHE_TIME": "",
5353
"whitelistedOriginsForUserIdAuth": "[\"https:\/\/topcoder-newauth.auth0.com\/\",\"https:\/\/api.topcoder-dev.com\"]",
5454
"AUTH0_PROXY_SERVER_URL" : "",
55-
"EMAIL_INVITE_FROM_NAME":"Topcoder Connect",
55+
"EMAIL_INVITE_FROM_NAME":"Topcoder",
5656
"EMAIL_INVITE_FROM_EMAIL":"noreply@connect.topcoder.com",
5757
"CONNECT_URL":"https://connect.topcoder-dev.com"
5858

migrations/20181201_create_project_member_invites.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ CREATE TABLE project_member_invites (
2222
"deletedBy" bigint
2323
);
2424

25+
ALTER TABLE ONLY project_member_invites
26+
ADD CONSTRAINT project_member_invites_pkey PRIMARY KEY (id);
27+
2528
CREATE SEQUENCE project_member_invites_id_seq
2629
START WITH 1
2730
INCREMENT BY 1
@@ -31,5 +34,8 @@ CREATE SEQUENCE project_member_invites_id_seq
3134

3235
ALTER SEQUENCE project_member_invites_id_seq OWNED BY project_member_invites.id;
3336

37+
ALTER TABLE project_member_invites
38+
ALTER COLUMN id SET DEFAULT nextval('project_member_invites_id_seq');
39+
3440
ALTER TABLE ONLY project_member_invites
3541
ADD CONSTRAINT "project_member_invites_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES projects(id) ON UPDATE CASCADE ON DELETE CASCADE;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--
2+
-- UPDATE EXISTING TABLES:
3+
-- product_templates:
4+
-- added column `subCategory`
5+
6+
--
7+
-- product_templates
8+
9+
-- Add new column
10+
ALTER TABLE product_templates ADD COLUMN "subCategory" character varying(45);
11+
-- Update new column
12+
UPDATE product_templates SET "subCategory"="category" WHERE "subCategory" is NULL;
13+
-- Set not null
14+
ALTER TABLE product_templates ALTER COLUMN "subCategory" SET NOT NULL;

src/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export const BUS_API_EVENT = {
131131
// Project Member Invites
132132
PROJECT_MEMBER_INVITE_CREATED: 'notifications.connect.project.member.invite.created',
133133
PROJECT_MEMBER_INVITE_UPDATED: 'notifications.connect.project.member.invite.updated',
134-
PROJECT_MEMBER_EMAIL_INVITE_CREATED: 'connect.action.project.member.invite.created',
134+
PROJECT_MEMBER_EMAIL_INVITE_CREATED: 'connect.action.email.project.member.invite.created',
135135
};
136136

137137
export const REGEX = {

src/events/projects/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ const indexProject = Promise.coroutine(function* (logger, msg) { // eslint-disab
2828
// retrieve member details
2929
const memberDetails = yield util.getMemberDetailsByUserIds(userIds, msg.properties.correlationId, logger);
3030
// if no members are returned than this should result in nack
31-
if (!_.isArray(memberDetails) || memberDetails.length === 0) {
32-
logger.error(`Empty member details for userIds ${userIds.join(',')} requeing the message`);
33-
throw new Error(`Empty member details for userIds ${userIds.join(',')} requeing the message`);
34-
}
31+
// if (!_.isArray(memberDetails) || memberDetails.length === 0) {
32+
// logger.error(`Empty member details for userIds ${userIds.join(',')} requeing the message`);
33+
// throw new Error(`Empty member details for userIds ${userIds.join(',')} requeing the message`);
34+
// }
3535
// update project member record with details
3636
data.members = data.members.map((single) => {
3737
const detail = _.find(memberDetails, md => md.userId === single.userId);

src/models/productTemplate.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = (sequelize, DataTypes) => {
99
name: { type: DataTypes.STRING(255), allowNull: false },
1010
productKey: { type: DataTypes.STRING(45), allowNull: false },
1111
category: { type: DataTypes.STRING(45), allowNull: false },
12+
subCategory: { type: DataTypes.STRING(45), allowNull: false },
1213
icon: { type: DataTypes.STRING(255), allowNull: false },
1314
brief: { type: DataTypes.STRING(45), allowNull: false },
1415
details: { type: DataTypes.STRING(255), allowNull: false },

src/routes/metadata/list.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const productTemplates = [
3030
name: 'name 1',
3131
productKey: 'productKey 1',
3232
category: 'category',
33+
subCategory: 'category',
3334
icon: 'http://example.com/icon1.ico',
3435
brief: 'brief 1',
3536
details: 'details 1',

src/routes/milestoneTemplates/clone.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const productTemplates = [
1414
name: 'name 1',
1515
productKey: 'productKey 1',
1616
category: 'category',
17+
subCategory: 'category',
1718
icon: 'http://example.com/icon1.ico',
1819
brief: 'brief 1',
1920
details: 'details 1',
@@ -47,6 +48,7 @@ const productTemplates = [
4748
name: 'name 2',
4849
productKey: 'productKey 2',
4950
category: 'category',
51+
subCategory: 'category',
5052
icon: 'http://example.com/icon1.ico',
5153
brief: 'brief 2',
5254
details: 'details 2',

src/routes/milestoneTemplates/create.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const productTemplates = [
1515
name: 'name 1',
1616
productKey: 'productKey 1',
1717
category: 'category',
18+
subCategory: 'category',
1819
icon: 'http://example.com/icon1.ico',
1920
brief: 'brief 1',
2021
details: 'details 1',
@@ -48,6 +49,7 @@ const productTemplates = [
4849
name: 'template 2',
4950
productKey: 'productKey 2',
5051
category: 'category',
52+
subCategory: 'category',
5153
icon: 'http://example.com/icon2.ico',
5254
brief: 'brief 2',
5355
details: 'details 2',

src/routes/milestoneTemplates/delete.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const productTemplates = [
4040
name: 'name 1',
4141
productKey: 'productKey 1',
4242
category: 'category',
43+
subCategory: 'category',
4344
icon: 'http://example.com/icon1.ico',
4445
brief: 'brief 1',
4546
details: 'details 1',
@@ -73,6 +74,7 @@ const productTemplates = [
7374
name: 'template 2',
7475
productKey: 'productKey 2',
7576
category: 'category',
77+
subCategory: 'category',
7678
icon: 'http://example.com/icon2.ico',
7779
brief: 'brief 2',
7880
details: 'details 2',

src/routes/milestoneTemplates/get.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const productTemplates = [
1515
name: 'name 1',
1616
productKey: 'productKey 1',
1717
category: 'category',
18+
subCategory: 'category',
1819
icon: 'http://example.com/icon1.ico',
1920
brief: 'brief 1',
2021
details: 'details 1',
@@ -48,6 +49,7 @@ const productTemplates = [
4849
name: 'template 2',
4950
productKey: 'productKey 2',
5051
category: 'category',
52+
subCategory: 'category',
5153
icon: 'http://example.com/icon2.ico',
5254
brief: 'brief 2',
5355
details: 'details 2',

src/routes/milestoneTemplates/list.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const productTemplates = [
1515
name: 'name 1',
1616
productKey: 'productKey 1',
1717
category: 'category',
18+
subCategory: 'category',
1819
icon: 'http://example.com/icon1.ico',
1920
brief: 'brief 1',
2021
details: 'details 1',
@@ -48,6 +49,7 @@ const productTemplates = [
4849
name: 'template 2',
4950
productKey: 'productKey 2',
5051
category: 'category',
52+
subCategory: 'category',
5153
icon: 'http://example.com/icon2.ico',
5254
brief: 'brief 2',
5355
details: 'details 2',

src/routes/milestoneTemplates/update.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const productTemplates = [
1515
name: 'name 1',
1616
productKey: 'productKey 1',
1717
category: 'category',
18+
subCategory: 'category',
1819
icon: 'http://example.com/icon1.ico',
1920
brief: 'brief 1',
2021
details: 'details 1',
@@ -48,6 +49,7 @@ const productTemplates = [
4849
name: 'template 2',
4950
productKey: 'productKey 2',
5051
category: 'category',
52+
subCategory: 'category',
5153
icon: 'http://example.com/icon2.ico',
5254
brief: 'brief 2',
5355
details: 'details 2',

src/routes/phases/create.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ describe('Project Phases', () => {
9797
name: 'name 1',
9898
productKey: 'productKey 1',
9999
category: 'generic',
100+
subCategory: 'generic',
100101
icon: 'http://example.com/icon1.ico',
101102
brief: 'brief 1',
102103
details: 'details 1',

src/routes/productTemplates/create.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const schema = {
1616
param: Joi.object().keys({
1717
id: Joi.any().strip(),
1818
category: Joi.string().max(45).required(),
19+
subCategory: Joi.string().max(45).required(),
1920
name: Joi.string().max(255).required(),
2021
productKey: Joi.string().max(45).required(),
2122
icon: Joi.string().max(255).required(),

src/routes/productTemplates/create.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ describe('CREATE product template', () => {
3535
name: 'name 1',
3636
productKey: 'productKey 1',
3737
category: 'generic',
38+
subCategory: 'generic',
3839
icon: 'http://example.com/icon1.ico',
3940
brief: 'brief 1',
4041
details: 'details 1',

src/routes/productTemplates/delete.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe('DELETE product template', () => {
4343
name: 'name 1',
4444
productKey: 'productKey 1',
4545
category: 'generic',
46+
subCategory: 'generic',
4647
icon: 'http://example.com/icon1.ico',
4748
brief: 'brief 1',
4849
details: 'details 1',

src/routes/productTemplates/get.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe('GET product template', () => {
1515
name: 'name 1',
1616
productKey: 'productKey 1',
1717
category: 'generic',
18+
subCategory: 'generic',
1819
icon: 'http://example.com/icon1.ico',
1920
brief: 'brief 1',
2021
details: 'details 1',

src/routes/productTemplates/list.spec.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ import testUtil from '../../tests/util';
1414
const validateProductTemplates = (count, resJson, expectedTemplates) => {
1515
resJson.should.have.length(count);
1616
resJson.forEach((pt, idx) => {
17-
pt.should.have.all.keys('id', 'name', 'productKey', 'category', 'icon', 'brief', 'details', 'aliases',
18-
'template', 'disabled', 'hidden', 'createdBy', 'createdAt', 'updatedBy', 'updatedAt');
17+
pt.should.have.all.keys('id', 'name', 'productKey', 'category', 'subCategory', 'icon', 'brief', 'details',
18+
'aliases', 'template', 'disabled', 'hidden', 'createdBy', 'createdAt', 'updatedBy', 'updatedAt');
1919
pt.should.not.have.all.keys('deletedAt', 'deletedBy');
2020
pt.name.should.be.eql(expectedTemplates[idx].name);
2121
pt.productKey.should.be.eql(expectedTemplates[idx].productKey);
2222
pt.category.should.be.eql(expectedTemplates[idx].category);
23+
pt.subCategory.should.be.eql(expectedTemplates[idx].subCategory);
2324
pt.icon.should.be.eql(expectedTemplates[idx].icon);
2425
pt.brief.should.be.eql(expectedTemplates[idx].brief);
2526
pt.details.should.be.eql(expectedTemplates[idx].details);
@@ -38,6 +39,7 @@ describe('LIST product templates', () => {
3839
name: 'name 1',
3940
productKey: 'productKey-1',
4041
category: 'generic',
42+
subCategory: 'generic',
4143
icon: 'http://example.com/icon1.ico',
4244
brief: 'brief 1',
4345
details: 'details 1',
@@ -73,6 +75,7 @@ describe('LIST product templates', () => {
7375
name: 'template 2',
7476
productKey: 'productKey-2',
7577
category: 'concrete',
78+
subCategory: 'concrete',
7679
icon: 'http://example.com/icon2.ico',
7780
brief: 'brief 2',
7881
details: 'details 2',

src/routes/productTemplates/update.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ const schema = {
2121
name: Joi.string().max(255),
2222
productKey: Joi.string().max(45),
2323
category: Joi.string().max(45),
24+
subCategory: Joi.string().max(45),
2425
icon: Joi.string().max(255),
2526
brief: Joi.string().max(45),
2627
details: Joi.string().max(255),
27-
aliases: Joi.object(),
28+
aliases: Joi.array(),
2829
template: Joi.object(),
2930
disabled: Joi.boolean().optional(),
3031
hidden: Joi.boolean().optional(),

src/routes/productTemplates/update.spec.js

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,11 @@ describe('UPDATE product template', () => {
1515
name: 'name 1',
1616
productKey: 'productKey 1',
1717
category: 'generic',
18+
subCategory: 'generic',
1819
icon: 'http://example.com/icon1.ico',
1920
brief: 'brief 1',
2021
details: 'details 1',
21-
aliases: {
22-
alias1: {
23-
subAlias1A: 1,
24-
subAlias1B: 2,
25-
},
26-
alias2: [1, 2, 3],
27-
},
22+
aliases: ['productTemplate-1', 'productTemplate_1'],
2823
disabled: true,
2924
hidden: true,
3025
template: {
@@ -86,17 +81,11 @@ describe('UPDATE product template', () => {
8681
name: 'template 1 - update',
8782
productKey: 'productKey 1 - update',
8883
category: 'concrete',
84+
subCategory: 'concrete',
8985
icon: 'http://example.com/icon1-update.ico',
9086
brief: 'brief 1 - update',
9187
details: 'details 1 - update',
92-
aliases: {
93-
alias1: {
94-
subAlias1A: 11,
95-
subAlias1C: 'new',
96-
},
97-
alias2: [4],
98-
alias3: 'new',
99-
},
88+
aliases: ['productTemplate-1-update', 'productTemplate_1-update'],
10089
template: {
10190
template1: {
10291
name: 'template 1 - update',
@@ -213,16 +202,7 @@ describe('UPDATE product template', () => {
213202
resJson.details.should.be.eql(body.param.details);
214203
resJson.disabled.should.be.eql(true);
215204
resJson.hidden.should.be.eql(true);
216-
217-
resJson.aliases.should.be.eql({
218-
alias1: {
219-
subAlias1A: 11,
220-
subAlias1B: 2,
221-
subAlias1C: 'new',
222-
},
223-
alias2: [4],
224-
alias3: 'new',
225-
});
205+
resJson.aliases.should.be.eql(body.param.aliases);
226206
resJson.template.should.be.eql({
227207
template1: {
228208
name: 'template 1 - update',

src/routes/projectMemberInvites/create.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { middleware as tcMiddleware } from 'tc-core-library-js';
88
import models from '../../models';
99
import util from '../../util';
1010
import { PROJECT_MEMBER_ROLE, PROJECT_MEMBER_MANAGER_ROLES,
11-
MANAGER_ROLES, INVITE_STATUS, EVENT, PROJECT_MEMBER_EMAIL_INVITE_CREATED } from '../../constants';
11+
MANAGER_ROLES, INVITE_STATUS, EVENT, BUS_API_EVENT } from '../../constants';
1212
import { createEvent } from '../../services/busApi';
1313

1414

@@ -130,6 +130,7 @@ module.exports = [
130130
}
131131

132132
req.log.debug('Creating invites');
133+
const emailEventType = BUS_API_EVENT.PROJECT_MEMBER_EMAIL_INVITE_CREATED;
133134
return models.sequelize.Promise.all(invitePromises)
134135
.then((values) => {
135136
values.forEach((v) => {
@@ -151,7 +152,7 @@ module.exports = [
151152
raw: true,
152153
})
153154
.then((_project) => {
154-
createEvent(PROJECT_MEMBER_EMAIL_INVITE_CREATED,
155+
createEvent(emailEventType,
155156
{
156157
data: {
157158
connectURL: config.get('CONNECT_URL'),
@@ -175,7 +176,7 @@ module.exports = [
175176
name: config.get('EMAIL_INVITE_FROM_NAME'),
176177
email: config.get('EMAIL_INVITE_FROM_EMAIL'),
177178
},
178-
categories: [PROJECT_MEMBER_EMAIL_INVITE_CREATED],
179+
categories: [`${process.env.NODE_ENV}:${emailEventType}`.toLowerCase()],
179180
}, req.log);
180181
});
181182
}

src/routes/projectUpgrade/create.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ describe('Project upgrade', () => {
9595
name: 'name 1',
9696
productKey: 'a product key',
9797
category: 'category',
98+
subCategory: 'category',
9899
icon: 'http://example.com/icon1.ico',
99100
brief: 'brief 1',
100101
details: 'details 1',

src/routes/projects/create.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ describe('Project create', () => {
3838
name: 'template 1',
3939
productKey: 'productKey-1',
4040
category: 'generic',
41+
subCategory: 'generic',
4142
icon: 'http://example.com/icon2.ico',
4243
brief: 'brief 1',
4344
details: 'details 1',
@@ -51,6 +52,7 @@ describe('Project create', () => {
5152
name: 'template 2',
5253
productKey: 'productKey-2',
5354
category: 'generic',
55+
subCategory: 'generic',
5456
icon: 'http://example.com/icon2.ico',
5557
brief: 'brief 2',
5658
details: 'details 2',
@@ -64,6 +66,7 @@ describe('Project create', () => {
6466
name: 'template 3',
6567
productKey: 'productKey-3',
6668
category: 'generic',
69+
subCategory: 'generic',
6770
icon: 'http://example.com/icon3.ico',
6871
brief: 'brief 3',
6972
details: 'details 3',

src/routes/timelines/create.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const productTemplates = [
4545
name: 'name 1',
4646
productKey: 'productKey 1',
4747
category: 'generic',
48+
subCategory: 'generic',
4849
icon: 'http://example.com/icon1.ico',
4950
brief: 'brief 1',
5051
details: 'details 1',

0 commit comments

Comments
 (0)