Skip to content

Data model for spend price per building blocks and project settings #373

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 19 commits into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4eb6e47
added constant with estimation types ESTIMATION_TYPE
maxceem Jul 18, 2019
95074c7
winning submission from challenge 30096338
maxceem Aug 12, 2019
647ee72
fix “GET /projects/{id}/estimations/{id}/items” endpoint
maxceem Aug 12, 2019
df06bf3
winning submission from the challenge 30096337
maxceem Aug 14, 2019
1dda122
reset changes in config files
maxceem Aug 14, 2019
2946084
fixed issues found during review, improved code quality, improved uni…
maxceem Aug 15, 2019
8669f97
Merge branch 'dev' into feature/price-estimation-items/project-settings
maxceem Aug 15, 2019
57aae7a
small fixes to postman
maxceem Aug 15, 2019
f30367e
fix swagger
maxceem Aug 15, 2019
f1dc776
re-save postman file in versions 2.1 for easier merging
maxceem Aug 15, 2019
0db1130
Merge branch 'feature/price-estimation-items/building-blocks' into fe…
maxceem Aug 15, 2019
eda13da
make logic of filtering Project Estimation Items more general. Cleane…
maxceem Aug 15, 2019
02bc7b0
use the solution from the second place submitter to take care about p…
maxceem Aug 15, 2019
f67092b
fix: more realistic condition for demo/test building block
maxceem Aug 23, 2019
1a23721
fix: remove unnecessary ESTIMATION_TYPE.REFERENCE_PROGRAM
maxceem Aug 23, 2019
eaaaef0
refactor: correct name for model creating method defineProjectEstimat…
maxceem Aug 23, 2019
adec0ce
refactor: enhance unit test description
maxceem Aug 23, 2019
a8b24c4
Merge branch 'dev' into feature/price-estimation-items/merged
maxceem Aug 23, 2019
70d70d8
fix: lint
maxceem Aug 23, 2019
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
17 changes: 16 additions & 1 deletion 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 @@ -54,6 +55,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 Expand Up @@ -134,4 +150,3 @@ function updateProjectMemberInvite(projectId, params, targetUrl, headers) {
console.log(`Failed to update project member invites ${projectId}: ${err.message}`);
})
}

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);

Loading