Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
102 lines
4.5 KiB
JavaScript
102 lines
4.5 KiB
JavaScript
/**
|
|
* Add team assignment notification subtypes and templates,
|
|
* and fix email template brand colors.
|
|
*
|
|
* Creates:
|
|
* - Internal notification subtypes: ticket-team-assigned, task-team-assigned
|
|
* - Internal notification templates for each subtype (7 languages)
|
|
* - Email notification subtype: Ticket Team Assigned
|
|
* - Email template: ticket-team-assigned (7 languages, client-facing)
|
|
*
|
|
* Fixes brand colors in 5 source-of-truth email templates:
|
|
* - projectTaskAssignedPrimary: green (#10b981) button → brand purple (#8A4DEA)
|
|
* - emailVerification: blue (#3b82f6) theme → brand purple/cyan
|
|
* - noAccountFound: legacy gradient (#667eea→#764ba2) → brand gradient
|
|
* - tenantRecovery: legacy gradient (#667eea→#764ba2) → brand gradient
|
|
* - portalInvitation: purple-only gradient → brand gradient with cyan
|
|
*
|
|
* Uses the shared source-of-truth template pattern.
|
|
*/
|
|
|
|
const { upsertCategoriesAndSubtypes } = require('./utils/templates/internal/categoriesAndSubtypes.cjs');
|
|
const { upsertInternalTemplates } = require('./utils/templates/_shared/upsertInternalTemplates.cjs');
|
|
const { TEMPLATES: TICKET_TEMPLATES } = require('./utils/templates/internal/tickets.cjs');
|
|
const { TEMPLATES: PROJECT_TEMPLATES } = require('./utils/templates/internal/projects.cjs');
|
|
const { upsertEmailCategoriesAndSubtypes } = require('./utils/templates/_shared/emailCategoriesAndSubtypes.cjs');
|
|
const { upsertEmailTemplate } = require('./utils/templates/_shared/upsertEmailTemplates.cjs');
|
|
const { getTemplate: ticketTeamAssignedEmail } = require('./utils/templates/email/tickets/ticketTeamAssigned.cjs');
|
|
|
|
// Brand-color-fix templates
|
|
const { getTemplate: projectTaskPrimary } = require('./utils/templates/email/projects/projectTaskAssignedPrimary.cjs');
|
|
const { getTemplate: emailVerification } = require('./utils/templates/email/auth/emailVerification.cjs');
|
|
const { getTemplate: noAccountFound } = require('./utils/templates/email/auth/noAccountFound.cjs');
|
|
const { getTemplate: tenantRecovery } = require('./utils/templates/email/auth/tenantRecovery.cjs');
|
|
const { getTemplate: portalInvitation } = require('./utils/templates/email/auth/portalInvitation.cjs');
|
|
|
|
const BRAND_FIX_TEMPLATES = [projectTaskPrimary, emailVerification, noAccountFound, tenantRecovery, portalInvitation];
|
|
|
|
exports.up = async function(knex) {
|
|
console.log('Adding team assignment notification subtypes and templates...');
|
|
|
|
// 1. Upsert all internal notification categories & subtypes (including new team ones)
|
|
await upsertCategoriesAndSubtypes(knex);
|
|
console.log(' ✓ Internal categories & subtypes upserted');
|
|
|
|
// 2. Upsert ticket internal templates (includes ticket-team-assigned)
|
|
await upsertInternalTemplates(knex, TICKET_TEMPLATES);
|
|
console.log(` ✓ ${TICKET_TEMPLATES.length} ticket internal notification templates upserted`);
|
|
|
|
// 3. Upsert project internal templates (includes task-team-assigned)
|
|
await upsertInternalTemplates(knex, PROJECT_TEMPLATES);
|
|
console.log(` ✓ ${PROJECT_TEMPLATES.length} project internal notification templates upserted`);
|
|
|
|
// 4. Upsert email notification categories & subtypes (includes Ticket Team Assigned)
|
|
await upsertEmailCategoriesAndSubtypes(knex);
|
|
console.log(' ✓ Email categories & subtypes upserted');
|
|
|
|
// 5. Upsert team assignment email template (client-facing)
|
|
await upsertEmailTemplate(knex, ticketTeamAssignedEmail());
|
|
console.log(' ✓ ticket-team-assigned email template upserted');
|
|
|
|
// 6. Re-upsert templates with fixed brand colors
|
|
for (const getter of BRAND_FIX_TEMPLATES) {
|
|
const def = getter();
|
|
await upsertEmailTemplate(knex, def);
|
|
console.log(` ✓ ${def.templateName} brand colors fixed`);
|
|
}
|
|
|
|
console.log('Successfully added team assignment notification templates and fixed brand colors');
|
|
};
|
|
|
|
exports.down = async function(knex) {
|
|
console.log('Removing team assignment notification templates...');
|
|
|
|
// Delete email template
|
|
await knex('system_email_templates')
|
|
.where('name', 'ticket-team-assigned')
|
|
.delete();
|
|
|
|
// Delete email subtype
|
|
await knex('notification_subtypes')
|
|
.where('name', 'Ticket Team Assigned')
|
|
.delete();
|
|
|
|
// Delete internal notification templates
|
|
await knex('internal_notification_templates')
|
|
.whereIn('name', [
|
|
'ticket-team-assigned',
|
|
'task-team-assigned'
|
|
])
|
|
.delete();
|
|
|
|
// Delete internal notification subtypes
|
|
await knex('internal_notification_subtypes')
|
|
.whereIn('name', [
|
|
'ticket-team-assigned',
|
|
'task-team-assigned'
|
|
])
|
|
.delete();
|
|
|
|
console.log('Successfully removed team assignment notification templates');
|
|
};
|