Skip to content

Commit 36ec430

Browse files
authored
Merge pull request #389 from gets0ul/merge_dev_to_v5
Merge changes from 'dev' branch
2 parents 080c4c4 + 8fb8b2f commit 36ec430

File tree

175 files changed

+13987
-675
lines changed

Some content is hidden

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

175 files changed

+13987
-675
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,

config/custom-environment-variables.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,17 @@
5252
"accountsAppUrl": "ACCOUNTS_APP_URL",
5353
"inviteEmailSubject": "INVITE_EMAIL_SUBJECT",
5454
"inviteEmailSectionTitle": "INVITE_EMAIL_SECTION_TITLE",
55-
"pageSize": "PAGE_SIZE"
55+
"pageSize": "PAGE_SIZE",
56+
"SSO_REFCODES": "SSO_REFCODES",
57+
"lookerConfig": {
58+
"BASE_URL": "LOOKER_API_BASE_URL",
59+
"CLIENT_ID": "LOOKER_API_CLIENT_ID",
60+
"CLIENT_SECRET": "LOOKER_API_CLIENT_SECRET",
61+
"TOKEN": "TOKEN",
62+
"USE_MOCK": "LOOKER_API_ENABLE_MOCK",
63+
"QUERIES": {
64+
"REG_STATS": "LOOKER_API_REG_STATS_QUERY_ID",
65+
"BUDGET": "LOOKER_API_BUDGET_QUERY_ID"
66+
}
67+
}
5668
}

config/default.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,18 @@
5656
"accountsAppUrl": "https://accounts.topcoder-dev.com",
5757
"MAX_REVISION_NUMBER": 100,
5858
"UNIQUE_GMAIL_VALIDATION": false,
59-
"pageSize": 20
59+
"pageSize": 20,
60+
"VALID_STATUSES_BEFORE_PAUSED": "[\"active\"]",
61+
"SSO_REFCODES": "[]",
62+
"lookerConfig": {
63+
"BASE_URL": "",
64+
"CLIENT_ID": "",
65+
"CLIENT_SECRET": "",
66+
"TOKEN": "TOKEN",
67+
"USE_MOCK": "true",
68+
"QUERIES": {
69+
"REG_STATS": 1234,
70+
"BUDGET": 123
71+
}
72+
}
6073
}

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.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.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.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', pt, {headers:headers})
4381
.catch((err) => {

local/seed/seedProjects.js

Lines changed: 16 additions & 0 deletions
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');
@@ -60,6 +61,21 @@ module.exports = (targetUrl, token) => {
6061
});
6162
}
6263

64+
await models.ProjectEstimation.create({
65+
projectId,
66+
buildingBlockKey: 'BLOCK_KEY',
67+
conditions: '( HAS_DEV_DELIVERABLE && ONLY_ONE_OS_MOBILE && CA_NEEDED )',
68+
price: 6500.50,
69+
quantity: 10,
70+
minTime: 35,
71+
maxTime: 35,
72+
metadata: {
73+
deliverable: 'dev-qa',
74+
},
75+
createdBy: 1,
76+
updatedBy: 1,
77+
});
78+
6379
// creating invitations
6480
if (Array.isArray(invites)) {
6581
let promises = []
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: 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;
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
-- CREATE NEW TABLES:
2+
-- project_settings
3+
-- project_estimation_items
4+
--
5+
6+
--
7+
-- project_settings
8+
--
9+
10+
CREATE TABLE project_settings (
11+
id bigint NOT NULL,
12+
key character varying(255),
13+
value character varying(255),
14+
"valueType" character varying(255),
15+
"projectId" bigint NOT NULL,
16+
metadata json NOT NULL DEFAULT '{}'::json,
17+
"readPermission" json NOT NULL DEFAULT '{}'::json,
18+
"writePermission" json NOT NULL DEFAULT '{}'::json,
19+
"deletedAt" timestamp with time zone,
20+
"createdAt" timestamp with time zone,
21+
"updatedAt" timestamp with time zone,
22+
"deletedBy" bigint,
23+
"createdBy" bigint NOT NULL,
24+
"updatedBy" bigint NOT NULL,
25+
CONSTRAINT project_settings_pkey PRIMARY KEY (id)
26+
);
27+
28+
CREATE SEQUENCE project_settings_id_seq
29+
START WITH 1
30+
INCREMENT BY 1
31+
NO MINVALUE
32+
NO MAXVALUE
33+
CACHE 1;
34+
35+
ALTER SEQUENCE project_settings_id_seq OWNED BY project_settings.id;
36+
37+
ALTER TABLE project_settings
38+
ALTER COLUMN id SET DEFAULT nextval('project_settings_id_seq');
39+
40+
ALTER TABLE project_settings
41+
ADD CONSTRAINT project_settings_key_project_id UNIQUE (key, "projectId");
42+
43+
--
44+
-- project_estimation_items
45+
--
46+
47+
CREATE TABLE project_estimation_items (
48+
id bigint NOT NULL,
49+
"projectEstimationId" bigint NOT NULL,
50+
price double precision NOT NULL,
51+
type character varying(255) NOT NULL,
52+
"markupUsedReference" character varying(255) NOT NULL,
53+
"markupUsedReferenceId" bigint NOT NULL,
54+
metadata json NOT NULL DEFAULT '{}'::json,
55+
"deletedAt" timestamp with time zone,
56+
"createdAt" timestamp with time zone,
57+
"updatedAt" timestamp with time zone,
58+
"deletedBy" bigint,
59+
"createdBy" bigint NOT NULL,
60+
"updatedBy" bigint NOT NULL,
61+
CONSTRAINT project_estimation_items_pkey PRIMARY KEY (id)
62+
);
63+
64+
CREATE SEQUENCE project_estimation_items_id_seq
65+
START WITH 1
66+
INCREMENT BY 1
67+
NO MINVALUE
68+
NO MAXVALUE
69+
CACHE 1;
70+
71+
ALTER SEQUENCE project_estimation_items_id_seq OWNED BY form.id;
72+
73+
ALTER TABLE project_estimation_items
74+
ALTER COLUMN id SET DEFAULT nextval('project_estimation_items_id_seq');
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
--
2+
-- CREATE NEW TABLE:
3+
-- building_blocks
4+
--
5+
CREATE TABLE building_blocks (
6+
id bigint NOT NULL,
7+
"key" character varying(255) NOT NULL,
8+
"config" json NOT NULL DEFAULT '{}'::json,
9+
"privateConfig" json NOT NULL DEFAULT '{}'::json,
10+
"deletedAt" timestamp with time zone,
11+
"createdAt" timestamp with time zone,
12+
"updatedAt" timestamp with time zone,
13+
"deletedBy" bigint,
14+
"createdBy" bigint NOT NULL,
15+
"updatedBy" bigint NOT NULL
16+
);
17+
18+
ALTER TABLE building_blocks
19+
ADD CONSTRAINT building_blocks_key_uniq UNIQUE (key);
20+
21+
CREATE SEQUENCE building_blocks_id_seq
22+
START WITH 1
23+
INCREMENT BY 1
24+
NO MINVALUE
25+
NO MAXVALUE
26+
CACHE 1;
27+
28+
ALTER SEQUENCE building_blocks_id_seq OWNED BY building_blocks.id;
29+
30+
ALTER TABLE building_blocks
31+
ALTER COLUMN id SET DEFAULT nextval('building_blocks_id_seq');
32+
33+
ALTER TABLE ONLY building_blocks
34+
ADD CONSTRAINT building_blocks_pkey PRIMARY KEY (id);
35+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--
2+
-- UPDATE EXISTING TABLES:
3+
-- project_phases
4+
-- description column: added
5+
-- requirements column: added
6+
7+
ALTER TABLE project_phases ADD COLUMN "description" character varying(255);
8+
ALTER TABLE project_phases ADD COLUMN "requirements" text;

0 commit comments

Comments
 (0)