From eac145f45e1b4b2514a6fab4749265dad8a341dd Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Mon, 29 Jul 2019 18:14:44 +0530 Subject: [PATCH 01/10] changing kafka topic name --- connect/constants.js | 84 ++++++++++++++++++++++---------------------- constants.js | 2 +- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/connect/constants.js b/connect/constants.js index bfcf725..60a768a 100644 --- a/connect/constants.js +++ b/connect/constants.js @@ -16,60 +16,60 @@ module.exports = { BUS_API_EVENT: { CONNECT: { POST: { - UPDATED: 'notifications.connect.project.post.edited', - CREATED: 'notifications.connect.project.post.created', - DELETED: 'notifications.connect.project.post.deleted', - MENTION: 'notifications.connect.project.post.mention', + UPDATED: 'connect.notification.project.post.edited', + CREATED: 'connect.notification.project.post.created', + DELETED: 'connect.notification.project.post.deleted', + MENTION: 'connect.notification.project.post.mention', }, MEMBER: { - JOINED: 'notifications.connect.project.member.joined', - LEFT: 'notifications.connect.project.member.left', - REMOVED: 'notifications.connect.project.member.removed', - MANAGER_JOINED: 'notifications.connect.project.member.managerJoined', - COPILOT_JOINED: 'notifications.connect.project.member.copilotJoined', - ASSIGNED_AS_OWNER: 'notifications.connect.project.member.assignedAsOwner', - INVITE_CREATED: 'notifications.connect.project.member.invite.created', - INVITE_UPDATED: 'notifications.connect.project.member.invite.updated', - INVITE_REQUESTED: 'notifications.connect.project.member.invite.requested', - INVITE_APPROVED: 'notifications.connect.project.member.invite.approved', - INVITE_REJECTED: 'notifications.connect.project.member.invite.rejected', + JOINED: 'connect.notification.project.member.joined', + LEFT: 'connect.notification.project.member.left', + REMOVED: 'connect.notification.project.member.removed', + MANAGER_JOINED: 'connect.notification.project.member.managerJoined', + COPILOT_JOINED: 'connect.notification.project.member.copilotJoined', + ASSIGNED_AS_OWNER: 'connect.notification.project.member.assignedAsOwner', + INVITE_CREATED: 'connect.notification.project.member.invite.created', + INVITE_UPDATED: 'connect.notification.project.member.invite.updated', + INVITE_REQUESTED: 'connect.notification.project.member.invite.requested', + INVITE_APPROVED: 'connect.notification.project.member.invite.approved', + INVITE_REJECTED: 'connect.notification.project.member.invite.rejected', }, PROJECT: { - ACTIVE: 'notifications.connect.project.active', - APPROVED: 'notifications.connect.project.approved', - CANCELED: 'notifications.connect.project.canceled', - COMPLETED: 'notifications.connect.project.completed', - CREATED: 'notifications.connect.project.created', - FILE_UPLOADED: 'notifications.connect.project.fileUploaded', - LINK_CREATED: 'notifications.connect.project.linkCreated', - PAUSED: 'notifications.connect.project.paused', - SUBMITTED_FOR_REVIEW: 'notifications.connect.project.submittedForReview', - SPECIFICATION_MODIFIED: 'connect.action.project.updated.spec', + ACTIVE: 'connect.notification.project.active', + APPROVED: 'connect.notification.project.approved', + CANCELED: 'connect.notification.project.canceled', + COMPLETED: 'connect.notification.project.completed', + CREATED: 'connect.notification.project.created', + FILE_UPLOADED: 'connect.notification.project.fileUploaded', + LINK_CREATED: 'connect.notification.project.linkCreated', + PAUSED: 'connect.notification.project.paused', + SUBMITTED_FOR_REVIEW: 'connect.notification.project.submittedForReview', + SPECIFICATION_MODIFIED: 'connect.notification.project.updated.spec', }, PROJECT_PLAN: { - READY: 'connect.action.project.plan.ready', - MODIFIED: 'connect.action.project.plan.updated', - PROGRESS_UPDATED: 'connect.action.project.updated.progress', - PHASE_ACTIVATED: 'notifications.connect.project.phase.transition.active', - PHASE_COMPLETED: 'notifications.connect.project.phase.transition.completed', - PHASE_PAYMENT_UPDATED: 'notifications.connect.project.phase.update.payment', - PHASE_PROGRESS_UPDATED: 'notifications.connect.project.phase.update.progress', - PHASE_SCOPE_UPDATED: 'notifications.connect.project.phase.update.scope', - PHASE_PRODUCT_SPEC_UPDATED: 'connect.action.project.product.update.spec', - MILESTONE_ACTIVATED: 'connect.action.timeline.milestone.transition.active', - MILESTONE_COMPLETED: 'connect.action.timeline.milestone.transition.completed', - WAITING_FOR_CUSTOMER_INPUT: 'connect.action.timeline.milestone.waiting.customer', - TIMELINE_ADJUSTED: 'connect.action.timeline.adjusted', + READY: 'connect.notification.project.plan.ready', + MODIFIED: 'connect.notification.project.plan.updated', + PROGRESS_UPDATED: 'connect.notification.project.updated.progress', + PHASE_ACTIVATED: 'connect.notification.project.phase.transition.active', + PHASE_COMPLETED: 'connect.notification.project.phase.transition.completed', + PHASE_PAYMENT_UPDATED: 'connect.notification.project.phase.update.payment', + PHASE_PROGRESS_UPDATED: 'connect.notification.project.phase.update.progress', + PHASE_SCOPE_UPDATED: 'connect.notification.project.phase.update.scope', + PHASE_PRODUCT_SPEC_UPDATED: 'connect.notification.project.product.update.spec', + MILESTONE_ACTIVATED: 'connect.notification.timeline.milestone.transition.active', + MILESTONE_COMPLETED: 'connect.notification.timeline.milestone.transition.completed', + WAITING_FOR_CUSTOMER_INPUT: 'connect.notification.timeline.milestone.waiting.customer', + TIMELINE_ADJUSTED: 'connect.notification.timeline.adjusted', }, TOPIC: { - CREATED: 'notifications.connect.project.topic.created', - DELETED: 'notifications.connect.project.topic.deleted', + CREATED: 'connect.notification.project.topic.created', + DELETED: 'connect.notification.project.topic.deleted', }, }, EMAIL: { // TODO: after a proper named email topic is created, this is being used as the email event's topic - GENERAL: 'notifications.action.email.connect.project.notifications.generic', - BUNDLED: 'notifications.action.email.connect.project.notifications.bundled', + GENERAL: 'connect.notification.email.connect.project.notifications.generic', + BUNDLED: 'connect.notification.email.connect.project.notifications.bundled', }, }, }; diff --git a/constants.js b/constants.js index 317bf3a..2b2327a 100644 --- a/constants.js +++ b/constants.js @@ -7,7 +7,7 @@ module.exports = { BUS_API_EVENT: { EMAIL: { - GENERAL: 'notifications.action.email.connect.project.notifications.generic', + GENERAL: 'connect.notification.email.connect.project.notifications.generic', }, }, }; From 99e7147a28960e337ff22cb8688b67eb181c04d7 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Mon, 29 Jul 2019 18:22:33 +0530 Subject: [PATCH 02/10] changing in sql schema --- migrations/v2.0.1.sql | 9 +++++++++ src/models/NotificationSetting.js | 1 + 2 files changed, 10 insertions(+) create mode 100644 migrations/v2.0.1.sql diff --git a/migrations/v2.0.1.sql b/migrations/v2.0.1.sql new file mode 100644 index 0000000..5376685 --- /dev/null +++ b/migrations/v2.0.1.sql @@ -0,0 +1,9 @@ + -- rename "topic" column to "topicOld" + ALTER TABLE "public"."NotificationSettings" + RENAME COLUMN "topic" TO "topicOld"; + + -- add "topic" column + ALTER TABLE "public"."NotificationSettings" + ADD COLUMN "topic" character varying(255); + + \ No newline at end of file diff --git a/src/models/NotificationSetting.js b/src/models/NotificationSetting.js index 39ed238..ad7261f 100644 --- a/src/models/NotificationSetting.js +++ b/src/models/NotificationSetting.js @@ -17,4 +17,5 @@ module.exports = (sequelize, DataTypes) => sequelize.define('NotificationSetting serviceId: { type: DataTypes.STRING, allowNull: false }, name: { type: DataTypes.STRING, allowNull: false }, value: { type: DataTypes.STRING, allowNull: false }, + topicOld: { type: DataTypes.STRING, allowNull: false }, }, { timestamps: false }); From 36f630dcb4ee0155b638215a6e89a0b4b2471c50 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Thu, 1 Aug 2019 13:45:59 +0530 Subject: [PATCH 03/10] removing two times domain name from topic --- connect/constants.js | 4 ++-- constants.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/connect/constants.js b/connect/constants.js index 60a768a..a6874e7 100644 --- a/connect/constants.js +++ b/connect/constants.js @@ -68,8 +68,8 @@ module.exports = { }, EMAIL: { // TODO: after a proper named email topic is created, this is being used as the email event's topic - GENERAL: 'connect.notification.email.connect.project.notifications.generic', - BUNDLED: 'connect.notification.email.connect.project.notifications.bundled', + GENERAL: 'connect.notification.email.project.notifications.generic', + BUNDLED: 'connect.notification.email.project.notifications.bundled', }, }, }; diff --git a/constants.js b/constants.js index 2b2327a..4cadd8f 100644 --- a/constants.js +++ b/constants.js @@ -7,7 +7,7 @@ module.exports = { BUS_API_EVENT: { EMAIL: { - GENERAL: 'connect.notification.email.connect.project.notifications.generic', + GENERAL: 'connect.notification.email.project.notifications.generic', }, }, }; From d5c11f42347d450b55e46652c8783a03875d76ea Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Thu, 1 Aug 2019 16:40:46 +0530 Subject: [PATCH 04/10] preparing UPDATE sql statement --- migrations/v2.0.1.sql | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/migrations/v2.0.1.sql b/migrations/v2.0.1.sql index 5376685..76e5a71 100644 --- a/migrations/v2.0.1.sql +++ b/migrations/v2.0.1.sql @@ -6,4 +6,39 @@ ALTER TABLE "public"."NotificationSettings" ADD COLUMN "topic" character varying(255); - \ No newline at end of file +UPDATE "NotificationSettings" SET topic='connect.notification.project.timeline.milestone.transition.completed' WHERE "topicOld"='connect.action.timeline.milestone.transition.completed' +UPDATE "NotificationSettings" SET topic='connect.notification.project.product.update.spec' WHERE "topicOld"='connect.action.project.product.update.spec' +UPDATE "NotificationSettings" SET topic='connect.notification.project.created' WHERE "topicOld"='notifications.connect.project.created' +UPDATE "NotificationSettings" SET topic='connect.notification.project.post.created' WHERE "topicOld"='notifications.connect.project.post.created' +UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.transition.active' WHERE "topicOld"='notifications.connect.project.phase.transition.active' +UPDATE "NotificationSettings" SET topic='connect.notification.project.approved' WHERE "topicOld"='notifications.connect.project.approved' +UPDATE "NotificationSettings" SET topic='connect.notification.project.post.edited' WHERE "topicOld"='notifications.connect.project.post.edited' +UPDATE "NotificationSettings" SET topic='connect.notification.project.plan.updated' WHERE "topicOld"='connect.action.project.plan.updated' +UPDATE "NotificationSettings" SET topic='connect.notification.project.topic.created' WHERE "topicOld"='notifications.connect.project.topic.created' +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.managerJoined' WHERE "topicOld"='notifications.connect.project.member.managerJoined' +UPDATE "NotificationSettings" SET topic='connect.notification.project.specificationModified' WHERE "topicOld"='notifications.connect.project.specificationModified' +UPDATE "NotificationSettings" SET topic='connect.notification.project.canceled' WHERE "topicOld"='notifications.connect.project.canceled' +UPDATE "NotificationSettings" SET topic='connect.notification.project.active' WHERE "topicOld"='notifications.connect.project.active' +UPDATE "NotificationSettings" SET topic='connect.notification.project.updated.spec' WHERE "topicOld"='connect.action.project.updated.spec' +UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.update.payment' WHERE "topicOld"='notifications.connect.project.phase.update.payment' +UPDATE "NotificationSettings" SET topic='connect.notification.project.linkCreated' WHERE "topicOld"='notifications.connect.project.linkCreated' +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.invite.rejected' WHERE "topicOld"='notifications.connect.project.member.invite.rejected' +UPDATE "NotificationSettings" SET topic='connect.notification.project.completed' WHERE "topicOld"='notifications.connect.project.completed' +UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.update.scope' WHERE "topicOld"='notifications.connect.project.phase.update.scope' +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.invite.requested' WHERE "topicOld"='notifications.connect.project.member.invite.requested' +UPDATE "NotificationSettings" SET topic='connect.notification.project.paused' WHERE "topicOld"='notifications.connect.project.paused' +UPDATE "NotificationSettings" SET topic='connect.notification.project.plan.ready' WHERE "topicOld"='connect.action.project.plan.ready' +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.copilotJoined' WHERE "topicOld"='notifications.connect.project.member.copilotJoined' +UPDATE "NotificationSettings" SET topic='connect.notification.project.topic.deleted' WHERE "topicOld"='notifications.connect.project.topic.deleted' +UPDATE "NotificationSettings" SET topic='connect.notification.project.submittedForReview' WHERE "topicOld"='notifications.connect.project.submittedForReview' +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.invite.approved' WHERE "topicOld"='notifications.connect.project.member.invite.approved' +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.assignedAsOwner' WHERE "topicOld"='notifications.connect.project.member.assignedAsOwner' +UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.transition.completed' WHERE "topicOld"='notifications.connect.project.phase.transition.completed' +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.removed' WHERE "topicOld"='notifications.connect.project.member.removed' +UPDATE "NotificationSettings" SET topic='connect.notification.project.timeline.milestone.transition.active' WHERE "topicOld"='connect.action.timeline.milestone.transition.active' +UPDATE "NotificationSettings" SET topic='connect.notification.project.timeline.milestone.waiting.customer' WHERE "topicOld"='connect.action.timeline.milestone.waiting.customer' +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.joined' WHERE "topicOld"='notifications.connect.project.member.joined' +UPDATE "NotificationSettings" SET topic='connect.notification.project.fileUploaded' WHERE "topicOld"='notifications.connect.project.fileUploaded' +UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.update.progress' WHERE "topicOld"='notifications.connect.project.phase.update.progress' +UPDATE "NotificationSettings" SET topic='connect.notification.project.post.deleted' WHERE "topicOld"='notifications.connect.project.post.deleted' +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.left' WHERE "topicOld"='notifications.connect.project.member.left' From def92f2935b0ba445fe8d12e46c3909dd7b401f7 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Mon, 5 Aug 2019 14:55:20 +0530 Subject: [PATCH 05/10] chaging in email template --- emails/src/partials/project-plan.html | 24 +++++++++++------------ emails/src/partials/project-status.html | 14 ++++++------- emails/src/partials/project-team.html | 22 ++++++++++----------- emails/src/partials/topics_and_posts.html | 12 ++++++------ 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/emails/src/partials/project-plan.html b/emails/src/partials/project-plan.html index dcd772e..18090fa 100644 --- a/emails/src/partials/project-plan.html +++ b/emails/src/partials/project-plan.html @@ -35,40 +35,40 @@ - {{#if [connect.action.project.plan.ready]}} + {{#if [connect.notification.project.plan.ready]}} Project plan is ready for your project {{/if}} - {{#if [connect.action.project.plan.updated]}} + {{#if [connect.notification.project.plan.updated]}} Project plan is modified for your project {{/if}} - {{#if [connect.action.project.updated.progress]}} + {{#if [connect.notification.project.updated.progress]}} Your project has made some progress {{/if}} - {{#if [notifications.connect.project.phase.transition.active]}} + {{#if [connect.notification.project.phase.transition.active]}} Phase {{updatedPhase.name}} is activated {{/if}} - {{#if [notifications.connect.project.phase.transition.completed]}} + {{#if [connect.notification.project.phase.transition.completed]}} Phase {{updatedPhase.name}} is completed {{/if}} - {{#if [notifications.connect.project.phase.update.payment]}} + {{#if [connect.notification.project.phase.update.payment]}} Payments updated for phase {{updatedPhase.name}} {{/if}} - {{#if [notifications.connect.project.phase.update.progress]}} + {{#if [connect.notification.project.phase.update.progress]}} Phase {{updatedPhase.name}} has made some progress {{/if}} - {{#if [notifications.connect.project.phase.update.scope]}} + {{#if [connect.notification.project.phase.update.scope]}} Scope of the phase {{updatedPhase.name}} updated {{/if}} - {{#if [connect.action.project.product.update.spec]}} + {{#if [connect.notification.project.product.update.spec]}} Scope of the phase {{updatedPhase.name}} updated {{/if}} - {{#if [connect.action.timeline.milestone.transition.active]}} + {{#if [connect.notification.project.timeline.milestone.transition.active]}} A milestone is activated in phase {{updatedPhase.name}} {{/if}} - {{#if [connect.action.timeline.milestone.transition.completed]}} + {{#if [connect.notification.project.timeline.milestone.transition.completed]}} A milestone is completed in phase {{updatedPhase.name}} {{/if}} - {{#if [connect.action.timeline.milestone.waiting.customer]}} + {{#if [connect.notification.project.timeline.milestone.waiting.customer]}} We are waiting for your input at a milestone in the phase {{updatedPhase.name}} {{/if}} diff --git a/emails/src/partials/project-status.html b/emails/src/partials/project-status.html index 4e058f8..6805f2b 100644 --- a/emails/src/partials/project-status.html +++ b/emails/src/partials/project-status.html @@ -35,25 +35,25 @@ - {{#if [notifications.connect.project.active]}} + {{#if [connect.notification.project.active]}} We reviewed your project and have successfully launched it on our network. Now the copilots would be assigned according to your techincal specification, and they will proceed to building the work specification for the first phase. During this time they might ask you further questions in regards with the details of your system, in order for us to build a really great app. {{/if}} - {{#if [notifications.connect.project.approved]}} + {{#if [connect.notification.project.approved]}} Your project is now approved {{/if}} - {{#if [notifications.connect.project.canceled]}} + {{#if [connect.notification.project.canceled]}} Your project is now canceled {{/if}} - {{#if [notifications.connect.project.completed]}} + {{#if [connect.notification.project.completed]}} Your project is now complete {{/if}} - {{#if [notifications.connect.project.created]}} + {{#if [connect.notification.project.created]}} Your project is created {{/if}} - {{#if [notifications.connect.project.paused]}} + {{#if [connect.notification.project.paused]}} Your project is now paused {{/if}} - {{#if [notifications.connect.project.submittedForReview]}} + {{#if [connect.notification.project.submittedForReview]}} Your project is now submitted for review {{/if}} diff --git a/emails/src/partials/project-team.html b/emails/src/partials/project-team.html index e9a5dc1..f5dbb21 100644 --- a/emails/src/partials/project-team.html +++ b/emails/src/partials/project-team.html @@ -35,46 +35,46 @@ - {{#if [notifications.connect.project.member.assignedAsOwner]}} + {{#if [connect.notification.project.member.assignedAsOwner]}} {{userFullName}} assigned as project owner {{/if}} - {{#if [notifications.connect.project.member.copilotJoined]}} + {{#if [connect.notification.project.member.copilotJoined]}} {{userFullName}} joined the project as Copilot {{/if}} - {{#if [notifications.connect.project.member.managerJoined]}} + {{#if [connect.notification.project.member.managerJoined]}} {{userFullName}} joined the project as Manager {{/if}} - {{#if [notifications.connect.project.member.removed]}} + {{#if [connect.notification.project.member.removed]}} {{#if [emailToAffectedUser]}} You are removed from the project {{else}} {{userFullName}} left the project {{/if}} {{/if}} - {{#if [notifications.connect.project.member.left]}} + {{#if [connect.notification.project.member.left]}} {{userFullName}} left the project {{/if}} - {{#if [notifications.connect.project.member.joined]}} + {{#if [connect.notification.project.member.joined]}} {{userFullName}} joined the project {{/if}} - {{#if [notifications.connect.project.member.invite.created]}} + {{#if [connect.notification.project.member.invite.created]}} {{#if [isSSO]}} Hi {{userFullName}}, you are invited to join the project {{projectName}}. Please use the link below to sign in and join the project. {{else}} Hi {{userFullName}}, you are invited to join the project {{projectName}}. Please click on the button ("View project on Connect") below to join. {{/if}} {{/if}} - {{#if [notifications.connect.project.member.invite.requested]}} + {{#if [connect.notification.project.member.invite.requested]}} You are requested to add {{userFullName}} as a copilot {{/if}} - {{#if [notifications.connect.project.member.invite.approved]}} + {{#if [connect.notification.project.member.invite.approved]}} {{#if [originator]}} Your request to add invite the member was approved {{else}} Hi {{userFullName}}, you are added as a copilot {{/if}} {{/if}} - {{#if [notifications.connect.project.member.invite.rejected]}} + {{#if [connect.notification.project.member.invite.rejected]}} {{#if [originator]}} Your request to add the member was refused {{else}} @@ -106,7 +106,7 @@ - {{#if notifications.[0].[notifications.connect.project.member.invite.requested]}} + {{#if notifications.[0].[connect.notification.project.member.invite.requested]}} Manage project team diff --git a/emails/src/partials/topics_and_posts.html b/emails/src/partials/topics_and_posts.html index 73e1152..962e5c7 100644 --- a/emails/src/partials/topics_and_posts.html +++ b/emails/src/partials/topics_and_posts.html @@ -25,7 +25,7 @@ {{#each notifications}} - {{#if [notifications.connect.project.post.created]}} + {{#if [connect.notification.project.post.created]}} @@ -47,7 +47,7 @@ {{/if}} - {{#if [notifications.connect.project.topic.created]}} + {{#if [connect.notification.project.topic.created]}}
@@ -69,7 +69,7 @@ {{/if}} - {{#if [notifications.connect.project.topic.deleted]}} + {{#if [connect.notification.project.topic.deleted]}}
@@ -91,7 +91,7 @@ {{/if}} - {{#if [notifications.connect.project.post.mention]}} + {{#if [connect.notification.project.post.mention]}}
@@ -113,7 +113,7 @@ {{/if}} - {{#if [notifications.connect.project.post.edited]}} + {{#if [connect.notification.project.post.edited]}}
@@ -135,7 +135,7 @@ {{/if}} - {{#if [notifications.connect.project.post.deleted]}} + {{#if [connect.notification.project.post.deleted]}}
From 5eb0c08aca8b59c0be24d1097c1da5fbc8b7e30d Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Tue, 6 Aug 2019 12:45:15 +0530 Subject: [PATCH 06/10] typo in topic name --- connect/constants.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/connect/constants.js b/connect/constants.js index a6874e7..333839a 100644 --- a/connect/constants.js +++ b/connect/constants.js @@ -56,10 +56,10 @@ module.exports = { PHASE_PROGRESS_UPDATED: 'connect.notification.project.phase.update.progress', PHASE_SCOPE_UPDATED: 'connect.notification.project.phase.update.scope', PHASE_PRODUCT_SPEC_UPDATED: 'connect.notification.project.product.update.spec', - MILESTONE_ACTIVATED: 'connect.notification.timeline.milestone.transition.active', - MILESTONE_COMPLETED: 'connect.notification.timeline.milestone.transition.completed', - WAITING_FOR_CUSTOMER_INPUT: 'connect.notification.timeline.milestone.waiting.customer', - TIMELINE_ADJUSTED: 'connect.notification.timeline.adjusted', + MILESTONE_ACTIVATED: 'connect.notification.project.timeline.milestone.transition.active', + MILESTONE_COMPLETED: 'connect.notification.project.timeline.milestone.transition.completed', + WAITING_FOR_CUSTOMER_INPUT: 'connect.notification.project.timeline.milestone.waiting.customer', + TIMELINE_ADJUSTED: 'connect.notification.project.timeline.adjusted', }, TOPIC: { CREATED: 'connect.notification.project.topic.created', From cd48422c1b2056d7f71e35a68c3ae34b09fd3631 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Tue, 6 Aug 2019 13:55:26 +0530 Subject: [PATCH 07/10] removing topicOld from model --- src/models/NotificationSetting.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/models/NotificationSetting.js b/src/models/NotificationSetting.js index ad7261f..39ed238 100644 --- a/src/models/NotificationSetting.js +++ b/src/models/NotificationSetting.js @@ -17,5 +17,4 @@ module.exports = (sequelize, DataTypes) => sequelize.define('NotificationSetting serviceId: { type: DataTypes.STRING, allowNull: false }, name: { type: DataTypes.STRING, allowNull: false }, value: { type: DataTypes.STRING, allowNull: false }, - topicOld: { type: DataTypes.STRING, allowNull: false }, }, { timestamps: false }); From b2627fd8170fa58e3cd76a5d797bb45461c08031 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Tue, 6 Aug 2019 15:01:29 +0530 Subject: [PATCH 08/10] SQL changes --- migrations/v2.0.1.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/migrations/v2.0.1.sql b/migrations/v2.0.1.sql index 76e5a71..9423bcf 100644 --- a/migrations/v2.0.1.sql +++ b/migrations/v2.0.1.sql @@ -2,10 +2,14 @@ ALTER TABLE "public"."NotificationSettings" RENAME COLUMN "topic" TO "topicOld"; + ALTER TABLE "public"."NotificationSettings" + ALTER COLUMN "topicOld" DROP NOT NULL; + -- add "topic" column ALTER TABLE "public"."NotificationSettings" ADD COLUMN "topic" character varying(255); + UPDATE "NotificationSettings" SET topic='connect.notification.project.timeline.milestone.transition.completed' WHERE "topicOld"='connect.action.timeline.milestone.transition.completed' UPDATE "NotificationSettings" SET topic='connect.notification.project.product.update.spec' WHERE "topicOld"='connect.action.project.product.update.spec' UPDATE "NotificationSettings" SET topic='connect.notification.project.created' WHERE "topicOld"='notifications.connect.project.created' From 92105c08b49ba88e32bb1d852209b3048139f10d Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Tue, 6 Aug 2019 16:58:51 +0530 Subject: [PATCH 09/10] SQL: adding not null constraint. --- migrations/v2.0.1.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations/v2.0.1.sql b/migrations/v2.0.1.sql index 9423bcf..dc77d8d 100644 --- a/migrations/v2.0.1.sql +++ b/migrations/v2.0.1.sql @@ -7,7 +7,7 @@ -- add "topic" column ALTER TABLE "public"."NotificationSettings" - ADD COLUMN "topic" character varying(255); + ADD COLUMN "topic" character varying(255) NOT NULL; UPDATE "NotificationSettings" SET topic='connect.notification.project.timeline.milestone.transition.completed' WHERE "topicOld"='connect.action.timeline.milestone.transition.completed' From 20cd91a3d285acbe73c5e5a60f3ad118a6b94fff Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Mon, 19 Aug 2019 15:22:59 +0530 Subject: [PATCH 10/10] adding DB changes --- migrations/v2.0.1.sql | 38 -------------------------------------- migrations/v2.0.2.sql | 36 ++++++++++++++++++++++++++++++++++++ migrations/v2.0.3.sql | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 38 deletions(-) create mode 100644 migrations/v2.0.2.sql create mode 100644 migrations/v2.0.3.sql diff --git a/migrations/v2.0.1.sql b/migrations/v2.0.1.sql index dc77d8d..c745f07 100644 --- a/migrations/v2.0.1.sql +++ b/migrations/v2.0.1.sql @@ -8,41 +8,3 @@ -- add "topic" column ALTER TABLE "public"."NotificationSettings" ADD COLUMN "topic" character varying(255) NOT NULL; - - -UPDATE "NotificationSettings" SET topic='connect.notification.project.timeline.milestone.transition.completed' WHERE "topicOld"='connect.action.timeline.milestone.transition.completed' -UPDATE "NotificationSettings" SET topic='connect.notification.project.product.update.spec' WHERE "topicOld"='connect.action.project.product.update.spec' -UPDATE "NotificationSettings" SET topic='connect.notification.project.created' WHERE "topicOld"='notifications.connect.project.created' -UPDATE "NotificationSettings" SET topic='connect.notification.project.post.created' WHERE "topicOld"='notifications.connect.project.post.created' -UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.transition.active' WHERE "topicOld"='notifications.connect.project.phase.transition.active' -UPDATE "NotificationSettings" SET topic='connect.notification.project.approved' WHERE "topicOld"='notifications.connect.project.approved' -UPDATE "NotificationSettings" SET topic='connect.notification.project.post.edited' WHERE "topicOld"='notifications.connect.project.post.edited' -UPDATE "NotificationSettings" SET topic='connect.notification.project.plan.updated' WHERE "topicOld"='connect.action.project.plan.updated' -UPDATE "NotificationSettings" SET topic='connect.notification.project.topic.created' WHERE "topicOld"='notifications.connect.project.topic.created' -UPDATE "NotificationSettings" SET topic='connect.notification.project.member.managerJoined' WHERE "topicOld"='notifications.connect.project.member.managerJoined' -UPDATE "NotificationSettings" SET topic='connect.notification.project.specificationModified' WHERE "topicOld"='notifications.connect.project.specificationModified' -UPDATE "NotificationSettings" SET topic='connect.notification.project.canceled' WHERE "topicOld"='notifications.connect.project.canceled' -UPDATE "NotificationSettings" SET topic='connect.notification.project.active' WHERE "topicOld"='notifications.connect.project.active' -UPDATE "NotificationSettings" SET topic='connect.notification.project.updated.spec' WHERE "topicOld"='connect.action.project.updated.spec' -UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.update.payment' WHERE "topicOld"='notifications.connect.project.phase.update.payment' -UPDATE "NotificationSettings" SET topic='connect.notification.project.linkCreated' WHERE "topicOld"='notifications.connect.project.linkCreated' -UPDATE "NotificationSettings" SET topic='connect.notification.project.member.invite.rejected' WHERE "topicOld"='notifications.connect.project.member.invite.rejected' -UPDATE "NotificationSettings" SET topic='connect.notification.project.completed' WHERE "topicOld"='notifications.connect.project.completed' -UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.update.scope' WHERE "topicOld"='notifications.connect.project.phase.update.scope' -UPDATE "NotificationSettings" SET topic='connect.notification.project.member.invite.requested' WHERE "topicOld"='notifications.connect.project.member.invite.requested' -UPDATE "NotificationSettings" SET topic='connect.notification.project.paused' WHERE "topicOld"='notifications.connect.project.paused' -UPDATE "NotificationSettings" SET topic='connect.notification.project.plan.ready' WHERE "topicOld"='connect.action.project.plan.ready' -UPDATE "NotificationSettings" SET topic='connect.notification.project.member.copilotJoined' WHERE "topicOld"='notifications.connect.project.member.copilotJoined' -UPDATE "NotificationSettings" SET topic='connect.notification.project.topic.deleted' WHERE "topicOld"='notifications.connect.project.topic.deleted' -UPDATE "NotificationSettings" SET topic='connect.notification.project.submittedForReview' WHERE "topicOld"='notifications.connect.project.submittedForReview' -UPDATE "NotificationSettings" SET topic='connect.notification.project.member.invite.approved' WHERE "topicOld"='notifications.connect.project.member.invite.approved' -UPDATE "NotificationSettings" SET topic='connect.notification.project.member.assignedAsOwner' WHERE "topicOld"='notifications.connect.project.member.assignedAsOwner' -UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.transition.completed' WHERE "topicOld"='notifications.connect.project.phase.transition.completed' -UPDATE "NotificationSettings" SET topic='connect.notification.project.member.removed' WHERE "topicOld"='notifications.connect.project.member.removed' -UPDATE "NotificationSettings" SET topic='connect.notification.project.timeline.milestone.transition.active' WHERE "topicOld"='connect.action.timeline.milestone.transition.active' -UPDATE "NotificationSettings" SET topic='connect.notification.project.timeline.milestone.waiting.customer' WHERE "topicOld"='connect.action.timeline.milestone.waiting.customer' -UPDATE "NotificationSettings" SET topic='connect.notification.project.member.joined' WHERE "topicOld"='notifications.connect.project.member.joined' -UPDATE "NotificationSettings" SET topic='connect.notification.project.fileUploaded' WHERE "topicOld"='notifications.connect.project.fileUploaded' -UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.update.progress' WHERE "topicOld"='notifications.connect.project.phase.update.progress' -UPDATE "NotificationSettings" SET topic='connect.notification.project.post.deleted' WHERE "topicOld"='notifications.connect.project.post.deleted' -UPDATE "NotificationSettings" SET topic='connect.notification.project.member.left' WHERE "topicOld"='notifications.connect.project.member.left' diff --git a/migrations/v2.0.2.sql b/migrations/v2.0.2.sql new file mode 100644 index 0000000..9de9358 --- /dev/null +++ b/migrations/v2.0.2.sql @@ -0,0 +1,36 @@ +UPDATE "Notifications" SET type='connect.notification.project.timeline.milestone.transition.completed' WHERE read='f' AND type='connect.action.timeline.milestone.transition.completed'; +UPDATE "Notifications" SET type='connect.notification.project.product.update.spec' WHERE read='f' AND type='connect.action.project.product.update.spec'; +UPDATE "Notifications" SET type='connect.notification.project.created' WHERE read='f' AND type='notifications.connect.project.created'; +UPDATE "Notifications" SET type='connect.notification.project.post.created' WHERE read='f' AND type='notifications.connect.project.post.created'; +UPDATE "Notifications" SET type='connect.notification.project.phase.transition.active' WHERE read='f' AND type='notifications.connect.project.phase.transition.active'; +UPDATE "Notifications" SET type='connect.notification.project.approved' WHERE read='f' AND type='notifications.connect.project.approved'; +UPDATE "Notifications" SET type='connect.notification.project.post.edited' WHERE read='f' AND type='notifications.connect.project.post.edited'; +UPDATE "Notifications" SET type='connect.notification.project.plan.updated' WHERE read='f' AND type='connect.action.project.plan.updated'; +UPDATE "Notifications" SET type='connect.notification.project.topic.created' WHERE read='f' AND type='notifications.connect.project.topic.created'; +UPDATE "Notifications" SET type='connect.notification.project.member.managerJoined' WHERE read='f' AND type='notifications.connect.project.member.managerJoined'; +UPDATE "Notifications" SET type='connect.notification.project.specificationModified' WHERE read='f' AND type='notifications.connect.project.specificationModified'; +UPDATE "Notifications" SET type='connect.notification.project.canceled' WHERE read='f' AND type='notifications.connect.project.canceled'; +UPDATE "Notifications" SET type='connect.notification.project.active' WHERE read='f' AND type='notifications.connect.project.active'; +UPDATE "Notifications" SET type='connect.notification.project.updated.spec' WHERE read='f' AND type='connect.action.project.updated.spec'; +UPDATE "Notifications" SET type='connect.notification.project.phase.update.payment' WHERE read='f' AND type='notifications.connect.project.phase.update.payment'; +UPDATE "Notifications" SET type='connect.notification.project.linkCreated' WHERE read='f' AND type='notifications.connect.project.linkCreated'; +UPDATE "Notifications" SET type='connect.notification.project.member.invite.rejected' WHERE read='f' AND type='notifications.connect.project.member.invite.rejected'; +UPDATE "Notifications" SET type='connect.notification.project.completed' WHERE read='f' AND type='notifications.connect.project.completed'; +UPDATE "Notifications" SET type='connect.notification.project.phase.update.scope' WHERE read='f' AND type='notifications.connect.project.phase.update.scope'; +UPDATE "Notifications" SET type='connect.notification.project.member.invite.requested' WHERE read='f' AND type='notifications.connect.project.member.invite.requested'; +UPDATE "Notifications" SET type='connect.notification.project.paused' WHERE read='f' AND type='notifications.connect.project.paused'; +UPDATE "Notifications" SET type='connect.notification.project.plan.ready' WHERE read='f' AND type='connect.action.project.plan.ready'; +UPDATE "Notifications" SET type='connect.notification.project.member.copilotJoined' WHERE read='f' AND type='notifications.connect.project.member.copilotJoined'; +UPDATE "Notifications" SET type='connect.notification.project.topic.deleted' WHERE read='f' AND type='notifications.connect.project.topic.deleted'; +UPDATE "Notifications" SET type='connect.notification.project.submittedForReview' WHERE read='f' AND type='notifications.connect.project.submittedForReview'; +UPDATE "Notifications" SET type='connect.notification.project.member.invite.approved' WHERE read='f' AND type='notifications.connect.project.member.invite.approved'; +UPDATE "Notifications" SET type='connect.notification.project.member.assignedAsOwner' WHERE read='f' AND type='notifications.connect.project.member.assignedAsOwner'; +UPDATE "Notifications" SET type='connect.notification.project.phase.transition.completed' WHERE read='f' AND type='notifications.connect.project.phase.transition.completed'; +UPDATE "Notifications" SET type='connect.notification.project.member.removed' WHERE read='f' AND type='notifications.connect.project.member.removed'; +UPDATE "Notifications" SET type='connect.notification.project.timeline.milestone.transition.active' WHERE read='f' AND type='connect.action.timeline.milestone.transition.active'; +UPDATE "Notifications" SET type='connect.notification.project.timeline.milestone.waiting.customer' WHERE read='f' AND type='connect.action.timeline.milestone.waiting.customer'; +UPDATE "Notifications" SET type='connect.notification.project.member.joined' WHERE read='f' AND type='notifications.connect.project.member.joined'; +UPDATE "Notifications" SET type='connect.notification.project.fileUploaded' WHERE read='f' AND type='notifications.connect.project.fileUploaded'; +UPDATE "Notifications" SET type='connect.notification.project.phase.update.progress' WHERE read='f' AND type='notifications.connect.project.phase.update.progress'; +UPDATE "Notifications" SET type='connect.notification.project.post.deleted' WHERE read='f' AND type='notifications.connect.project.post.deleted'; +UPDATE "Notifications" SET type='connect.notification.project.member.left' WHERE read='f' AND type='notifications.connect.project.member.left'; \ No newline at end of file diff --git a/migrations/v2.0.3.sql b/migrations/v2.0.3.sql new file mode 100644 index 0000000..4ace7e8 --- /dev/null +++ b/migrations/v2.0.3.sql @@ -0,0 +1,36 @@ +UPDATE "NotificationSettings" SET topic='connect.notification.project.timeline.milestone.transition.completed' WHERE "topicOld"='connect.action.timeline.milestone.transition.completed'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.product.update.spec' WHERE "topicOld"='connect.action.project.product.update.spec'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.created' WHERE "topicOld"='notifications.connect.project.created'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.post.created' WHERE "topicOld"='notifications.connect.project.post.created'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.transition.active' WHERE "topicOld"='notifications.connect.project.phase.transition.active'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.approved' WHERE "topicOld"='notifications.connect.project.approved'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.post.edited' WHERE "topicOld"='notifications.connect.project.post.edited'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.plan.updated' WHERE "topicOld"='connect.action.project.plan.updated'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.topic.created' WHERE "topicOld"='notifications.connect.project.topic.created'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.managerJoined' WHERE "topicOld"='notifications.connect.project.member.managerJoined'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.specificationModified' WHERE "topicOld"='notifications.connect.project.specificationModified'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.canceled' WHERE "topicOld"='notifications.connect.project.canceled'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.active' WHERE "topicOld"='notifications.connect.project.active'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.updated.spec' WHERE "topicOld"='connect.action.project.updated.spec'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.update.payment' WHERE "topicOld"='notifications.connect.project.phase.update.payment'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.linkCreated' WHERE "topicOld"='notifications.connect.project.linkCreated'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.invite.rejected' WHERE "topicOld"='notifications.connect.project.member.invite.rejected'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.completed' WHERE "topicOld"='notifications.connect.project.completed'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.update.scope' WHERE "topicOld"='notifications.connect.project.phase.update.scope'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.invite.requested' WHERE "topicOld"='notifications.connect.project.member.invite.requested'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.paused' WHERE "topicOld"='notifications.connect.project.paused'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.plan.ready' WHERE "topicOld"='connect.action.project.plan.ready'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.copilotJoined' WHERE "topicOld"='notifications.connect.project.member.copilotJoined'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.topic.deleted' WHERE "topicOld"='notifications.connect.project.topic.deleted'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.submittedForReview' WHERE "topicOld"='notifications.connect.project.submittedForReview'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.invite.approved' WHERE "topicOld"='notifications.connect.project.member.invite.approved'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.assignedAsOwner' WHERE "topicOld"='notifications.connect.project.member.assignedAsOwner'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.transition.completed' WHERE "topicOld"='notifications.connect.project.phase.transition.completed'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.removed' WHERE "topicOld"='notifications.connect.project.member.removed'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.timeline.milestone.transition.active' WHERE "topicOld"='connect.action.timeline.milestone.transition.active'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.timeline.milestone.waiting.customer' WHERE "topicOld"='connect.action.timeline.milestone.waiting.customer'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.joined' WHERE "topicOld"='notifications.connect.project.member.joined'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.fileUploaded' WHERE "topicOld"='notifications.connect.project.fileUploaded'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.phase.update.progress' WHERE "topicOld"='notifications.connect.project.phase.update.progress'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.post.deleted' WHERE "topicOld"='notifications.connect.project.post.deleted'; +UPDATE "NotificationSettings" SET topic='connect.notification.project.member.left' WHERE "topicOld"='notifications.connect.project.member.left';