Add deterministic daily weather brief

This commit is contained in:
zv
2026-06-11 20:27:10 +02:00
parent 47a292b26e
commit 49265e7c51
16 changed files with 590 additions and 60 deletions

View File

@@ -26,6 +26,10 @@ export async function POST(request: Request) {
province?: unknown;
language?: unknown;
enabled?: unknown;
morningBriefEnabled?: unknown;
latitude?: unknown;
longitude?: unknown;
locationName?: unknown;
} | null;
const subscription = body?.subscription;
const province = normalizeProvinceName(typeof body?.province === "string" ? body.province : null);
@@ -42,6 +46,10 @@ export async function POST(request: Request) {
province,
language,
enabled: body?.enabled !== false,
morningBriefEnabled: body?.morningBriefEnabled === true,
latitude: typeof body?.latitude === "number" && Number.isFinite(body.latitude) ? body.latitude : null,
longitude: typeof body?.longitude === "number" && Number.isFinite(body.longitude) ? body.longitude : null,
locationName: typeof body?.locationName === "string" && body.locationName.trim() ? body.locationName.trim().slice(0, 80) : null,
createdAt: now,
updatedAt: now,
});