From 1015c9b3f05e849fd3a498f3bcdad8a711fce75e Mon Sep 17 00:00:00 2001 From: adithya_dinesh Date: Mon, 19 Feb 2024 16:42:58 +0530 Subject: [PATCH] Katha #1216 - In the update session email 'Duration' is updating in the original details when user updated the session time. --- ...103552-update-mentor-session-reschedule.js | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/database/migrations/20240219103552-update-mentor-session-reschedule.js diff --git a/src/database/migrations/20240219103552-update-mentor-session-reschedule.js b/src/database/migrations/20240219103552-update-mentor-session-reschedule.js new file mode 100644 index 000000000..773269fea --- /dev/null +++ b/src/database/migrations/20240219103552-update-mentor-session-reschedule.js @@ -0,0 +1,37 @@ +'use strict' + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId + if (!defaultOrgId) { + throw new Error('Default org ID is undefined. Please make sure it is set in sequelize options.') + } + // update the body correct the end date and time + let updateData = { + body: '

Dear {name},

Please note that the Mentor has rescheduled the session - {sessionTitle} from {oldStartDate} {oldStartTime} - {oldEndDate} {oldEndTime} to {newStartDate} {newStartTime} - {newEndDate} {newEndTime} Please make note of the changes.', + } + let updateFilter = { + code: 'mentor_session_reschedule', + organization_id: defaultOrgId, + } + // Update operation + let check = await queryInterface.bulkUpdate('notification_templates', updateData, updateFilter) + }, + + async down(queryInterface, Sequelize) { + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId + if (!defaultOrgId) { + throw new Error('Default org ID is undefined. Please make sure it is set in sequelize options.') + } + let updateData = { + body: '

Dear {name},

Please note that the Mentor has rescheduled the session - {sessionTitle} from {oldStartDate} {oldStartTime} - {oldEndDate} {oldEndTime} to {newStartDate} {newStartTime} - {newStartDate} {newStartTime} Please make note of the changes.', + } + let updateFilter = { + code: 'mentor_session_reschedule', + organization_id: defaultOrgId, + } + // Update operation + let check = await queryInterface.bulkUpdate('notification_templates', updateData, updateFilter) + }, +}