fix: scrip engine condition matching and ticket GET endpoint
- engine.ts: remove transaction_type-based scrip filtering. Now uses condition evaluator exclusively (matching by scrip.condition_type against transaction types was incorrect — 'OnResolve' ≠ 'StatusChange'). All non-disabled, queue-matching scrips are evaluated. - tickets.ts: fix GET /:id — replace broken Drizzle 'with' relation with manual CF join. Set up Drizzle relations needed for proper schema typing (customFieldValues → customFields).
This commit is contained in:
@@ -46,8 +46,6 @@ export class ScripEngine {
|
||||
return [];
|
||||
}
|
||||
|
||||
const transactionTypes = [...new Set(transactions.map((tx) => tx.transaction_type))];
|
||||
|
||||
const allScrips = await this.db.query.scrips.findMany({
|
||||
orderBy: asc(scrips.sort_order),
|
||||
});
|
||||
@@ -55,7 +53,6 @@ export class ScripEngine {
|
||||
const matchingScrips = allScrips.filter((scrip) => {
|
||||
if (scrip.disabled) return false;
|
||||
if (scrip.queue_id !== null && scrip.queue_id !== ticketRecord.queue_id) return false;
|
||||
if (!transactionTypes.includes(scrip.condition_type)) return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user