Skip to content

Commit 88bf110

Browse files
author
Maksym Mykhailenko
committed
Merge branch 'develop' into feature/bulk-milestone-updates
# Conflicts: # package-lock.json
2 parents d421204 + bff50fe commit 88bf110

12 files changed

+840
-835
lines changed

config/default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = {
2929
esConfig: {
3030
HOST: process.env.ES_HOST || 'localhost:9200',
3131
AWS_REGION: process.env.AWS_REGION || 'us-east-1', // AWS Region to be used if we use AWS ES
32-
API_VERSION: process.env.ES_API_VERSION || '6.7',
32+
API_VERSION: process.env.ES_API_VERSION || '6.8',
3333
ES_PROJECT_INDEX: process.env.ES_PROJECT_INDEX || 'projects',
3434
ES_TIMELINE_INDEX: process.env.ES_TIMELINE_INDEX || 'timelines',
3535
ES_METADATA_INDEX: process.env.ES_METADATA_INDEX || 'metadata',

migrations/elasticsearch_sync.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ function getRequestBody (indexName) {
5656
description: {
5757
type: 'string'
5858
},
59-
filePath: {
59+
path: {
60+
type: 'string'
61+
},
62+
type: {
63+
type: 'string'
64+
},
65+
tags: {
6066
type: 'string'
6167
},
6268
id: {

package-lock.json

Lines changed: 810 additions & 822 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common/helper.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ async function getMemberDetailsByUserIds (userIds) {
159159
'Content-Type': 'application/json',
160160
Authorization: `Bearer ${token}`
161161
}
162-
}).then(res => _.get(res, 'data.result.content', null))
162+
}).then((res) => {
163+
return _.get(res, 'data.result.content', null)
164+
})
163165
} catch (err) {
164166
return Promise.reject(err)
165167
}

src/constants.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,18 @@ const MILESTONE_TEMPLATE_REFERENCES = {
6767
PRODUCT_TEMPLATE: 'productTemplate'
6868
}
6969

70+
const ATTACHMENT_TYPES = {
71+
'FILE': 'file',
72+
'LINK': 'link'
73+
}
74+
7075
module.exports = {
7176
RESOURCES,
7277
REGEX,
7378
PROJECT_STATUS,
7479
TIMELINE_REFERENCES,
7580
INVITE_STATUS,
7681
PROJECT_MEMBER_ROLE,
77-
MILESTONE_TEMPLATE_REFERENCES
82+
MILESTONE_TEMPLATE_REFERENCES,
83+
ATTACHMENT_TYPES
7884
}

src/services/ProcessorServiceAttachment.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const _ = require('lodash')
77

88
const logger = require('../common/logger')
99
const helper = require('../common/helper')
10+
const constants = require('../constants')
1011

1112
/**
1213
* create id schema
@@ -27,7 +28,8 @@ function updateSchema () {
2728
return createIdSchema().keys({
2829
title: Joi.string().required(),
2930
description: Joi.string().optional().allow(null).allow(''),
30-
allowedUsers: Joi.array().items(Joi.number().integer().positive()).allow(null).default(null)
31+
allowedUsers: Joi.array().items(Joi.number().integer().positive()).allow(null).default(null),
32+
tags: Joi.array().items(Joi.string()).optional().allow(null)
3133
})
3234
}
3335

@@ -39,8 +41,10 @@ function createSchema () {
3941
return updateSchema().keys({
4042
category: Joi.string().optional().allow(null).allow(''),
4143
size: Joi.number().optional().allow(null),
42-
contentType: Joi.string().required(),
43-
filePath: Joi.string().required()
44+
contentType: Joi.string().optional().allow(null).when('type', { is: constants.ATTACHMENT_TYPES.FILE, then: Joi.string().required() }),
45+
path: Joi.string().required(),
46+
type: Joi.string().valid(_.values(constants.ATTACHMENT_TYPES)),
47+
tags: Joi.array().items(Joi.string()).optional().allow(null)
4448
})
4549
}
4650

src/services/ProcessorServiceProjectMemberInvite.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ function createSchema () {
2222
.email()
2323
.optional()
2424
.allow(null),
25-
hashEmail: Joi.string().optional().allow(null),
2625
status: Joi.any()
2726
.valid(_.values(INVITE_STATUS))
2827
.required()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"topic":"project.action.create","originator":"project-api","timestamp":"2019-06-21T04:41:17.702Z","mime-type":"application/json","payload":{"resource":"attachment","createdAt":"2019-06-21T04:41:17.637Z","updatedAt":"2019-06-21T04:41:17.637Z","id":1,"projectId":1,"allowedUsers":null,"createdBy":40051333,"updatedBy":40051333,"title":"first attachment submission","size":null,"category":null,"description":null,"contentType":"application/png","deletedBy":null,"filePath":"projects/1/projects/asdasd.png"}}
1+
{"topic":"project.action.create","originator":"project-api","timestamp":"2019-06-21T04:41:17.702Z","mime-type":"application/json","payload":{"resource":"attachment","createdAt":"2019-06-21T04:41:17.637Z","updatedAt":"2019-06-21T04:41:17.637Z","id":1,"projectId":1,"allowedUsers":null,"createdBy":40051333,"updatedBy":40051333,"title":"first attachment submission","size":null,"category":null,"description":null,"contentType":"application/png","deletedBy":null,"path":"projects/1/projects/asdasd.png","type":"file","tags":["specification","design preview"]}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"topic":"project.action.update","originator":"project-api","timestamp":"2019-06-21T04:41:46.501Z","mime-type":"application/json","payload":{"resource":"attachment","title":"first attachment submission updated","description":"updated project attachment","allowedUsers":null,"updatedBy":40051333,"id":1,"projectId":1}}
1+
{"topic":"project.action.update","originator":"project-api","timestamp":"2019-06-21T04:41:46.501Z","mime-type":"application/json","payload":{"resource":"attachment","title":"first attachment submission updated","description":"updated project attachment","allowedUsers":null,"updatedBy":40051333,"id":1,"projectId":1,"tags":["specification","design preview","billing information"]}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"topic":"project.action.create","originator":"project-api","timestamp":"2019-06-21T04:58:12.671Z","mime-type":"application/json","payload":{"resource":"project.member.invite","createdAt":"2019-06-21T04:58:12.594Z","updatedAt":"2019-06-21T04:58:12.594Z","id":1,"projectId":1,"role":"customer","status":"pending","createdBy":40051334,"updatedBy":40051334,"userId":40051331,"email":"test@topcoder.com","hashEmail":"dummy_value","deletedAt":null,"deletedBy":null}}
1+
{"topic":"project.action.create","originator":"project-api","timestamp":"2019-06-21T04:58:12.671Z","mime-type":"application/json","payload":{"resource":"project.member.invite","createdAt":"2019-06-21T04:58:12.594Z","updatedAt":"2019-06-21T04:58:12.594Z","id":1,"projectId":1,"role":"customer","status":"pending","createdBy":40051334,"updatedBy":40051334,"userId":40051331,"email":"test@topcoder.com","deletedAt":null,"deletedBy":null}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"topic":"project.action.update","originator":"project-api","timestamp":"2019-06-21T04:59:38.562Z","mime-type":"application/json","payload":{"resource":"project.member.invite","status":"canceled","userId":40051331,"email":"test@topcoder.com","hashEmail":"dummy_value","id":1,"projectId":1}}
1+
{"topic":"project.action.update","originator":"project-api","timestamp":"2019-06-21T04:59:38.562Z","mime-type":"application/json","payload":{"resource":"project.member.invite","status":"canceled","userId":40051331,"email":"test@topcoder.com","id":1,"projectId":1}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"topic":"project.action.update","originator":"project-api","timestamp":"2019-06-21T04:59:38.562Z","mime-type":"application/json","payload":{"resource":"project.member.invite","status":"pending","userId":40051331,"email":"test@topcoder.com","hashEmail":"dummy_value","id":1,"projectId":1}}
1+
{"topic":"project.action.update","originator":"project-api","timestamp":"2019-06-21T04:59:38.562Z","mime-type":"application/json","payload":{"resource":"project.member.invite","status":"pending","userId":40051331,"email":"test@topcoder.com","id":1,"projectId":1}}

0 commit comments

Comments
 (0)