mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
fix(db): match a stay-linked booking on Postgres in the public stay check
publicStayExists cast reservations.accommodation_id straight to integer, which Postgres refuses for the stored '14.0', so the calendar feed and the share links failed for every trip once any booking was linked to a stay. The correlation now goes through accommodationIdMatches, which compares through the new dialect helper integerTextEqualsKysely, and the Wallet pass context uses the same helper instead of its own numeric cast.
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
castIntegerKysely,
|
||||
concatKysely,
|
||||
currentTimestampKysely,
|
||||
integerTextEqualsKysely,
|
||||
nowPlusSecondsKysely,
|
||||
startsWithIsoDateKysely,
|
||||
substringKysely,
|
||||
@@ -355,6 +356,26 @@ export const HELPER_CASES: readonly HelperCase[] = [
|
||||
kysely: (p, eb) => castIntegerKysely(p, eb, 'a'),
|
||||
expect: { equals: 14 },
|
||||
},
|
||||
...['14', '14.0'].map(
|
||||
(stored): HelperCase => ({
|
||||
name: `integerTextEqualsKysely matches the text ${stored} to 14`,
|
||||
row: { a: stored, n: 14 },
|
||||
kysely: (p, eb) => eb.case().when(integerTextEqualsKysely(p, eb, 'a', 'n')).then('yes').else('no').end(),
|
||||
expect: { equals: 'yes' },
|
||||
}),
|
||||
),
|
||||
{
|
||||
name: 'integerTextEqualsKysely matches the number 14 to 14',
|
||||
row: { n: 14 },
|
||||
kysely: (p, eb) => eb.case().when(integerTextEqualsKysely(p, eb, 'n', 'n')).then('yes').else('no').end(),
|
||||
expect: { equals: 'yes' },
|
||||
},
|
||||
{
|
||||
name: 'integerTextEqualsKysely tells 15.0 from 14',
|
||||
row: { a: '15.0', n: 14 },
|
||||
kysely: (p, eb) => eb.case().when(integerTextEqualsKysely(p, eb, 'a', 'n')).then('yes').else('no').end(),
|
||||
expect: { equals: 'no' },
|
||||
},
|
||||
{
|
||||
name: 'unixEpochToIsoKysely',
|
||||
row: { n: EPOCH_MS },
|
||||
|
||||
Reference in New Issue
Block a user