mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 02:56:10 +00:00
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:
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user