Skip to content

armgit / TREK

Public Imported from GitHub
0

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.

fix(db): keep the stay filter inside src/db and cover the flag type's missing read

Mauricee97dbc89c932
diff --git a/server/src/db/repositories/_shared/reservation-accommodation.ts b/server/src/db/repositories/_shared/reservation-accommodation.ts
index 1b46a7c6e..84343dead 100644
--- a/server/src/db/repositories/_shared/reservation-accommodation.ts
+++ b/server/src/db/repositories/_shared/reservation-accommodation.ts
@@ -1,4 +1,3 @@
-import { legacyBoundIntegerText } from '../../../nest/common/row-id';
import { integerTextEqualsKysely } from '../../dialect/kysely-functions';
import type { Platform } from '@mikro-orm/core';
@@ -37,5 +36,6 @@ export function reservationStayIs<DB, TB extends keyof DB>(
accommodationId: StringReference<DB, TB>,
stayId: number,
): ExpressionWrapper<DB, TB, SqlBool> {
- return eb(accommodationId, '=', legacyBoundIntegerText(stayId));
+ // The '<id>.0' shape of row-id.ts's legacyBoundIntegerText, spelled here because src/db sits below src/nest.
+ return eb(eb.ref(accommodationId).$castTo<string>(), '=', `${stayId}.0`);
}
diff --git a/server/tests/unit/db/types/integer-flag.type.test.ts b/server/tests/unit/db/types/integer-flag.type.test.ts
index fc11ff746..1e18b901d 100644
--- a/server/tests/unit/db/types/integer-flag.type.test.ts
+++ b/server/tests/unit/db/types/integer-flag.type.test.ts
@@ -23,6 +23,7 @@ describe('IntegerFlagType', () => {
expect(flag.convertToJSValue(0)).toBe(false);
expect(flag.convertToJSValue(true)).toBe(true);
expect(flag.convertToJSValue(null)).toBeNull();
+ expect(flag.convertToJSValue(undefined)).toBeUndefined();
});
it('INTFLAG-003: declares the integer column of the platform, which the Postgres schema widens to bigint', () => {