From eac145f45e1b4b2514a6fab4749265dad8a341dd Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Mon, 29 Jul 2019 18:14:44 +0530 Subject: [PATCH 1/5] 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 2/5] 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 3/5] 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 4/5] 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 5/5] 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]}}