Skip to content

Merge changes from 'dev' branch #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
- POSTGRES_USER: circle_test
- POSTGRES_DB: circle_test
- image: elasticsearch:2.3
- image: rabbitmq:3-management
environment:
DB_MASTER_URL: postgres://circle_test:@127.0.0.1:5432/circle_test
AUTH_SECRET: secret
Expand Down Expand Up @@ -96,7 +97,7 @@ workflows:
- test
filters:
branches:
only: ['dev', 'dev-sts']
only: ['dev', 'dev-sts', 'feature/looker-api-integration']
- deployProd:
context : org-global
requires:
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"mocha": true
},
"rules": {
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js", "**/*.spec.js", "**/serviceMocks.js"]}],
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js", "**/*.spec.js", "src/tests/*.js"]}],
"max-len": ["error", { "ignoreComments": true, "code": 120 }],
"valid-jsdoc": ["error", {
"requireReturn": true,
Expand Down
14 changes: 13 additions & 1 deletion config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,17 @@
"accountsAppUrl": "ACCOUNTS_APP_URL",
"inviteEmailSubject": "INVITE_EMAIL_SUBJECT",
"inviteEmailSectionTitle": "INVITE_EMAIL_SECTION_TITLE",
"pageSize": "PAGE_SIZE"
"pageSize": "PAGE_SIZE",
"SSO_REFCODES": "SSO_REFCODES",
"lookerConfig": {
"BASE_URL": "LOOKER_API_BASE_URL",
"CLIENT_ID": "LOOKER_API_CLIENT_ID",
"CLIENT_SECRET": "LOOKER_API_CLIENT_SECRET",
"TOKEN": "TOKEN",
"USE_MOCK": "LOOKER_API_ENABLE_MOCK",
"QUERIES": {
"REG_STATS": "LOOKER_API_REG_STATS_QUERY_ID",
"BUDGET": "LOOKER_API_BUDGET_QUERY_ID"
}
}
}
15 changes: 14 additions & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,18 @@
"accountsAppUrl": "https://accounts.topcoder-dev.com",
"MAX_REVISION_NUMBER": 100,
"UNIQUE_GMAIL_VALIDATION": false,
"pageSize": 20
"pageSize": 20,
"VALID_STATUSES_BEFORE_PAUSED": "[\"active\"]",
"SSO_REFCODES": "[]",
"lookerConfig": {
"BASE_URL": "",
"CLIENT_ID": "",
"CLIENT_SECRET": "",
"TOKEN": "TOKEN",
"USE_MOCK": "true",
"QUERIES": {
"REG_STATS": 1234,
"BUDGET": 123
}
}
}
40 changes: 39 additions & 1 deletion local/seed/seedMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,45 @@ module.exports = (targetUrl, token) => {
'Authorization': 'Bearer ' + token
}

let promises = _(data.result.content.projectTypes).map(pt=>{
let promises

promises = _(data.result.content.forms).orderBy(['key', 'asc'], ['version', 'asc']).map(pt=>{
const param = _.omit(pt, ['id', 'version', 'revision', 'key']);
return axios
.post(destUrl + `metadata/form/${pt.key}/versions`, param, {headers:headers})
.catch((err) => {
const errMessage = _.get(err, 'response.data.message', '');
console.log(`Failed to create form with key=${pt.key} version=${pt.version}.`, errMessage)
})
});

await Promise.all(promises);

promises = _(data.result.content.planConfigs).orderBy(['key', 'asc'], ['version', 'asc']).map(pt=>{
const param = _.omit(pt, ['id', 'version', 'revision', 'key']);
return axios
.post(destUrl + `metadata/planConfig/${pt.key}/versions`, param, {headers:headers})
.catch((err) => {
const errMessage = _.get(err, 'response.data.message', '');
console.log(`Failed to create planConfig with key=${pt.key} version=${pt.version}.`, errMessage)
})
});

await Promise.all(promises);

promises = _(data.result.content.priceConfigs).orderBy(['key', 'asc'], ['version', 'asc']).map(pt=>{
const param = _.omit(pt, ['id', 'version', 'revision', 'key']);
return axios
.post(destUrl + `metadata/priceConfig/${pt.key}/versions`, param, {headers:headers})
.catch((err) => {
const errMessage = _.get(err, 'response.data.message', '');
console.log(`Failed to create priceConfig with key=${pt.key} version=${pt.version}.`, errMessage)
})
});

await Promise.all(promises);

promises = _(data.result.content.projectTypes).map(pt=>{
return axios
.post(destUrl+'metadata/projectTypes', pt, {headers:headers})
.catch((err) => {
Expand Down
16 changes: 16 additions & 0 deletions local/seed/seedProjects.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import util from '../../src/tests/util';
import models from '../../src/models';

const axios = require('axios');
const Promise = require('bluebird');
Expand Down Expand Up @@ -60,6 +61,21 @@ module.exports = (targetUrl, token) => {
});
}

await models.ProjectEstimation.create({
projectId,
buildingBlockKey: 'BLOCK_KEY',
conditions: '( HAS_DEV_DELIVERABLE && ONLY_ONE_OS_MOBILE && CA_NEEDED )',
price: 6500.50,
quantity: 10,
minTime: 35,
maxTime: 35,
metadata: {
deliverable: 'dev-qa',
},
createdBy: 1,
updatedBy: 1,
});

// creating invitations
if (Array.isArray(invites)) {
let promises = []
Expand Down
29 changes: 29 additions & 0 deletions migrations/20190502_status_history_create.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--
-- Create table status history
--

CREATE TABLE status_history (
id bigint,
"reference" character varying(45) NOT NULL,
"referenceId" bigint NOT NULL,
"status" character varying(45) NOT NULL,
"comment" text,
"createdAt" timestamp with time zone,
"updatedAt" timestamp with time zone,
"createdBy" integer NOT NULL,
"updatedBy" integer NOT NULL
);

CREATE SEQUENCE status_history_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE status_history_id_seq OWNED BY status_history.id;

ALTER TABLE ONLY status_history ALTER COLUMN id SET DEFAULT nextval('status_history_id_seq'::regclass);

ALTER TABLE ONLY status_history
ADD CONSTRAINT status_history_pkey PRIMARY KEY (id);
12 changes: 12 additions & 0 deletions migrations/20190611_extract_scope_from_project_templates_2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--
-- FIX for 20190316_extract_scope_from_project_templates.sql
-- apply created auto-increments sequences to `id` columns

ALTER TABLE form
ALTER COLUMN id SET DEFAULT nextval('form_id_seq');

ALTER TABLE price_config
ALTER COLUMN id SET DEFAULT nextval('price_config_id_seq');

ALTER TABLE plan_config
ALTER COLUMN id SET DEFAULT nextval('plan_config_id_seq');
11 changes: 11 additions & 0 deletions migrations/20190620_migrate_product_templates.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--
-- UPDATE EXISTING TABLES:
-- template:
-- remove `sections` if exists and change `questions` to `sections`

--
-- product_templates

UPDATE product_templates
SET template = (template::jsonb #- '{questions}' #- '{sections}') || jsonb_build_object('sections', template::jsonb ->'questions')
WHERE template::jsonb ? 'questions';
82 changes: 82 additions & 0 deletions migrations/20190624_workStream.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
--
-- CREATE NEW TABLE:
-- work_streams
--
CREATE TABLE work_streams (
id bigint NOT NULL,
"name" character varying(255) NOT NULL,
"type" character varying(45) NOT NULL,
"status" character varying(255) NOT NULL,
"projectId" bigint NOT NULL,
"deletedAt" timestamp with time zone,
"createdAt" timestamp with time zone,
"updatedAt" timestamp with time zone,
"deletedBy" bigint,
"createdBy" bigint NOT NULL,
"updatedBy" bigint NOT NULL
);

CREATE SEQUENCE work_streams_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE work_streams_id_seq OWNED BY work_streams.id;

ALTER TABLE work_streams
ALTER COLUMN id SET DEFAULT nextval('work_streams_id_seq');

ALTER TABLE ONLY work_streams
ADD CONSTRAINT "work_streams_pkey" PRIMARY KEY (id);

ALTER TABLE ONLY work_streams
ADD CONSTRAINT "work_streams_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES projects(id) ON UPDATE CASCADE ON DELETE SET NULL;

--
-- CREATE NEW TABLE:
-- work_management_permissions
--
CREATE TABLE work_management_permissions (
id bigint NOT NULL,
"policy" character varying(255) NOT NULL,
"permission" json NOT NULL,
"projectTemplateId" bigint NOT NULL,
"deletedAt" timestamp with time zone,
"createdAt" timestamp with time zone,
"updatedAt" timestamp with time zone,
"deletedBy" bigint,
"createdBy" bigint NOT NULL,
"updatedBy" bigint NOT NULL
);

CREATE SEQUENCE work_management_permissions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE work_management_permissions_id_seq OWNED BY work_management_permissions.id;

ALTER TABLE work_management_permissions
ALTER COLUMN id SET DEFAULT nextval('work_management_permissions_id_seq');

--
-- CREATE NEW TABLE:
-- phase_work_streams
--
CREATE TABLE phase_work_streams (
"workStreamId" bigint NOT NULL,
"phaseId" bigint NOT NULL
);

ALTER TABLE ONLY phase_work_streams
ADD CONSTRAINT "phase_work_streams_pkey" PRIMARY KEY ("workStreamId", "phaseId");

ALTER TABLE ONLY phase_work_streams
ADD CONSTRAINT "phase_work_streams_phaseId_fkey" FOREIGN KEY ("phaseId") REFERENCES project_phases(id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY phase_work_streams
ADD CONSTRAINT "phase_work_streams_workStreamId_fkey" FOREIGN KEY ("workStreamId") REFERENCES work_streams(id) ON UPDATE CASCADE ON DELETE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
-- CREATE NEW TABLES:
-- project_settings
-- project_estimation_items
--

--
-- project_settings
--

CREATE TABLE project_settings (
id bigint NOT NULL,
key character varying(255),
value character varying(255),
"valueType" character varying(255),
"projectId" bigint NOT NULL,
metadata json NOT NULL DEFAULT '{}'::json,
"readPermission" json NOT NULL DEFAULT '{}'::json,
"writePermission" json NOT NULL DEFAULT '{}'::json,
"deletedAt" timestamp with time zone,
"createdAt" timestamp with time zone,
"updatedAt" timestamp with time zone,
"deletedBy" bigint,
"createdBy" bigint NOT NULL,
"updatedBy" bigint NOT NULL,
CONSTRAINT project_settings_pkey PRIMARY KEY (id)
);

CREATE SEQUENCE project_settings_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE project_settings_id_seq OWNED BY project_settings.id;

ALTER TABLE project_settings
ALTER COLUMN id SET DEFAULT nextval('project_settings_id_seq');

ALTER TABLE project_settings
ADD CONSTRAINT project_settings_key_project_id UNIQUE (key, "projectId");

--
-- project_estimation_items
--

CREATE TABLE project_estimation_items (
id bigint NOT NULL,
"projectEstimationId" bigint NOT NULL,
price double precision NOT NULL,
type character varying(255) NOT NULL,
"markupUsedReference" character varying(255) NOT NULL,
"markupUsedReferenceId" bigint NOT NULL,
metadata json NOT NULL DEFAULT '{}'::json,
"deletedAt" timestamp with time zone,
"createdAt" timestamp with time zone,
"updatedAt" timestamp with time zone,
"deletedBy" bigint,
"createdBy" bigint NOT NULL,
"updatedBy" bigint NOT NULL,
CONSTRAINT project_estimation_items_pkey PRIMARY KEY (id)
);

CREATE SEQUENCE project_estimation_items_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE project_estimation_items_id_seq OWNED BY form.id;

ALTER TABLE project_estimation_items
ALTER COLUMN id SET DEFAULT nextval('project_estimation_items_id_seq');
35 changes: 35 additions & 0 deletions migrations/20190720_project_building_block.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
--
-- CREATE NEW TABLE:
-- building_blocks
--
CREATE TABLE building_blocks (
id bigint NOT NULL,
"key" character varying(255) NOT NULL,
"config" json NOT NULL DEFAULT '{}'::json,
"privateConfig" json NOT NULL DEFAULT '{}'::json,
"deletedAt" timestamp with time zone,
"createdAt" timestamp with time zone,
"updatedAt" timestamp with time zone,
"deletedBy" bigint,
"createdBy" bigint NOT NULL,
"updatedBy" bigint NOT NULL
);

ALTER TABLE building_blocks
ADD CONSTRAINT building_blocks_key_uniq UNIQUE (key);

CREATE SEQUENCE building_blocks_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER SEQUENCE building_blocks_id_seq OWNED BY building_blocks.id;

ALTER TABLE building_blocks
ALTER COLUMN id SET DEFAULT nextval('building_blocks_id_seq');

ALTER TABLE ONLY building_blocks
ADD CONSTRAINT building_blocks_pkey PRIMARY KEY (id);

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--
-- UPDATE EXISTING TABLES:
-- project_phases
-- description column: added
-- requirements column: added

ALTER TABLE project_phases ADD COLUMN "description" character varying(255);
ALTER TABLE project_phases ADD COLUMN "requirements" text;
Loading