Skip to content

Production release to support Connect 2.4.4 #165

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 90 commits into from
Aug 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
808d90b
Timeline and Milestone Changes
Jul 11, 2018
3355613
lint fix
Jul 11, 2018
1c03718
made the feature branch deployable
Jul 11, 2018
6808e01
Added text fields for various states of the milestone template object
Jul 16, 2018
0700be1
Added hidden field to the milestone template model
Jul 17, 2018
315d424
Fixed issue with failing unit tests for milestone create action. It w…
Jul 17, 2018
4019c1d
added product as possible value for the reference field in timeline m…
Jul 17, 2018
380fddf
Merge pull request #114 from topcoder-platform/hotfix/fixing_message_…
Jul 18, 2018
1602c6c
Added metadata JSON field. (#115)
architectt1 Jul 20, 2018
3ecc88a
Github issue#120, Customer cannot create timelines and milestones
Jul 23, 2018
3454cc4
Making reference and referenceId compulsory for LIST timelines endpoint
Jul 23, 2018
94bf571
Github issue#117, Cannot update `endDate` and `completionDate` of mil…
Jul 23, 2018
827b225
Github issue#108, Need new endpoint for creating timeline and milesto…
Jul 24, 2018
fe3b54c
Github issue#Customer cannot create timelines and milestones
Jul 24, 2018
7fca5a7
Fixing wrong handling of transactions. HTTP response was being sent b…
Jul 26, 2018
46673e8
d wrong handling of transaction for delete operation on milestones. C…
Jul 26, 2018
387aa4b
Fixing wrong handling of transactions in phaseProduct model.
Jul 26, 2018
89884ac
Fixing wrong handling of transactions in timelines model. Create was …
Jul 26, 2018
673c621
Fixing wrong handling of transactions in projects model.
Jul 26, 2018
bd39e23
Fixing missing timelineId field for milestone
Jul 26, 2018
aa61e23
fixed unit tests
Jul 26, 2018
a2cced2
Fix for issues in https://github.com/topcoder-platform/tc-project-ser…
coderReview Jul 28, 2018
14ec56e
Replaced project type checking by lookup middleware.
architectt1 Jul 28, 2018
520f373
- Added projectUrl to all connect bus events.
architectt1 Jul 28, 2018
5b5215a
- Added fileUrl when sending a PROJECT_FILE_UPLOADED event to the bus…
architectt1 Jul 28, 2018
2887ef8
When creating a project from a project template, define phases' start…
architectt1 Jul 28, 2018
de0d52e
Changes after comments on #138.
architectt1 Jul 28, 2018
84b9fed
Changes after comments on #137.
architectt1 Jul 28, 2018
4457b87
When updating a timeline, update correctly their milestones' startDat…
architectt1 Jul 28, 2018
52ee6f6
fix Issue #128
morehappiness Jul 28, 2018
b2ca870
Fix for issue#133
thiyagu06 Jul 28, 2018
b9fc2db
- Updating a milestone's completionDate/duration should update the da…
architectt1 Jul 28, 2018
127a470
Fix for Issue #129
mhikeo Jul 29, 2018
b1e51c6
Fix lint and update swagger #129
mhikeo Jul 29, 2018
4c4d7fe
Fix unit test #129
Jul 29, 2018
0a504f4
Moved back to implicit transactions.
architectt1 Jul 29, 2018
35cfcac
Changed GET /v4/projects endpoint in a way that it does not return at…
narekcat Jul 29, 2018
6565aca
Fix lint errors.
narekcat Jul 29, 2018
4492fdf
Fixed copy paste magic and added new test for attachments field.
narekcat Jul 30, 2018
ce796e4
Merge pull request #149 from topcoder-platform/issue/140
Jul 30, 2018
698b551
Merge pull request #146 from mhikeo/issue/129
Jul 30, 2018
c1cf779
fixed typo
Jul 30, 2018
8087815
Merge pull request #139 from topcoder-platform/issue/126
Jul 30, 2018
65c5ef2
Merge pull request #135 from topcoder-platform/issue/134
Jul 30, 2018
6550b7c
Merge pull request #136 from topcoder-platform/issues/132
Jul 30, 2018
5075a61
Merge branch 'feature/timeline-milestone' into issue/131
Jul 30, 2018
884335a
Merge pull request #137 from topcoder-platform/issue/131
Jul 30, 2018
2bcc524
Merge pull request #138 from topcoder-platform/issue/130
Jul 30, 2018
55ada2a
- Fixed issue where identical data were being treated as different an…
architectt1 Jul 30, 2018
3215780
Merge branch 'feature/timeline-milestone' into issue/126
architectt1 Jul 30, 2018
ccf7136
Merge branch 'feature/timeline-milestone' into issue/127
architectt1 Jul 31, 2018
737c0e6
- Removed setTimeout calls.
architectt1 Jul 31, 2018
61cdff3
Made code more readable.
architectt1 Jul 31, 2018
377b070
- When updating a milestone, set updatedBy to updated records.
architectt1 Jul 31, 2018
001ef29
Merge pull request #154 from topcoder-platform/issue/126
Jul 31, 2018
7d7e38e
Merge pull request #144 from topcoder-platform/issue/127
Jul 31, 2018
e00856a
Merge pull request #143 from thiyagu06/feature/timeline-milestone
coderReview Jul 31, 2018
afee68e
lint fix
Jul 31, 2018
69a166c
Marking next milestone as active when a milestone is marked as complete
Jul 31, 2018
3816711
Merge pull request #142 from morehappiness/feature/timeline-milestone
Aug 1, 2018
860997d
lint fixes
Aug 1, 2018
7a3ab9c
lint fixes
Aug 1, 2018
7589a86
SQL migration script for soft delete
Aug 1, 2018
9cd1630
Adding ability to fetch the products along with each phase to remove …
Aug 1, 2018
7407724
Fixed bug with returning default fields in phase list endpoint
Aug 1, 2018
b6ff1c8
Fixing bug about hidden milestones.
Aug 1, 2018
43ae1fc
Github issue#156, Update dates of hidden milestones as well when casc…
Aug 3, 2018
c2da5b0
Setting startDate when activating a milstone.
Aug 7, 2018
264f21e
Trying to add actualStartDate.
Aug 9, 2018
5877622
Github issue#160, /v4/projects/6976/phases?fields=... doesn't accept …
Aug 9, 2018
72fe6f6
trying to fix unit tests for actual start date
Aug 9, 2018
9ada35f
SQL script changes for recent backend changes
Aug 9, 2018
7c003e3
trying to fix mismatch in database and ES index for milestone updates…
Aug 9, 2018
2dcd556
fixed typos
Aug 10, 2018
8f0f3f0
Fixed unit tests
Aug 10, 2018
df36fcc
Debug statements
Aug 10, 2018
3b78850
Fixed issue with handling cascaded updates
Aug 10, 2018
056ca89
One more fix for syncing ES and db
Aug 10, 2018
1b6cf9c
lint fix
Aug 10, 2018
e2e0d49
removed debug statement
Aug 10, 2018
14dc571
Fixed logic for updating upcoming milestones when actual start date o…
Aug 13, 2018
63abc6e
Fixed logic to trigger cascade updates when a milestone is marked as …
Aug 13, 2018
90d69bc
ordering milestone templates before creating milestones based on them
Aug 13, 2018
488c5ac
Removed in built validation and added explicit validation on startDat…
Aug 13, 2018
dcfc62b
fixing unit test
Aug 13, 2018
5b1cdd8
trying to handle hidden milestones while creating them with new timeline
Aug 13, 2018
a14b03d
Merge pull request #164 from topcoder-platform/feature/timeline-miles…
Aug 14, 2018
a02eefb
Removing foreign key validation for milestone templates so that it ca…
Aug 14, 2018
83b722e
master sync, seems empty set
Aug 14, 2018
0191f1f
unit tests fix
Aug 14, 2018
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ workflows:
- test
filters:
branches:
only: ['dev', 'feature/dev-challenges']
only: ['dev', 'feature/timeline-milestone']
- deployProd:
requires:
- test
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Authentication is handled via Authorization (Bearer) token header field. Token i
```
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJhZG1pbmlzdHJhdG9yIl0sImlzcyI6Imh0dHBzOi8vYXBpLnRvcGNvZGVyLWRldi5jb20iLCJoYW5kbGUiOiJwc2hhaDEiLCJleHAiOjI0NjI0OTQ2MTgsInVzZXJJZCI6IjQwMTM1OTc4IiwiaWF0IjoxNDYyNDk0MDE4LCJlbWFpbCI6InBzaGFoMUB0ZXN0LmNvbSIsImp0aSI6ImY0ZTFhNTE0LTg5ODAtNDY0MC04ZWM1LWUzNmUzMWE3ZTg0OSJ9.XuNN7tpMOXvBG1QwWRQROj7NfuUbqhkjwn39Vy4tR5I
```
It's been signed with the secret 'secret'. This secret should match your entry in config/local.json. You can generate your own token using https://jwt.io
It's been signed with the secret 'secret'. This secret should match your entry in config/local.js. You can generate your own token using https://jwt.io

### Local Deployment
Build image:
Expand Down
4 changes: 3 additions & 1 deletion config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"host": "PROJECTS_ES_URL",
"apiVersion": "2.3",
"indexName": "PROJECTS_ES_INDEX_NAME",
"docType": "projectV4"
"docType": "projectV4",
"timelineIndexName": "TIMELINES_ES_INDEX_NAME",
"timelineDocType": "TIMELINES_ES_DOC_TYPE"
},
"rabbitmqURL": "RABBITMQ_URL",
"pubsubQueueName": "PUBSUB_QUEUE_NAME",
Expand Down
4 changes: 3 additions & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"host": "",
"apiVersion": "2.3",
"indexName": "projects",
"docType": "projectV4"
"docType": "projectV4",
"timelineIndexName": "timelines",
"timelineDocType": "timelineV4"
},
"systemUserClientId": "",
"systemUserClientSecret": "",
Expand Down
3 changes: 2 additions & 1 deletion config/development.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"pubsubQueueName": "dev.project.service",
"pubsubExchangeName": "dev.projects",
"attachmentsS3Bucket": "topcoder-dev-media"
"attachmentsS3Bucket": "topcoder-dev-media",
"connectProjectsUrl": "https://connect.topcoder-dev.com/projects/"
}
3 changes: 2 additions & 1 deletion config/production.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"authDomain": "topcoder.com"
"authDomain": "topcoder.com",
"connectProjectsUrl": "https://connect.topcoder.com/projects/",
}
5 changes: 4 additions & 1 deletion config/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
"host": "http://localhost:9200",
"apiVersion": "2.3",
"indexName": "projects_test",
"docType": "projectV4"
"docType": "projectV4",
"timelineIndexName": "timelines_test",
"timelineDocType": "timelineV4"
},
"rabbitmqUrl": "amqp://localhost:5672",
"connectProjectsUrl": "https://local.topcoder-dev.com/projects/",
"dbConfig": {
"masterUrl": "postgres://coder:mysecretpassword@localhost:5432/projectsdb_test",
"maxPoolSize": 50,
Expand Down
9 changes: 5 additions & 4 deletions migrations/20180608_project_add_templateId_and_new_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ CREATE TABLE milestones (
duration integer NOT NULL,
"startDate" timestamp with time zone NOT NULL,
"endDate" timestamp with time zone,
"actualStartDate" timestamp with time zone,
"completionDate" timestamp with time zone,
status character varying(45) NOT NULL,
type character varying(45) NOT NULL,
Expand Down Expand Up @@ -108,6 +109,10 @@ CREATE TABLE product_milestone_templates (
duration integer NOT NULL,
type character varying(45) NOT NULL,
"order" integer NOT NULL,
"plannedText" character varying(512) NOT NULL,
"activeText" character varying(512) NOT NULL,
"blockedText" character varying(512) NOT NULL,
"completedText" character varying(512) NOT NULL,
"deletedAt" timestamp with time zone,
"createdAt" timestamp with time zone,
"updatedAt" timestamp with time zone,
Expand Down Expand Up @@ -313,9 +318,5 @@ ALTER TABLE ONLY milestones
ALTER TABLE ONLY phase_products
ADD CONSTRAINT "phase_products_phaseId_fkey" FOREIGN KEY ("phaseId") REFERENCES project_phases(id) ON UPDATE CASCADE ON DELETE SET NULL;


ALTER TABLE ONLY product_milestone_templates
ADD CONSTRAINT "product_milestone_templates_productTemplateId_fkey" FOREIGN KEY ("productTemplateId") REFERENCES product_templates(id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY project_phases
ADD CONSTRAINT "project_phases_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES projects(id) ON UPDATE CASCADE ON DELETE SET NULL;
13 changes: 13 additions & 0 deletions migrations/20180717_project_types_metadata.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--
-- UPDATE EXISTING TABLES:
-- project_types
-- metadata column: added
--

--
-- project_types
--

ALTER TABLE project_types ADD COLUMN "metadata" json;
UPDATE project_types set metadata='{}' where metadata is null;
ALTER TABLE project_types ALTER COLUMN "metadata" SET NOT NULL;
35 changes: 35 additions & 0 deletions migrations/20180727_product_categories.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
-- UPDATE EXISTING TABLES:
-- product_templates
-- category column: added
-- CREATE NEW TABLE:
-- product_categories

--
-- product_categories
--
CREATE TABLE product_categories (
key character varying(45) NOT NULL,
"displayName" character varying(255) NOT NULL,
"icon" character varying(255) NOT NULL,
"info" character varying(255) NOT NULL,
"question" character varying(255) NOT NULL,
"aliases" json NOT NULL,
"hidden" boolean DEFAULT false,
"disabled" boolean DEFAULT false,
"deletedAt" timestamp with time zone,
"createdAt" timestamp with time zone,
"updatedAt" timestamp with time zone,
"deletedBy" integer,
"createdBy" integer NOT NULL,
"updatedBy" integer NOT NULL
);

ALTER TABLE ONLY product_categories
ADD CONSTRAINT product_categories_pkey PRIMARY KEY (key);

--
-- product_templates
--
ALTER TABLE product_templates ADD COLUMN "category" character varying(45);
UPDATE product_templates set category='generic' where category is null;
ALTER TABLE product_templates ALTER COLUMN "category" SET NOT NULL;
24 changes: 24 additions & 0 deletions migrations/20180801_deletedBy_soft_deleted.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--
-- UPDATE EXISTING TABLES:
-- projects
-- deletedBy column: added
-- project_attachments
-- deletedBy column: added
-- project_members
-- deletedBy column: added
--

--
-- projects
--
ALTER TABLE projects ADD COLUMN "deletedBy" bigint;

--
-- project_attachments
--
ALTER TABLE project_attachments ADD COLUMN "deletedBy" bigint;

--
-- project_members
--
ALTER TABLE project_members ADD COLUMN "deletedBy" bigint;
7 changes: 6 additions & 1 deletion migrations/elasticsearch_sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import util from '../src/util';

const ES_PROJECT_INDEX = config.get('elasticsearchConfig.indexName');
const ES_PROJECT_TYPE = config.get('elasticsearchConfig.docType');
const ES_TIMELINE_INDEX = config.get('elasticsearchConfig.timelineIndexName');

// create new elasticsearch client
// the client modifies the config object, so always passed the cloned object
Expand Down Expand Up @@ -323,10 +324,14 @@ esClient.indices.delete({
ignore: [404],
})
.then(() => esClient.indices.create(getRequestBody(ES_PROJECT_INDEX)))
// Re-create timeline index
.then(() => esClient.indices.delete({ index: ES_TIMELINE_INDEX, ignore: [404] }))
.then(() => esClient.indices.create({ index: ES_TIMELINE_INDEX }))
.then(() => {
console.log('elasticsearch indices synced successfully');
process.exit();
}).catch((err) => {
})
.catch((err) => {
console.error('elasticsearch indices sync failed', err);
process.exit();
});
50 changes: 50 additions & 0 deletions migrations/seedElasticsearchIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import config from 'config';
import Promise from 'bluebird';
import models from '../src/models';
import RabbitMQService from '../src/services/rabbitmq';
import { TIMELINE_REFERENCES } from '../src/constants';

const logger = bunyan.createLogger({ name: 'init-es', level: config.get('logLevel') });

Expand All @@ -23,6 +24,19 @@ function getProjectIds() {
return [];
}

/**
* Retrieve timeline ids from cli if provided
* @return {Array} list of timelineIds
*/
function getTimelineIds() {
let timelineIdArg = _.find(process.argv, a => a.indexOf('timelineIds') > -1);
if (timelineIdArg) {
timelineIdArg = timelineIdArg.split('=');
return timelineIdArg[1].split(',').map(i => parseInt(i, 10));
}
return [];
}

Promise.coroutine(function* wrapped() {
try {
const rabbit = new RabbitMQService(logger);
Expand Down Expand Up @@ -58,12 +72,48 @@ Promise.coroutine(function* wrapped() {
logger.info(`Retrieved #${members.length} members`);
members = _.groupBy(members, 'projectId');

// Get timelines
const timelineIds = getTimelineIds();
const timelineWhereClause = (timelineIds.length > 0) ? { id: { $in: timelineIds } } : {};
let timelines = yield models.Timeline.findAll({
where: timelineWhereClause,
include: [{ model: models.Milestone, as: 'milestones' }],
});
logger.info(`Retrieved #${projects.length} timelines`);

// Convert to raw json and remove unnecessary fields
timelines = _.map(timelines, (timeline) => {
const entity = _.omit(timeline.toJSON(), ['deletedBy', 'deletedAt']);
entity.milestones = _.map(entity.milestones, milestone => _.omit(milestone, ['deletedBy', 'deletedAt']));
return entity;
});

// Get projectId for each timeline
yield Promise.all(
_.map(timelines, (timeline) => {
if (timeline.reference === TIMELINE_REFERENCES.PROJECT) {
timeline.projectId = timeline.referenceId;
return Promise.resolve(timeline);
}

return models.ProjectPhase.findById(timeline.referenceId)
.then((phase) => {
timeline.projectId = phase.projectId;
return Promise.resolve(timeline);
});
}),
);

const promises = [];
_.forEach(projects, (p) => {
p.members = members[p.id];
logger.debug(`Processing Project #${p.id}`);
promises.push(rabbit.publish('project.initial', p, {}));
});
_.forEach(timelines, (t) => {
logger.debug(`Processing Timeline #${t.id}`);
promises.push(rabbit.publish('timeline.initial', t, {}));
});
Promise.all(promises)
.then(() => {
logger.info(`Published ${promises.length} msgs`);
Expand Down
Loading