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
51 lines
3.0 KiB
JavaScript
51 lines
3.0 KiB
JavaScript
/**
|
|
* Add appointment-assigned-technician email + internal notification templates.
|
|
*
|
|
* Email: sent to the assigned technician when an appointment request is approved,
|
|
* including an ICS calendar attachment.
|
|
* Internal: in-app notification for the assigned technician.
|
|
*/
|
|
|
|
const { upsertEmailCategoriesAndSubtypes } = require('./utils/templates/_shared/emailCategoriesAndSubtypes.cjs');
|
|
const { upsertEmailTemplate } = require('./utils/templates/_shared/upsertEmailTemplates.cjs');
|
|
const { upsertCategoriesAndSubtypes } = require('./utils/templates/internal/categoriesAndSubtypes.cjs');
|
|
const { upsertInternalTemplates } = require('./utils/templates/_shared/upsertInternalTemplates.cjs');
|
|
const { getTemplate: apptAssignedTech } = require('./utils/templates/email/appointments/appointmentAssignedTechnician.cjs');
|
|
|
|
// Only the new internal template
|
|
const INTERNAL_TEMPLATE = {
|
|
templateName: 'appointment-assigned-technician',
|
|
subtypeName: 'appointment-assigned-technician',
|
|
translations: {
|
|
en: { title: 'New Appointment Assigned', message: 'You have been assigned an appointment for {{serviceName}} on {{appointmentDate}} at {{appointmentTime}}. Client: {{clientName}}.' },
|
|
fr: { title: 'Nouveau rendez-vous assigné', message: 'Un rendez-vous pour {{serviceName}} le {{appointmentDate}} à {{appointmentTime}} vous a été assigné. Client : {{clientName}}.' },
|
|
es: { title: 'Nueva cita asignada', message: 'Se le ha asignado una cita para {{serviceName}} el {{appointmentDate}} a las {{appointmentTime}}. Cliente: {{clientName}}.' },
|
|
de: { title: 'Neuer Termin zugewiesen', message: 'Ihnen wurde ein Termin für {{serviceName}} am {{appointmentDate}} um {{appointmentTime}} zugewiesen. Kunde: {{clientName}}.' },
|
|
nl: { title: 'Nieuwe afspraak toegewezen', message: 'Er is een afspraak voor {{serviceName}} op {{appointmentDate}} om {{appointmentTime}} aan u toegewezen. Klant: {{clientName}}.' },
|
|
it: { title: 'Nuovo appuntamento assegnato', message: 'Ti è stato assegnato un appuntamento per {{serviceName}} il {{appointmentDate}} alle {{appointmentTime}}. Cliente: {{clientName}}.' },
|
|
pl: { title: 'Nowa wizyta przypisana', message: 'Przypisano Ci wizytę na {{serviceName}} w dniu {{appointmentDate}} o {{appointmentTime}}. Klient: {{clientName}}.' },
|
|
},
|
|
};
|
|
|
|
exports.up = async function (knex) {
|
|
// 1. Email template: categories, subtypes, and template
|
|
await upsertEmailCategoriesAndSubtypes(knex);
|
|
await upsertEmailTemplate(knex, apptAssignedTech());
|
|
console.log(' ✓ appointment-assigned-technician email template added');
|
|
|
|
// 2. Internal notification: categories, subtypes, and template
|
|
await upsertCategoriesAndSubtypes(knex);
|
|
await upsertInternalTemplates(knex, [INTERNAL_TEMPLATE]);
|
|
console.log(' ✓ appointment-assigned-technician internal notification template added');
|
|
};
|
|
|
|
exports.down = async function (knex) {
|
|
await knex('system_email_templates')
|
|
.where({ name: 'appointment-assigned-technician' })
|
|
.del();
|
|
|
|
await knex('internal_notification_templates')
|
|
.where({ name: 'appointment-assigned-technician' })
|
|
.del();
|
|
};
|