Skip to content

Commit af2bf9e

Browse files
Merge pull request #1 from topcoder-platform/dev
latest
2 parents 5a9cd64 + a563a50 commit af2bf9e

File tree

178 files changed

+22877
-4347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+22877
-4347
lines changed

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
- POSTGRES_USER: circle_test
4949
- POSTGRES_DB: circle_test
5050
- image: elasticsearch:2.3
51+
- image: rabbitmq:3-management
5152
environment:
5253
DB_MASTER_URL: postgres://circle_test:@127.0.0.1:5432/circle_test
5354
AUTH_SECRET: secret
@@ -96,7 +97,7 @@ workflows:
9697
- test
9798
filters:
9899
branches:
99-
only: ['dev', 'dev-sts']
100+
only: ['dev', 'dev-sts', 'feature/looker-api-integration']
100101
- deployProd:
101102
context : org-global
102103
requires:

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"mocha": true
99
},
1010
"rules": {
11-
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js", "**/*.spec.js", "**/serviceMocks.js"]}],
11+
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js", "**/*.spec.js", "src/tests/*.js"]}],
1212
"max-len": ["error", { "ignoreComments": true, "code": 120 }],
1313
"valid-jsdoc": ["error", {
1414
"requireReturn": true,

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v6.9.4
1+
v8.2.1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Microservice to manage CRUD operations for all things Projects.
99
### Requirements
1010

1111
* [docker-compose](https://docs.docker.com/compose/install/) - We use docker-compose for running dependencies locally.
12-
* Nodejs 8.9.4 - consider using [nvm](https://github.com/creationix/nvm) or equivalent to manage your node version
12+
* Nodejs 8.2.1 - consider using [nvm](https://github.com/creationix/nvm) or equivalent to manage your node version
1313
* Install [libpg](https://www.npmjs.com/package/pg-native)
1414

1515
### Steps to run locally

config/custom-environment-variables.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
"fileServiceEndpoint": "FILE_SERVICE_ENDPOINT",
2323
"identityServiceEndpoint": "IDENTITY_SERVICE_ENDPOINT",
2424
"memberServiceEndpoint": "MEMBER_SERVICE_ENDPOINT",
25-
"systemUserClientId": "SYSTEM_USER_CLIENT_ID",
26-
"systemUserClientSecret": "SYSTEM_USER_CLIENT_SECRET",
2725
"connectProjectsUrl": "CONNECT_PROJECTS_URL",
2826
"dbConfig": {
2927
"masterUrl": "DB_MASTER_URL",
@@ -51,5 +49,18 @@
5149
"connectUrl": "CONNECT_URL",
5250
"accountsAppUrl": "ACCOUNTS_APP_URL",
5351
"inviteEmailSubject": "INVITE_EMAIL_SUBJECT",
54-
"inviteEmailSectionTitle": "INVITE_EMAIL_SECTION_TITLE"
52+
"inviteEmailSectionTitle": "INVITE_EMAIL_SECTION_TITLE",
53+
"SSO_REFCODES": "SSO_REFCODES",
54+
"lookerConfig": {
55+
"BASE_URL": "LOOKER_API_BASE_URL",
56+
"CLIENT_ID": "LOOKER_API_CLIENT_ID",
57+
"CLIENT_SECRET": "LOOKER_API_CLIENT_SECRET",
58+
"TOKEN": "TOKEN",
59+
"USE_MOCK": "LOOKER_API_ENABLE_MOCK",
60+
"QUERIES": {
61+
"REG_STATS": "LOOKER_API_REG_STATS_QUERY_ID",
62+
"BUDGET": "LOOKER_API_BUDGET_QUERY_ID"
63+
}
64+
},
65+
"DEFAULT_M2M_USERID": "DEFAULT_M2M_USERID"
5566
}

config/default.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
"timelineIndexName": "timelines",
2626
"timelineDocType": "timelineV4"
2727
},
28-
"systemUserClientId": "",
29-
"systemUserClientSecret": "",
3028
"connectProjectUrl":"",
3129
"dbConfig": {
3230
"masterUrl": "",
@@ -60,5 +58,19 @@
6058
"connectUrl":"https://connect.topcoder-dev.com",
6159
"accountsAppUrl": "https://accounts.topcoder-dev.com",
6260
"MAX_REVISION_NUMBER": 100,
63-
"UNIQUE_GMAIL_VALIDATION": true
61+
"UNIQUE_GMAIL_VALIDATION": false,
62+
"SSO_REFCODES": "[]",
63+
"VALID_STATUSES_BEFORE_PAUSED": "[\"active\"]",
64+
"lookerConfig": {
65+
"BASE_URL": "",
66+
"CLIENT_ID": "",
67+
"CLIENT_SECRET": "",
68+
"TOKEN": "TOKEN",
69+
"USE_MOCK": "true",
70+
"QUERIES": {
71+
"REG_STATS": 1234,
72+
"BUDGET": 123
73+
}
74+
},
75+
"DEFAULT_M2M_USERID": -101
6476
}

local/seed/seedMetadata.js

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,45 @@ module.exports = (targetUrl, token) => {
3737
'Authorization': 'Bearer ' + token
3838
}
3939

40-
let promises = _(data.result.content.projectTypes).map(pt=>{
40+
let promises
41+
42+
promises = _(data.result.content.forms).orderBy(['key', 'asc'], ['version', 'asc']).map(pt=>{
43+
const param = _.omit(pt, ['id', 'version', 'revision', 'key']);
44+
return axios
45+
.post(destUrl + `metadata/form/${pt.key}/versions`,{param}, {headers:headers})
46+
.catch((err) => {
47+
const errMessage = _.get(err, 'response.data.result.content.message', '');
48+
console.log(`Failed to create form with key=${pt.key} version=${pt.version}.`, errMessage)
49+
})
50+
});
51+
52+
await Promise.all(promises);
53+
54+
promises = _(data.result.content.planConfigs).orderBy(['key', 'asc'], ['version', 'asc']).map(pt=>{
55+
const param = _.omit(pt, ['id', 'version', 'revision', 'key']);
56+
return axios
57+
.post(destUrl + `metadata/planConfig/${pt.key}/versions`,{param}, {headers:headers})
58+
.catch((err) => {
59+
const errMessage = _.get(err, 'response.data.result.content.message', '');
60+
console.log(`Failed to create planConfig with key=${pt.key} version=${pt.version}.`, errMessage)
61+
})
62+
});
63+
64+
await Promise.all(promises);
65+
66+
promises = _(data.result.content.priceConfigs).orderBy(['key', 'asc'], ['version', 'asc']).map(pt=>{
67+
const param = _.omit(pt, ['id', 'version', 'revision', 'key']);
68+
return axios
69+
.post(destUrl + `metadata/priceConfig/${pt.key}/versions`,{param}, {headers:headers})
70+
.catch((err) => {
71+
const errMessage = _.get(err, 'response.data.result.content.message', '');
72+
console.log(`Failed to create priceConfig with key=${pt.key} version=${pt.version}.`, errMessage)
73+
})
74+
});
75+
76+
await Promise.all(promises);
77+
78+
promises = _(data.result.content.projectTypes).map(pt=>{
4179
return axios
4280
.post(destUrl+'metadata/projectTypes',{param:pt}, {headers:headers})
4381
.catch((err) => {

local/seed/seedProjects.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import util from '../../src/tests/util';
2+
import models from '../../src/models';
23

34
const axios = require('axios');
45
const Promise = require('bluebird');
@@ -54,6 +55,21 @@ module.exports = (targetUrl, token) => {
5455
});
5556
}
5657

58+
await models.ProjectEstimation.create({
59+
projectId,
60+
buildingBlockKey: 'BLOCK_KEY',
61+
conditions: '( HAS_DEV_DELIVERABLE && ONLY_ONE_OS_MOBILE && CA_NEEDED )',
62+
price: 6500.50,
63+
quantity: 10,
64+
minTime: 35,
65+
maxTime: 35,
66+
metadata: {
67+
deliverable: 'dev-qa',
68+
},
69+
createdBy: 1,
70+
updatedBy: 1,
71+
});
72+
5773
// creating invitations
5874
if (Array.isArray(invites)) {
5975
let promises = []
@@ -134,4 +150,3 @@ function updateProjectMemberInvite(projectId, params, targetUrl, headers) {
134150
console.log(`Failed to update project member invites ${projectId}: ${err.message}`);
135151
})
136152
}
137-
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--
2+
-- Create table status history
3+
--
4+
5+
CREATE TABLE status_history (
6+
id bigint,
7+
"reference" character varying(45) NOT NULL,
8+
"referenceId" bigint NOT NULL,
9+
"status" character varying(45) NOT NULL,
10+
"comment" text,
11+
"createdAt" timestamp with time zone,
12+
"updatedAt" timestamp with time zone,
13+
"createdBy" integer NOT NULL,
14+
"updatedBy" integer NOT NULL
15+
);
16+
17+
CREATE SEQUENCE status_history_id_seq
18+
START WITH 1
19+
INCREMENT BY 1
20+
NO MINVALUE
21+
NO MAXVALUE
22+
CACHE 1;
23+
24+
ALTER SEQUENCE status_history_id_seq OWNED BY status_history.id;
25+
26+
ALTER TABLE ONLY status_history ALTER COLUMN id SET DEFAULT nextval('status_history_id_seq'::regclass);
27+
28+
ALTER TABLE ONLY status_history
29+
ADD CONSTRAINT status_history_pkey PRIMARY KEY (id);
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
--
2+
-- CREATE NEW TABLE:
3+
-- project_estimations
4+
--
5+
6+
CREATE TABLE project_estimations
7+
(
8+
id bigint NOT NULL,
9+
"buildingBlockKey" character varying(255) NOT NULL,
10+
conditions character varying(512) NOT NULL,
11+
price double precision NOT NULL,
12+
"minTime" integer NOT NULL,
13+
"maxTime" integer NOT NULL,
14+
metadata json NOT NULL DEFAULT '{}'::json,
15+
"projectId" bigint NOT NULL,
16+
"deletedAt" timestamp with time zone,
17+
"createdAt" timestamp with time zone,
18+
"updatedAt" timestamp with time zone,
19+
"deletedBy" bigint,
20+
"createdBy" integer NOT NULL,
21+
"updatedBy" integer NOT NULL,
22+
CONSTRAINT project_estimations_pkey PRIMARY KEY (id)
23+
);
24+
25+
CREATE SEQUENCE project_estimations_id_seq
26+
START WITH 1
27+
INCREMENT BY 1
28+
NO MINVALUE
29+
NO MAXVALUE
30+
CACHE 1;
31+
32+
ALTER SEQUENCE project_estimations_id_seq OWNED BY project_estimations.id;
33+
34+
ALTER TABLE project_estimations
35+
ALTER COLUMN id SET DEFAULT nextval('project_estimations_id_seq');
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--
2+
-- UPDATE EXISTING TABLES:
3+
-- project_estimations:
4+
-- added column `quantity`
5+
6+
--
7+
-- product_templates
8+
9+
-- Add new column
10+
ALTER TABLE project_estimations ADD COLUMN "quantity" int DEFAULT 1;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--
2+
-- FIX for 20190316_extract_scope_from_project_templates.sql
3+
-- apply created auto-increments sequences to `id` columns
4+
5+
ALTER TABLE form
6+
ALTER COLUMN id SET DEFAULT nextval('form_id_seq');
7+
8+
ALTER TABLE price_config
9+
ALTER COLUMN id SET DEFAULT nextval('price_config_id_seq');
10+
11+
ALTER TABLE plan_config
12+
ALTER COLUMN id SET DEFAULT nextval('plan_config_id_seq');
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--
2+
-- UPDATE EXISTING TABLES:
3+
-- template:
4+
-- remove `sections` if exists and change `questions` to `sections`
5+
6+
--
7+
-- product_templates
8+
9+
UPDATE product_templates
10+
SET template = (template::jsonb #- '{questions}' #- '{sections}') || jsonb_build_object('sections', template::jsonb ->'questions')
11+
WHERE template::jsonb ? 'questions';

migrations/20190624_workStream.sql

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
--
2+
-- CREATE NEW TABLE:
3+
-- work_streams
4+
--
5+
CREATE TABLE work_streams (
6+
id bigint NOT NULL,
7+
"name" character varying(255) NOT NULL,
8+
"type" character varying(45) NOT NULL,
9+
"status" character varying(255) NOT NULL,
10+
"projectId" bigint NOT NULL,
11+
"deletedAt" timestamp with time zone,
12+
"createdAt" timestamp with time zone,
13+
"updatedAt" timestamp with time zone,
14+
"deletedBy" bigint,
15+
"createdBy" bigint NOT NULL,
16+
"updatedBy" bigint NOT NULL
17+
);
18+
19+
CREATE SEQUENCE work_streams_id_seq
20+
START WITH 1
21+
INCREMENT BY 1
22+
NO MINVALUE
23+
NO MAXVALUE
24+
CACHE 1;
25+
26+
ALTER SEQUENCE work_streams_id_seq OWNED BY work_streams.id;
27+
28+
ALTER TABLE work_streams
29+
ALTER COLUMN id SET DEFAULT nextval('work_streams_id_seq');
30+
31+
ALTER TABLE ONLY work_streams
32+
ADD CONSTRAINT "work_streams_pkey" PRIMARY KEY (id);
33+
34+
ALTER TABLE ONLY work_streams
35+
ADD CONSTRAINT "work_streams_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES projects(id) ON UPDATE CASCADE ON DELETE SET NULL;
36+
37+
--
38+
-- CREATE NEW TABLE:
39+
-- work_management_permissions
40+
--
41+
CREATE TABLE work_management_permissions (
42+
id bigint NOT NULL,
43+
"policy" character varying(255) NOT NULL,
44+
"permission" json NOT NULL,
45+
"projectTemplateId" bigint NOT NULL,
46+
"deletedAt" timestamp with time zone,
47+
"createdAt" timestamp with time zone,
48+
"updatedAt" timestamp with time zone,
49+
"deletedBy" bigint,
50+
"createdBy" bigint NOT NULL,
51+
"updatedBy" bigint NOT NULL
52+
);
53+
54+
CREATE SEQUENCE work_management_permissions_id_seq
55+
START WITH 1
56+
INCREMENT BY 1
57+
NO MINVALUE
58+
NO MAXVALUE
59+
CACHE 1;
60+
61+
ALTER SEQUENCE work_management_permissions_id_seq OWNED BY work_management_permissions.id;
62+
63+
ALTER TABLE work_management_permissions
64+
ALTER COLUMN id SET DEFAULT nextval('work_management_permissions_id_seq');
65+
66+
--
67+
-- CREATE NEW TABLE:
68+
-- phase_work_streams
69+
--
70+
CREATE TABLE phase_work_streams (
71+
"workStreamId" bigint NOT NULL,
72+
"phaseId" bigint NOT NULL
73+
);
74+
75+
ALTER TABLE ONLY phase_work_streams
76+
ADD CONSTRAINT "phase_work_streams_pkey" PRIMARY KEY ("workStreamId", "phaseId");
77+
78+
ALTER TABLE ONLY phase_work_streams
79+
ADD CONSTRAINT "phase_work_streams_phaseId_fkey" FOREIGN KEY ("phaseId") REFERENCES project_phases(id) ON UPDATE CASCADE ON DELETE CASCADE;
80+
81+
ALTER TABLE ONLY phase_work_streams
82+
ADD CONSTRAINT "phase_work_streams_workStreamId_fkey" FOREIGN KEY ("workStreamId") REFERENCES work_streams(id) ON UPDATE CASCADE ON DELETE CASCADE;

0 commit comments

Comments
 (0)