Describe the bug
When a user adds a new monitor (target) of category PAGE_CONTENT or PRODUCT_PRICE using the dashboard, the target creation API endpoint correctly parses the aiTriageEnabled parameter from the request but omits it in the database insertion statement. As a result, the monitor is always created with the database default value (false), ignoring the user's initial selection.
Steps to reproduce
- Attempt to add a new
PAGE_CONTENT page monitor via the /api/websites/[id]/targets POST endpoint.
- Pass
aiTriageEnabled: true in the JSON request body.
- Inspect the newly created target row in the database.
- Notice that
aiTriageEnabled is set to false.
Expected behavior
The aiTriageEnabled value should be correctly saved to the database alongside other fields like aiChangeSummaryEnabled and checkIntervalHours.
Code Location
In route.ts:L168-L180:
const targetId = newId("tgt");
await db.insert(schema.target).values({
id: targetId,
websiteId: id,
kind,
pageUrl,
watchNote,
notificationDestinationId: destId,
externalNotify: wantOutbound,
enabled: true,
checkIntervalHours,
aiChangeSummaryEnabled, // <--- missing aiTriageEnabled here!
createdAt: new Date(),
});
Describe the bug
When a user adds a new monitor (target) of category
PAGE_CONTENTorPRODUCT_PRICEusing the dashboard, the target creation API endpoint correctly parses theaiTriageEnabledparameter from the request but omits it in the database insertion statement. As a result, the monitor is always created with the database default value (false), ignoring the user's initial selection.Steps to reproduce
PAGE_CONTENTpage monitor via the/api/websites/[id]/targetsPOST endpoint.aiTriageEnabled: truein the JSON request body.aiTriageEnabledis set tofalse.Expected behavior
The
aiTriageEnabledvalue should be correctly saved to the database alongside other fields likeaiChangeSummaryEnabledandcheckIntervalHours.Code Location
In route.ts:L168-L180: