Skip to content

Commit 0315bcc

Browse files
author
vikasrohit
authored
Merge pull request #619 from topcoder-platform/develop
Beta Release 3.3.0
2 parents e27ed47 + 6a966b6 commit 0315bcc

File tree

9 files changed

+41
-13
lines changed

9 files changed

+41
-13
lines changed

docs/swagger.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4939,8 +4939,11 @@ definitions:
49394939
terms:
49404940
type: array
49414941
items:
4942-
type: number
4943-
format: integer
4942+
type: string
4943+
groups:
4944+
type: array
4945+
items:
4946+
type: string
49444947
external:
49454948
type: object
49464949
description: 'READ-ONLY, OPTIONAL. Refernce to external task/issue.'
@@ -5070,8 +5073,11 @@ definitions:
50705073
terms:
50715074
type: array
50725075
items:
5073-
type: number
5074-
format: integer
5076+
type: string
5077+
groups:
5078+
type: array
5079+
items:
5080+
type: string
50755081
name:
50765082
type: string
50775083
description: project name
@@ -5254,7 +5260,7 @@ definitions:
52545260
type:
52555261
type: string
52565262
description: The attachment type, one of 'link' or 'file'
5257-
enum:
5263+
enum:
52585264
- link
52595265
- file
52605266
tags:
@@ -6133,7 +6139,7 @@ definitions:
61336139
type: array
61346140
items:
61356141
$ref: '#/definitions/Milestone'
6136-
6142+
61376143
MilestoneTemplateRequest:
61386144
title: Milestone template request object
61396145
type: object
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- UPDATE EXISTING projects table
2+
-- modify column `terms`
3+
4+
-- drop existent column first to avoid any issues during type convertion as we don't need the data if there is any
5+
ALTER TABLE projects DROP COLUMN "terms";
6+
-- now create a column with a new type
7+
ALTER TABLE projects ADD COLUMN "terms" character varying(255)[] NOT NULL DEFAULT ARRAY[]::character varying[]::character varying(255)[];
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- UPDATE EXISTING projects table
2+
-- add column `groups`
3+
4+
ALTER TABLE projects ADD COLUMN "groups" character varying(255)[] NOT NULL DEFAULT ARRAY[]::character varying[]::character varying(255)[];

src/events/projects/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ const projectPayloadSchema = Joi.object().keys({
102102
id: Joi.number().integer().positive().required(),
103103
createdAt: Joi.date().required(),
104104
updatedAt: Joi.date().required(),
105-
terms: Joi.array().items(Joi.number().positive()).optional(),
105+
terms: Joi.array().items(Joi.string()).optional(),
106+
groups: Joi.array().items(Joi.string()).optional(),
106107
name: Joi.string().required(),
107108
description: Joi.string().allow(null).allow('').optional(),
108109
type: Joi.string().max(45).required(),

src/models/project.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ module.exports = function defineProject(sequelize, DataTypes) {
1616
estimatedPrice: { type: DataTypes.DECIMAL(10, 2), allowNull: true },
1717
actualPrice: { type: DataTypes.DECIMAL(10, 2), allowNull: true },
1818
terms: {
19-
type: DataTypes.ARRAY(DataTypes.INTEGER),
19+
type: DataTypes.ARRAY(DataTypes.STRING),
20+
allowNull: false,
21+
defaultValue: [],
22+
},
23+
groups: {
24+
type: DataTypes.ARRAY(DataTypes.STRING),
2025
allowNull: false,
2126
defaultValue: [],
2227
},

src/routes/projects/create.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ const createProjectValidations = {
4545
})).optional().allow(null),
4646
estimatedPrice: Joi.number().precision(2).positive().optional()
4747
.allow(null),
48-
terms: Joi.array().items(Joi.number().positive()).optional(),
48+
terms: Joi.array().items(Joi.string()).optional(),
49+
groups: Joi.array().items(Joi.string()).optional(),
4950
external: Joi.object().keys({
5051
id: Joi.string(),
5152
type: Joi.any().valid('github', 'jira', 'asana', 'other'),

src/routes/projects/update.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ const updateProjectValdiations = {
4646
status: Joi.any().valid(_.values(PROJECT_STATUS)),
4747
estimatedPrice: Joi.number().precision(2).positive().allow(null),
4848
actualPrice: Joi.number().precision(2).positive(),
49-
terms: Joi.array().items(Joi.number().positive()),
49+
terms: Joi.array().items(Joi.string()),
50+
groups: Joi.array().items(Joi.string()),
5051
external: Joi.object().keys({
5152
id: Joi.string(),
5253
type: Joi.any().valid('github', 'jira', 'asana', 'other'),

src/routes/projects/update.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ describe('Project', () => {
983983
Authorization: `Bearer ${testUtil.jwts.admin}`,
984984
})
985985
.send({
986-
terms: [1, 2, 3],
986+
terms: ['1', '2', '3'],
987987
})
988988
.expect(200)
989989
.end((err) => {
@@ -996,7 +996,7 @@ describe('Project', () => {
996996
createEventSpy.calledWith(BUS_API_EVENT.PROJECT_UPDATED, sinon.match({
997997
resource: 'project',
998998
id: project1.id,
999-
terms: [1, 2, 3],
999+
terms: ['1', '2', '3'],
10001000
updatedBy: testUtil.userIds.admin,
10011001
})).should.be.true;
10021002

src/utils/es-config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ MAPPINGS[ES_PROJECT_INDEX] = {
320320
index: 'not_analyzed',
321321
},
322322
terms: {
323-
type: 'integer',
323+
type: 'string',
324+
},
325+
groups: {
326+
type: 'string',
324327
},
325328
type: {
326329
type: 'string',

0 commit comments

Comments
 (0)