Add deterministic daily weather brief
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user