The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(db): type the integer flag and the owner literal for the server's compiler
Maurice579df97bba93
diff --git a/server/src/db/repositories/Trips.repository.ts b/server/src/db/repositories/Trips.repository.tsindex dc5544f84..978d30f27 100644--- a/server/src/db/repositories/Trips.repository.ts+++ b/server/src/db/repositories/Trips.repository.ts@@ -800,12 +800,12 @@ export class TripsRepository extends TrekRepository<Trips> {const owner = this.kysely<TravellerUsernameKyselyDB>().selectFrom('trips as t').innerJoin('users as u', 'u.id', 't.user_id')- .select((eb) => ['u.username as username', eb.lit(1).as('is_owner')])+ .select((eb) => ['u.username as username', eb.lit(1).$castTo<number>().as('is_owner')]).where('t.id', '=', trip_id);const member = this.kysely<TravellerUsernameKyselyDB>().selectFrom('trip_members as m').innerJoin('users as u', 'u.id', 'm.user_id')- .select((eb) => ['u.username as username', eb.lit(0).as('is_owner')])+ .select((eb) => ['u.username as username', eb.lit(0).$castTo<number>().as('is_owner')]).where('m.trip_id', '=', trip_id);const rows = await owner.unionAll(member).orderBy('is_owner', 'desc').execute();return rows as TravellerUsernameRow[];diff --git a/server/src/db/types/integer-flag.type.ts b/server/src/db/types/integer-flag.type.tsindex 05e7a8ee4..055257ae5 100644--- a/server/src/db/types/integer-flag.type.ts+++ b/server/src/db/types/integer-flag.type.ts@@ -18,13 +18,17 @@ type FlagColumn = number | null | undefined;*/export class IntegerFlagType extends Type<FlagValue, FlagColumn> {override convertToDatabaseValue(value: FlagValue): FlagColumn {- if (value === null || value === undefined) return value;+ // Spelled out: the server compiles without strictNullChecks, where returning the narrowed `value` keeps its full type.+ if (value === null) return null;+ if (value === undefined) return undefined;return value ? 1 : 0;}/** 0/1 from either driver (Postgres's `bigint` reads as a number); a boolean from a value set in JS passes through. */override convertToJSValue(value: FlagColumn | boolean): FlagValue {- if (value === null || value === undefined) return value;+ // Spelled out: the server compiles without strictNullChecks, where returning the narrowed `value` keeps its full type.+ if (value === null) return null;+ if (value === undefined) return undefined;return Boolean(Number(value));}