sms updates

This commit is contained in:
2026-02-27 15:02:28 -07:00
parent 9f9244df32
commit 06ce9dac1b
22 changed files with 1983 additions and 211 deletions

View File

@@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "site_settings" ADD COLUMN "sms_shift_reminder_hours" INTEGER NOT NULL DEFAULT 24,
ADD COLUMN "sms_shift_reminders" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "sms_shift_signup_confirm" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "sms_volunteer_welcome" BOOLEAN NOT NULL DEFAULT false;

View File

@@ -916,6 +916,12 @@ model SiteSettings {
notifyVolunteerShiftReminder Boolean @default(true)
notifyVolunteerShiftThankYou Boolean @default(true)
// SMS notification settings
smsShiftReminders Boolean @default(false) @map("sms_shift_reminders")
smsShiftReminderHours Int @default(24) @map("sms_shift_reminder_hours")
smsShiftSignupConfirm Boolean @default(false) @map("sms_shift_signup_confirm")
smsVolunteerWelcome Boolean @default(false) @map("sms_volunteer_welcome")
// Re-engagement settings
notifyVolunteerReengagement Boolean @default(false) @map("notify_volunteer_reengagement")
reengagementInactiveDays Int @default(30) @map("reengagement_inactive_days")

View File

@@ -464,6 +464,9 @@ async function main() {
console.warn('⚠️ No admin user found - skipping email template seeding');
}
// Seed SMS notification templates
await seedSmsNotificationTemplates();
// Seed pre-made gallery ads (all inactive by default — admin enables manually)
await seedGalleryAds();
@@ -852,6 +855,56 @@ async function seedEmailTemplates(admin: { id: string; email: string }) {
console.log(`Email templates seeded: ${seededCount} created, ${skippedCount} skipped`);
}
/**
* Seed default SMS notification templates
*/
async function seedSmsNotificationTemplates() {
console.log('Seeding SMS notification templates...');
const templates = [
{
name: 'shift-reminder',
template: 'Hi {name}, reminder: {shiftTitle} is tomorrow at {shiftTime}. Location: {shiftLocation}',
description: 'Sent before a volunteer shift as a reminder',
category: 'notification',
},
{
name: 'shift-signup-confirm',
template: "Hi {name}, you're signed up for {shiftTitle} on {shiftDate} at {shiftTime}. See you there!",
description: 'Sent when a volunteer signs up for a shift',
category: 'notification',
},
{
name: 'volunteer-welcome',
template: 'Welcome to the team, {name}! Thanks for signing up as a volunteer.',
description: 'Sent when a new volunteer account is created',
category: 'notification',
},
];
let seeded = 0;
let skipped = 0;
for (const t of templates) {
const existing = await prisma.smsMessageTemplate.findFirst({ where: { name: t.name } });
if (existing) {
skipped++;
continue;
}
await prisma.smsMessageTemplate.create({
data: {
name: t.name,
template: t.template,
description: t.description,
category: t.category,
},
});
seeded++;
}
console.log(`SMS notification templates seeded: ${seeded} created, ${skipped} skipped`);
}
/**
* Seed pre-made gallery ads
*/