feat: scrip engine implementation — real SMTP, webhooks, DB actions

- config.ts: add SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, SMTP_FROM
- engine.ts: prepare() queries real scrips from DB, matches by queue_id + condition_type, loads lifecycle for OnResolve context, renders Handlebars templates, builds PreparedScrip. commit() dispatches to real action executors.
- actions.ts: SendEmail via nodemailer SMTP, Webhook via fetch POST, SetCustomField writes to custom_field_values table
- conditions.ts: OnResolve uses LifecycleValidator.isResolvedStatus()
- tickets.ts: updated to pass lifecycleDef context to scrip engine
- nodemailer installed
- Port changed to 9876 (8080 occupied by Apache)

Verification: bun run src/index.ts starts server, GET /health returns {"status":"ok","version":"0.1.0"}
This commit is contained in:
Gjermund Høsøien Wiggen
2026-06-07 21:38:56 +02:00
parent 1136227510
commit 1f238330c7
7 changed files with 217 additions and 48 deletions

View File

@@ -4,6 +4,11 @@ const configSchema = z.object({
DATABASE_URL: z.string().min(1),
SERVER_HOST: z.string().default('127.0.0.1'),
SERVER_PORT: z.coerce.number().int().positive().default(8080),
SMTP_HOST: z.string().default('localhost'),
SMTP_PORT: z.coerce.number().int().positive().default(587),
SMTP_USER: z.string().optional(),
SMTP_PASS: z.string().optional(),
SMTP_FROM: z.string().default('tessera@localhost'),
});
export const config = configSchema.parse(process.env);