Refactor monolithic modules and harden booking, email, and auth infrastructure.
Split oversized frontend API client, email service, and admin/booking pages into focused modules while preserving import surfaces, and add Redis-backed queues, stale booking cleanup, stronger auth, and scale deployment configs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -273,6 +273,18 @@ export const sqliteEmailSettings = sqliteTable('email_settings', {
|
||||
updatedAt: text('updated_at').notNull(),
|
||||
});
|
||||
|
||||
// Durable email queue. Jobs survive process restarts; a startup recovery step
|
||||
// resets any 'processing' rows back to 'pending'.
|
||||
export const sqliteEmailQueue = sqliteTable('email_queue', {
|
||||
id: text('id').primaryKey(),
|
||||
params: text('params').notNull(), // JSON-encoded TemplateEmailJobParams
|
||||
status: text('status', { enum: ['pending', 'processing', 'sent', 'failed'] }).notNull().default('pending'),
|
||||
attempts: integer('attempts').notNull().default(0),
|
||||
lastError: text('last_error'),
|
||||
createdAt: text('created_at').notNull(),
|
||||
processedAt: text('processed_at'),
|
||||
});
|
||||
|
||||
// Legal Pages table for admin-editable legal content
|
||||
export const sqliteLegalPages = sqliteTable('legal_pages', {
|
||||
id: text('id').primaryKey(),
|
||||
@@ -608,6 +620,18 @@ export const pgEmailSettings = pgTable('email_settings', {
|
||||
updatedAt: timestamp('updated_at').notNull(),
|
||||
});
|
||||
|
||||
// Durable email queue. Jobs survive process restarts; a startup recovery step
|
||||
// resets any 'processing' rows back to 'pending'.
|
||||
export const pgEmailQueue = pgTable('email_queue', {
|
||||
id: uuid('id').primaryKey(),
|
||||
params: pgText('params').notNull(), // JSON-encoded TemplateEmailJobParams
|
||||
status: varchar('status', { length: 20 }).notNull().default('pending'),
|
||||
attempts: pgInteger('attempts').notNull().default(0),
|
||||
lastError: pgText('last_error'),
|
||||
createdAt: timestamp('created_at').notNull(),
|
||||
processedAt: timestamp('processed_at'),
|
||||
});
|
||||
|
||||
// Legal Pages table for admin-editable legal content
|
||||
export const pgLegalPages = pgTable('legal_pages', {
|
||||
id: uuid('id').primaryKey(),
|
||||
@@ -695,6 +719,7 @@ export const auditLogs = dbType === 'postgres' ? pgAuditLogs : sqliteAuditLogs;
|
||||
export const emailTemplates = dbType === 'postgres' ? pgEmailTemplates : sqliteEmailTemplates;
|
||||
export const emailLogs = dbType === 'postgres' ? pgEmailLogs : sqliteEmailLogs;
|
||||
export const emailSettings = dbType === 'postgres' ? pgEmailSettings : sqliteEmailSettings;
|
||||
export const emailQueue = dbType === 'postgres' ? pgEmailQueue : sqliteEmailQueue;
|
||||
export const paymentOptions = dbType === 'postgres' ? pgPaymentOptions : sqlitePaymentOptions;
|
||||
export const eventPaymentOverrides = dbType === 'postgres' ? pgEventPaymentOverrides : sqliteEventPaymentOverrides;
|
||||
export const magicLinkTokens = dbType === 'postgres' ? pgMagicLinkTokens : sqliteMagicLinkTokens;
|
||||
|
||||
Reference in New Issue
Block a user