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 '<id>.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.
This commit is contained in:
Maurice
2026-11-17 15:33:15 +01:00
parent 76dfbe0a00
commit e97dbc89c9
2 changed files with 3 additions and 2 deletions
@@ -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`);
}
@@ -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', () => {