fix(live-log): prevent freeze without GPS and prompt for day-start position
Harden geolocation with watchdog timeouts and permission checks so desktop browsers without GPS no longer hang Live-Log. Show a hint to log a position when none exists for the day. Return 503 when crew-pool Prisma models are missing instead of crashing. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { prisma } from '../db.js'
|
||||
|
||||
/** Prisma client includes delegates only after `npx prisma generate` on the current schema. */
|
||||
export function hasCrewPoolPrismaModels(): boolean {
|
||||
const client = prisma as unknown as {
|
||||
personPayload?: { findMany: unknown }
|
||||
logbookCrewSelectionPayload?: { findUnique: unknown }
|
||||
}
|
||||
return (
|
||||
typeof client.personPayload?.findMany === 'function' &&
|
||||
typeof client.logbookCrewSelectionPayload?.findUnique === 'function'
|
||||
)
|
||||
}
|
||||
|
||||
export const CREW_POOL_MIGRATION_HINT =
|
||||
'Crew-Pool-Datenbank fehlt. Im Ordner server ausführen: npx prisma generate && npx prisma db push — danach Server neu starten.'
|
||||
|
||||
export function isMissingPrismaTable(error: unknown): boolean {
|
||||
return (
|
||||
typeof error === 'object' &&
|
||||
error !== null &&
|
||||
'code' in error &&
|
||||
(error as { code: string }).code === 'P2021'
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user