From e97dbc89c9322257df1433ec2df2b5e2dd3f5539 Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 17 Nov 2026 15:33:15 +0100 Subject: [PATCH] fix(db): keep the stay filter inside src/db and cover the flag type's missing read src/db may not import src/nest, so the '.0' shape is spelled where the filter is. The flag type's undefined read had no test, which left the types folder below its branch threshold. --- .../src/db/repositories/_shared/reservation-accommodation.ts | 4 ++-- server/tests/unit/db/types/integer-flag.type.test.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) 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( accommodationId: StringReference, stayId: number, ): ExpressionWrapper { - return eb(accommodationId, '=', legacyBoundIntegerText(stayId)); + // The '.0' shape of row-id.ts's legacyBoundIntegerText, spelled here because src/db sits below src/nest. + return eb(eb.ref(accommodationId).$castTo(), '=', `${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', () => {