Allow nightly analytics fanout runs
This commit is contained in:
@@ -21,8 +21,15 @@ export function v1AnalyticsRoutes() {
|
||||
|
||||
app.post("/nightly/run", async (c) => {
|
||||
const userId = c.get("userId");
|
||||
const body = z.object({ date: z.string().optional(), userId: z.string().optional() }).parse(await c.req.json().catch(() => ({})));
|
||||
return c.json(await v1AnalyticsActor.runNightly({ date: body.date ?? new Date().toISOString().slice(0, 10), userId: body.userId ?? userId }));
|
||||
const body = z.object({
|
||||
date: z.string().optional(),
|
||||
userId: z.string().optional(),
|
||||
runForAll: z.boolean().optional(),
|
||||
}).parse(await c.req.json().catch(() => ({})));
|
||||
return c.json(await v1AnalyticsActor.runNightly({
|
||||
date: body.date ?? new Date().toISOString().slice(0, 10),
|
||||
userId: body.runForAll ? undefined : (body.userId ?? userId),
|
||||
}));
|
||||
});
|
||||
|
||||
return app;
|
||||
|
||||
Reference in New Issue
Block a user