Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
019da4f
feat : add navigation and access rights for templates dashboard
mohammadsherif0 Dec 15, 2025
889afd4
feat : create template database table and model
mohammadsherif0 Dec 15, 2025
d2c7b50
feat : add template socket handlers for create and update operations
mohammadsherif0 Dec 15, 2025
3f4f26c
feat : add templates dashboard component with table view
mohammadsherif0 Dec 15, 2025
839ed7b
feat : add template modal component for create and edit operations
mohammadsherif0 Dec 15, 2025
aecf2fd
fix : update template socket to only include defined fields in update
mohammadsherif0 Dec 22, 2025
33bc123
style : change template dashboard buttons to gray styling
mohammadsherif0 Dec 22, 2025
9eb4bca
feat : add delete confirmation modal to templates dashboard
mohammadsherif0 Dec 22, 2025
5676f8c
feat : add hide/unhide toggle buttons to templates dashboard
mohammadsherif0 Dec 22, 2025
141e869
refactor: remove content field from template model form fields
mohammadsherif0 Dec 24, 2025
9b9b64d
feat: add template content get and edit socket handlers
mohammadsherif0 Dec 24, 2025
85fc063
feat: add edit content button to templates dashboard
mohammadsherif0 Dec 24, 2025
6ecf038
refactor: remove type immutability restriction from template modal
mohammadsherif0 Dec 24, 2025
05a1aaf
feat: add template editor support to main editor component
mohammadsherif0 Dec 24, 2025
bf3d156
feat: add template editor route
mohammadsherif0 Dec 24, 2025
434a6f5
feat: add template editor route wrapper component
mohammadsherif0 Dec 24, 2025
f1e18f5
feat: add template editor component with quill integration
mohammadsherif0 Dec 24, 2025
d8373df
feat: add template placeholder configurator sidebar
mohammadsherif0 Dec 24, 2025
6ac0780
feat: add template placeholder mapping table and model
mohammadsherif0 Dec 29, 2025
3b22f1a
feat: add study template mapping table and model
mohammadsherif0 Dec 29, 2025
5579c8e
feat: edit template model
mohammadsherif0 Dec 29, 2025
a97caab
feat: update template configurator with placeholder support and type …
mohammadsherif0 Dec 29, 2025
547759c
feat: add template placeholder CRUD handlers and template resolution …
mohammadsherif0 Dec 29, 2025
2ff9581
feat : add template selection fields to study modal
mohammadsherif0 Jan 4, 2026
bce7ccf
feat : integrate type 4 and 5 template resolutions for general docume…
mohammadsherif0 Jan 4, 2026
7b81ceb
feat : integrate email templates for study session notifications
mohammadsherif0 Jan 4, 2026
15a4d05
feat : integrate email templates for assignment notifications
mohammadsherif0 Jan 4, 2026
e0fc3ea
feat : add email template settings migration
mohammadsherif0 Jan 4, 2026
e7eca67
feat : add privacy warning for non-anonymized studies with templates
mohammadsherif0 Jan 4, 2026
24c8dee
feat : add template selection to document creation and settings
mohammadsherif0 Jan 4, 2026
18cc42e
feat : add template placeholder mapping and published field migrations
mohammadsherif0 Jan 12, 2026
7cfb022
refactor : restructure template model with getUserFilter and publishe…
mohammadsherif0 Jan 12, 2026
2dab021
feat : add template-specific filtering logic in Socket.js
mohammadsherif0 Jan 12, 2026
935da11
refactor : update template socket handlers with access control and ow…
mohammadsherif0 Jan 12, 2026
19d969d
feat : add template publishing UI with publish button and state indic…
mohammadsherif0 Jan 12, 2026
2aa55a6
refactor : determine template readOnly
mohammadsherif0 Jan 12, 2026
74e88e7
feat : add template deletion protection for templates in use
mohammadsherif0 Jan 12, 2026
d09effe
fix : route template editor back button to templates dashboard
mohammadsherif0 Jan 12, 2026
8fbae26
feat : add filterMode support for button filtering in Table component
mohammadsherif0 Jan 12, 2026
f2ad91f
refactor : remove published field from template modal form
mohammadsherif0 Jan 12, 2026
53695b6
fix : prioritize context.link over study session hash for link placeh…
mohammadsherif0 Jan 12, 2026
9ef4bb3
fix : pass link and transaction context to template resolution in aut…
mohammadsherif0 Jan 12, 2026
73d86fc
feat : add email template selection to single and bulk assignment modals
mohammadsherif0 Jan 12, 2026
9fc2848
feat : initialize study documents with template content at creation time
mohammadsherif0 Jan 12, 2026
77ee015
refactor : cleanup template-related code and remove unused logic
mohammadsherif0 Jan 12, 2026
ef03cb5
style : remove redundant comments from template-related code
mohammadsherif0 Jan 12, 2026
9a57bc9
feat : add confirmation modal for template publishing
mohammadsherif0 Jan 14, 2026
53e09b2
feat : add read-only indicator and hide placeholder sidebar for templ…
mohammadsherif0 Jan 14, 2026
68f87a1
feat : update placeholder configurations for privacy and add link pla…
mohammadsherif0 Jan 14, 2026
b30e691
feat : restrict email templates to admin-only
mohammadsherif0 Jan 14, 2026
5c8d438
feat : hide placeholder sidebar for document templates without placeh…
mohammadsherif0 Jan 14, 2026
6271a3c
feat : prevent deletion of published email templates
mohammadsherif0 Jan 14, 2026
7409376
feat : add template_edit table for draft mechanism
mohammadsherif0 Jan 16, 2026
c9f0382
feat : implement template draft save mechanism in socket handlers
mohammadsherif0 Jan 16, 2026
195ed82
feat : emit templateClose on editor unmount to trigger draft save
mohammadsherif0 Jan 16, 2026
c8169a1
feat : add email template settings for session start, finish, assignm…
mohammadsherif0 Jan 18, 2026
b62604f
feat : add enableEmailNotifications column to study
mohammadsherif0 Jan 18, 2026
2e04fc6
feat : add placeholderDescription to template_placeholder_mapping
mohammadsherif0 Jan 18, 2026
0fe008a
feat : add emailHelper and type aware placeholder resolution in templ…
mohammadsherif0 Jan 18, 2026
534c161
feat : send session start and finish emails via settings and enableEm…
mohammadsherif0 Jan 18, 2026
ea4c6ef
feat : send study closed email on single and bulk close
mohammadsherif0 Jan 18, 2026
74b0e43
feat : send assignment emails via settings and enableEmailNotification
mohammadsherif0 Jan 18, 2026
95b8ab6
feat : switch study to enableEmailNotifications and remove per-study …
mohammadsherif0 Jan 18, 2026
a158165
fix : apply template getUserFilter in table refresh broadcast
mohammadsherif0 Jan 18, 2026
9867b32
feat : add prependNone option to Select
mohammadsherif0 Jan 18, 2026
c503e65
feat : filter email template settings by template type
mohammadsherif0 Jan 18, 2026
3fb37b0
feat : add enableEmailNotifications badge to study table
mohammadsherif0 Jan 18, 2026
c621064
feat : replace assignment email template select with enableEmailNotif…
mohammadsherif0 Jan 18, 2026
0148191
feat : update type 2 placeholders and use placeholderDescription in t…
mohammadsherif0 Jan 18, 2026
c91f1f3
feat: add document template options to editor step document dropdown
mohammadsherif0 Jan 26, 2026
8f9d924
feat: support per-step document template selection in study creation
mohammadsherif0 Jan 26, 2026
8acb1f4
refactor: remove study-level document template field and add study cl…
mohammadsherif0 Jan 26, 2026
5447eeb
feat: add type 6 email template support for study close
mohammadsherif0 Jan 26, 2026
6226d33
feat: add study close email notifications with toggle
mohammadsherif0 Jan 26, 2026
8c202a7
feat: add placeholder mappings for type 6 email templates
mohammadsherif0 Jan 26, 2026
13f6c0a
fix: remove study-closed references from type 2 placeholder descriptions
mohammadsherif0 Jan 26, 2026
e9423e0
fix: update study closed setting description to reference type 6
mohammadsherif0 Jan 26, 2026
e6e6749
docs: clarify enableEmailNotifications scope in migration comment
mohammadsherif0 Jan 26, 2026
5936d9d
fix: prevent finishing sessions when study is closed
mohammadsherif0 Jan 26, 2026
b4eb814
refactor: fetch template placeholders from backend only no hardcoded …
mohammadsherif0 Jan 26, 2026
c3d0e53
feat: add migration to transform placeholder descriptions to short su…
mohammadsherif0 Jan 27, 2026
84a774b
feat: add formhelp tooltips to placeholder sidebar
mohammadsherif0 Jan 27, 2026
c6ce5cf
feat: add collapsible component for form sections
mohammadsherif0 Jan 27, 2026
57f0c0f
refactor: reorder study fields and mark optional fields as advanced
mohammadsherif0 Jan 27, 2026
04a9bfb
feat: add advanced fields grouping support to basicform
mohammadsherif0 Jan 27, 2026
c782864
feat: add migrations for template multi-language support
mohammadsherif0 Jan 30, 2026
d9db623
feat: add template_language_content model and extend template and tem…
mohammadsherif0 Jan 30, 2026
8527adc
feat: add template multi-language socket events
mohammadsherif0 Jan 30, 2026
267a2de
feat: resolve template content by language
mohammadsherif0 Jan 30, 2026
6ba491e
feat: set initial content for defaultLanguage when creating template
mohammadsherif0 Jan 30, 2026
9d5cfe8
feat: add language selector and multi-language editing to template ed…
mohammadsherif0 Jan 30, 2026
066add8
docs: add developer templates documentation
mohammadsherif0 Feb 7, 2026
959cc4b
docs: add researcher templates documentation
mohammadsherif0 Feb 7, 2026
70bdbca
refactor: consolidate template and study email migrations
mohammadsherif0 Feb 14, 2026
1d88499
fix: filter form refs in validate to skip missing or non-validating refs
mohammadsherif0 Feb 14, 2026
4c3221b
fix: emit effective documentId for steps linked via workflowStepDocument
mohammadsherif0 Feb 14, 2026
7ee1fa8
fix: pass enableEmailNotification in bulk assignment and ignore null …
mohammadsherif0 Feb 14, 2026
efa4c75
fix: send session start email only on new session or first-time start
mohammadsherif0 Feb 14, 2026
82d80f0
refactor: load template placeholders from template_placeholder_mapping
mohammadsherif0 Feb 14, 2026
29ae1fb
feat: add studyClose socket event and send study closed emails
mohammadsherif0 Feb 14, 2026
d64e402
refactor: use studyClose and studySessionFinish socket events and rem…
mohammadsherif0 Feb 14, 2026
5f13755
feat: add sourceId to template table
mohammadsherif0 Feb 15, 2026
ea3bf8c
feat: add template copy and update-from-source logic in model
mohammadsherif0 Feb 15, 2026
5c53c39
feat: add template copy and update-from-source socket handlers
mohammadsherif0 Feb 15, 2026
b4bdeab
feat: guard template updates for copies and strip sourceId in appData…
mohammadsherif0 Feb 15, 2026
7a0df5f
feat: extend broadcast filter for template source updates
mohammadsherif0 Feb 15, 2026
897d7fe
feat: show own templates only and copy status in dashboard
mohammadsherif0 Feb 15, 2026
09c9db1
feat: add PublicTemplatesModal for browsing and copying public templates
mohammadsherif0 Feb 15, 2026
2f58ce5
feat: show email vs document visibility in publish modal
mohammadsherif0 Feb 15, 2026
5455071
feat: enforce read-only for copied templates in editor
mohammadsherif0 Feb 15, 2026
d3f7f52
feat: filter template type options for non-admin in template modal
mohammadsherif0 Feb 15, 2026
8003573
feat: filter template dropdowns to user templates only
mohammadsherif0 Feb 15, 2026
f793958
feat: subscribe to template table in Settings, Documents and Study
mohammadsherif0 Feb 15, 2026
6cbd406
feat : sync template copy metadata from source on retrieve
mohammadsherif0 Feb 21, 2026
25bd407
feat : show language selector in read-only template editor
mohammadsherif0 Feb 21, 2026
fd8f156
feat : restrict template default language edit to languages with cont…
mohammadsherif0 Feb 21, 2026
c6ff7aa
refactor: remove enable study close emails from study create/edit for…
mohammadsherif0 Feb 24, 2026
931352d
feat: add study close modal with notify sessions checkbox
mohammadsherif0 Feb 24, 2026
8558e72
feat: add notify sessions checkbox to bulk close modal
mohammadsherif0 Feb 24, 2026
8b0a4c2
feat: support notifySessions in study close and closeBulk handlers
mohammadsherif0 Feb 24, 2026
c7a6c35
refactor: use async fs.writeFile
mohammadsherif0 Feb 24, 2026
c95145f
feat: add template detach and extend copy with detachTemplateId
mohammadsherif0 Feb 25, 2026
c6c4a23
feat: add TemplateDetachModal for edit copy warning
mohammadsherif0 Feb 25, 2026
2e1ee3e
feat: add TemplateUpdateModal for source update available
mohammadsherif0 Feb 25, 2026
6506d6a
refactor: add edit content for copies and source-updated modal in Tem…
mohammadsherif0 Feb 25, 2026
659fbb3
fix: show full toolbar on first edit after template detach
mohammadsherif0 Feb 25, 2026
4a6f2e8
refactor: remove redundant code block
mohammadsherif0 Mar 2, 2026
ff251ca
refactor: move template deletion to dedicated templateDelete socket
mohammadsherif0 Mar 4, 2026
fb7a7ad
refactor: remove unused study_template_mapping table and model
mohammadsherif0 Mar 4, 2026
3a31cc3
refactor: remove unused enableStudyCloseEmails field and force parameter
mohammadsherif0 Mar 4, 2026
8543821
refactor: clarify email notification toggle label and column name
mohammadsherif0 Mar 4, 2026
c2e0734
Merge branch 'dev' into feat-44-template_dashboard
bingobongomann Mar 6, 2026
731e4d8
feat : mark required email template placeholders in migration
mohammadsherif0 Mar 8, 2026
bf21924
feat : validate required placeholders on template save and return mis…
mohammadsherif0 Mar 8, 2026
632ad5d
feat : block template route leave and language switch when save fails
mohammadsherif0 Mar 8, 2026
afaf406
feat : show asterisk for required placeholders in template configurator
mohammadsherif0 Mar 8, 2026
9448797
fix : send template-based emails as HTML with clickable links
mohammadsherif0 Mar 8, 2026
0e2da97
refactor: generalize template placeholder and content models
mohammadsherif0 Mar 12, 2026
d698226
docs: add author metadata to email helper
mohammadsherif0 Mar 12, 2026
acbad27
feat: apply templates to documents via shared helper
mohammadsherif0 Mar 12, 2026
d288c61
feat: subscribe template route to template table
mohammadsherif0 Mar 12, 2026
b3e76d7
feat: wire document template selection into study step choice field
mohammadsherif0 Mar 12, 2026
14ac6a2
refactor: use placeholder and template_content models
mohammadsherif0 Mar 12, 2026
0b5bbbe
feat: copy template edit history when duplicating and updating from s…
mohammadsherif0 Mar 12, 2026
d4f41e3
refactor: variable naming and readability
mohammadsherif0 Mar 15, 2026
e627b71
feat: read default email content from disk when no template is set
mohammadsherif0 Mar 15, 2026
5511264
fix: do not return success in template editContent
mohammadsherif0 Mar 15, 2026
904b63a
feat: subscribe to template table where used and use 0 for no templat…
mohammadsherif0 Mar 15, 2026
1b67e42
fix: show placeholder sidebar after template create by waiting for st…
mohammadsherif0 Mar 15, 2026
897b3b9
fix: show placeholder sidebar after create/detach by waiting for stor…
mohammadsherif0 Mar 15, 2026
4ae494b
fix: render template editor only after template is loaded
mohammadsherif0 Mar 16, 2026
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
'use strict';

const navElements=[
{
name: "Templates",
groupId: "Default",
icon: "file-earmark-ruled",
order: 14,
admin: false,
path: "templates",
component: "Templates",
},
];

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.bulkInsert(
"nav_element",
await Promise.all(
navElements.map(async (t) => {
const groupId = await queryInterface.rawSelect(
"nav_group",
{
where: { name: t.groupId },
},
["id"]
);

t["createdAt"] = new Date();
t["updatedAt"] = new Date();
t["groupId"] = groupId;

return t;
}),
{}
)
);
},

async down (queryInterface, Sequelize) {
await queryInterface.bulkDelete(
"nav_element",
{
name: navElements.map((t) => t.name),
},
{}
);
}
};
33 changes: 33 additions & 0 deletions backend/db/migrations/20251210095029-extend-user_rights.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';

const userRights=[
{
name: "frontend.dashboard.templates.view",
description: "access to view templates in the dashboard",
},
];

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.bulkInsert(
"user_right",
userRights.map((right) => {
right["createdAt"] = new Date();
right["updatedAt"] = new Date();
return right;
}),
{}
);
},

async down(queryInterface, Sequelize) {
await queryInterface.bulkDelete(
"user_right",
{
name: userRights.map((r) => r.name),
},
{}
);
},
};
44 changes: 44 additions & 0 deletions backend/db/migrations/20251210095035-extend-role_rights.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
'use strict';

const roleRights=[
{
role:"user",
userRightName:"frontend.dashboard.templates.view"
}
]

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
const userRoles = await queryInterface.sequelize.query(
'SELECT id, name FROM "user_role"',
{
type: queryInterface.sequelize.QueryTypes.SELECT,
}
);

const roleNameIdMapping = userRoles.reduce((acc, role) => {
acc[role.name] = role.id;
return acc;
}, {});

await queryInterface.bulkInsert(
"role_right_matching",
roleRights.map((right) => ({
userRoleId: roleNameIdMapping[right.role],
userRightName: right.userRightName,
createdAt: new Date(),
updatedAt: new Date(),
})),
{}
);
},

async down(queryInterface, Sequelize) {
await queryInterface.bulkDelete(
"role_right_matching",
{ userRightName: roleRights.map((r) => r.userRightName) },
{}
);
},
};
75 changes: 75 additions & 0 deletions backend/db/migrations/20251210121131-create-template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('template', {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true,
allowNull: false,
},
name: {
type: Sequelize.STRING,
allowNull: false,
},
description: {
type: Sequelize.TEXT,
allowNull: false,
},
userId: {
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: 'user',
key: 'id',
},
onUpdate: 'CASCADE',
},
published: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why it is published and not public?

type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: false,
},
type: {
type: Sequelize.INTEGER,
allowNull: false,
},
sourceId: {
type: Sequelize.INTEGER,
allowNull: true,
defaultValue: null,
},
defaultLanguage: {
type: Sequelize.STRING,
allowNull: false,
defaultValue: 'en',
},
deleted: {
type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: false,
},
deletedAt: {
type: Sequelize.DATE,
allowNull: true,
defaultValue: null,
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.fn('NOW'),
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.fn('NOW'),
},
});
},

async down(queryInterface, Sequelize) {
await queryInterface.dropTable('template');
},
};
106 changes: 106 additions & 0 deletions backend/db/migrations/20251227183831-create-placeholder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
'use strict';

/**
* Create placeholder table and seed placeholder definitions
* for all placeholder types (currently template email types).
*
* @type {import('sequelize-cli').Migration}
*/

const placeholders = [
// Type 1: Email - General
{ type: 1, placeholderKey: 'username', placeholderLabel: 'Recipient username', placeholderType: 'text', placeholderDescription: 'Username of the email recipient.' },
{ type: 1, placeholderKey: 'firstName', placeholderLabel: 'Recipient first name', placeholderType: 'text', placeholderDescription: 'First name of the email recipient.' },
{ type: 1, placeholderKey: 'lastName', placeholderLabel: 'Recipient last name', placeholderType: 'text', placeholderDescription: 'Last name of the email recipient.' },
{ type: 1, placeholderKey: 'link', placeholderLabel: 'Link', placeholderType: 'link', placeholderDescription: 'Action link in the email (e.g. reset or verification URL).', required: true },

// Type 2: Email - Study Session
{ type: 2, placeholderKey: 'username', placeholderLabel: 'Recipient username', placeholderType: 'text', placeholderDescription: 'Submission owner receiving this session email.' },
{ type: 2, placeholderKey: 'link', placeholderLabel: 'Review link', placeholderType: 'link', placeholderDescription: 'Link to open the review in read-only mode.', required: true },

// Type 3: Email - Assignment
{ type: 3, placeholderKey: 'username', placeholderLabel: 'Recipient username', placeholderType: 'text', placeholderDescription: 'Username of the assigned reviewer.' },
{ type: 3, placeholderKey: 'assignmentType', placeholderLabel: 'Assignment type', placeholderType: 'text', placeholderDescription: 'Whether the assignment is document or submission.' },
{ type: 3, placeholderKey: 'assignmentName', placeholderLabel: 'Assignment name', placeholderType: 'text', placeholderDescription: 'Name of the assignment or study.' },
{ type: 3, placeholderKey: 'link', placeholderLabel: 'Assignment link', placeholderType: 'link', placeholderDescription: 'Link to start the assigned review session.', required: true },

// Type 6: Email - Study Close
{ type: 6, placeholderKey: 'username', placeholderLabel: 'Recipient username', placeholderType: 'text', placeholderDescription: 'Username of the session owner with an open session at study close.' },
{ type: 6, placeholderKey: 'studyName', placeholderLabel: 'Study name', placeholderType: 'text', placeholderDescription: 'Name of the study that was closed.', required: true },
];

module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('placeholder', {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true,
allowNull: false,
},
type: {
type: Sequelize.INTEGER,
allowNull: false,
},
placeholderKey: {
type: Sequelize.STRING,
allowNull: false,
},
placeholderLabel: {
type: Sequelize.STRING,
allowNull: false,
},
placeholderType: {
type: Sequelize.STRING,
allowNull: false,
},
placeholderDescription: {
type: Sequelize.TEXT,
allowNull: true,
},
required: {
type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: false,
},
deleted: {
type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: false,
},
deletedAt: {
type: Sequelize.DATE,
allowNull: true,
defaultValue: null,
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.fn('NOW'),
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.fn('NOW'),
},
});

// Seed placeholder definitions
await queryInterface.bulkInsert(
'placeholder',
placeholders.map((p) => ({
...p,
required: p.required === true,
deleted: false,
deletedAt: null,
createdAt: new Date(),
updatedAt: new Date(),
})),
{}
);
},

async down(queryInterface, Sequelize) {
await queryInterface.dropTable('placeholder');
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
'use strict';

/** @type {import('sequelize-cli').Migration} */

const settings = [
{
key: "email.template.passwordReset",
value: "",
type: "number",
description: "Template type for password reset emails (Email - General). Leave empty to use default hardcoded email."
},
{
key: "email.template.verification",
value: "",
type: "number",
description: "Template type for email verification emails (Email - General). Leave empty to use default hardcoded email."
},
{
key: "email.template.registration",
value: "",
type: "number",
description: "Template type for registration welcome emails (Email - General). Leave empty to use default hardcoded email."
},
{
key: "email.template.sessionStart",
value: "",
type: "number",
description: "Template type for session start emails (Email - Study Session). Leave empty to use default hardcoded email."
},
{
key: "email.template.sessionFinish",
value: "",
type: "number",
description: "Template type for session finish emails (Email - Study Session). Leave empty to use default hardcoded email."
},
{
key: "email.template.assignment",
value: "",
type: "number",
description: "Template type for assignment notification emails (Email - Assignment). Leave empty to use default hardcoded email."
},
{
key: "email.template.studyClosed",
value: "",
type: "number",
description: "Template type for study closed emails (Email - Study Close). Leave empty to use default hardcoded email."
},
];

module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.bulkInsert(
'setting',
settings.map((t) => ({
...t,
createdAt: new Date(),
updatedAt: new Date(),
})),
{ returning: true }
);
},

async down(queryInterface, Sequelize) {
await queryInterface.bulkDelete(
"setting",
{ key: settings.map((t) => t.key) },
{}
);
},
};
Loading