diff --git a/apps/edr-passenger-api/package.json b/apps/edr-passenger-api/package.json index 5ab08b399..72ac492ad 100644 --- a/apps/edr-passenger-api/package.json +++ b/apps/edr-passenger-api/package.json @@ -62,6 +62,7 @@ "@nestjs/schematics": "^11.1.0", "@nestjs/testing": "^11.1.19", "@types/express": "^4.17.21", + "@types/luxon": "^3.7.1", "@types/jest": "^29.5.11", "@types/node": "^20.10.6", "@types/qrcode": "^1.5.5", diff --git a/apps/edr-passenger-api/prisma/migrations/20260608061918_make_passenger_userid_nullable/migration.sql b/apps/edr-passenger-api/prisma/migrations/20260608061918_make_passenger_userid_nullable/migration.sql index a9fa8190b..657479139 100644 --- a/apps/edr-passenger-api/prisma/migrations/20260608061918_make_passenger_userid_nullable/migration.sql +++ b/apps/edr-passenger-api/prisma/migrations/20260608061918_make_passenger_userid_nullable/migration.sql @@ -1,11 +1,11 @@ -- DropForeignKey -ALTER TABLE "Passenger" DROP CONSTRAINT "Passenger_userId_fkey"; +ALTER TABLE "Passenger" DROP CONSTRAINT IF EXISTS "Passenger_userId_fkey"; -- AlterTable ALTER TABLE "Passenger" ALTER COLUMN "userId" DROP NOT NULL; --- CreateTable -CREATE TABLE "TicketSeat" ( +-- CreateTable (TicketSeat already exists from init; IF NOT EXISTS makes this idempotent) +CREATE TABLE IF NOT EXISTS "TicketSeat" ( "id" TEXT NOT NULL, "ticketId" TEXT NOT NULL, "seatId" TEXT NOT NULL, @@ -15,16 +15,19 @@ CREATE TABLE "TicketSeat" ( ); -- CreateIndex -CREATE INDEX "TicketSeat_ticketId_idx" ON "TicketSeat"("ticketId"); +CREATE INDEX IF NOT EXISTS "TicketSeat_ticketId_idx" ON "TicketSeat"("ticketId"); -- CreateIndex -CREATE INDEX "TicketSeat_seatId_idx" ON "TicketSeat"("seatId"); +CREATE INDEX IF NOT EXISTS "TicketSeat_seatId_idx" ON "TicketSeat"("seatId"); -- AddForeignKey +ALTER TABLE "Passenger" DROP CONSTRAINT IF EXISTS "Passenger_userId_fkey"; ALTER TABLE "Passenger" ADD CONSTRAINT "Passenger_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey +ALTER TABLE "TicketSeat" DROP CONSTRAINT IF EXISTS "TicketSeat_ticketId_fkey"; ALTER TABLE "TicketSeat" ADD CONSTRAINT "TicketSeat_ticketId_fkey" FOREIGN KEY ("ticketId") REFERENCES "Ticket"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey +ALTER TABLE "TicketSeat" DROP CONSTRAINT IF EXISTS "TicketSeat_seatId_fkey"; ALTER TABLE "TicketSeat" ADD CONSTRAINT "TicketSeat_seatId_fkey" FOREIGN KEY ("seatId") REFERENCES "Seat"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/apps/edr-passenger-api/prisma/migrations/20260623073543_config/migration.sql b/apps/edr-passenger-api/prisma/migrations/20260623073543_config/migration.sql index 7e086e649..959f74281 100644 --- a/apps/edr-passenger-api/prisma/migrations/20260623073543_config/migration.sql +++ b/apps/edr-passenger-api/prisma/migrations/20260623073543_config/migration.sql @@ -127,8 +127,8 @@ ALTER TABLE "TripStopTime" DROP CONSTRAINT "TripStopTime_scheduleId_fkey"; -- DropForeignKey ALTER TABLE "WalletLedgerEntry" DROP CONSTRAINT "WalletLedgerEntry_walletId_fkey"; --- DropIndex -DROP INDEX "Journey_bookingId_idx"; +-- DropIndex (created later in 20260627_add_journey_booking_id; IF EXISTS guards against ordering) +DROP INDEX IF EXISTS "Journey_bookingId_idx"; -- AlterTable ALTER TABLE "FaydaVerificationSession" ALTER COLUMN "purpose" SET DEFAULT 'VERIFY'; @@ -239,8 +239,7 @@ ALTER TABLE "SupportMessage" ADD CONSTRAINT "SupportMessage_conversationId_fkey" -- AddForeignKey ALTER TABLE "SavedRoute" ADD CONSTRAINT "SavedRoute_passengerId_fkey" FOREIGN KEY ("passengerId") REFERENCES "Passenger"("id") ON DELETE RESTRICT ON UPDATE CASCADE; --- AddForeignKey -ALTER TABLE "Journey" ADD CONSTRAINT "Journey_bookingId_fkey" FOREIGN KEY ("bookingId") REFERENCES "Booking"("id") ON DELETE SET NULL ON UPDATE CASCADE; +-- Journey_bookingId_fkey moved to 20260627_add_journey_booking_id (column added there) -- AddForeignKey ALTER TABLE "JourneySegment" ADD CONSTRAINT "JourneySegment_journeyId_fkey" FOREIGN KEY ("journeyId") REFERENCES "Journey"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/apps/edr-passenger-api/prisma/migrations/20260627_add_journey_booking_id/migration.sql b/apps/edr-passenger-api/prisma/migrations/20260627_add_journey_booking_id/migration.sql index 3f824b335..12f4a0eb7 100644 --- a/apps/edr-passenger-api/prisma/migrations/20260627_add_journey_booking_id/migration.sql +++ b/apps/edr-passenger-api/prisma/migrations/20260627_add_journey_booking_id/migration.sql @@ -5,6 +5,13 @@ ALTER TABLE "passenger"."Journey" CREATE UNIQUE INDEX IF NOT EXISTS "Journey_bookingId_key" ON "passenger"."Journey"("bookingId"); CREATE INDEX IF NOT EXISTS "Journey_bookingId_idx" ON "passenger"."Journey"("bookingId"); +-- AddForeignKey (column created above; FK was misplaced in 20260623073543_config) +ALTER TABLE "passenger"."Journey" + DROP CONSTRAINT IF EXISTS "Journey_bookingId_fkey"; +ALTER TABLE "passenger"."Journey" + ADD CONSTRAINT "Journey_bookingId_fkey" + FOREIGN KEY ("bookingId") REFERENCES "passenger"."Booking"("id") ON DELETE SET NULL ON UPDATE CASCADE; + -- Ensure JourneySegment cascades on Journey delete ALTER TABLE "passenger"."JourneySegment" DROP CONSTRAINT IF EXISTS "JourneySegment_journeyId_fkey"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ce905b737..67dabbdd7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,7 +10,7 @@ importers: dependencies: '@mantine/dates': specifier: ^9.3.2 - version: 9.3.2(@mantine/core@9.3.2(@mantine/hooks@9.3.2(react@19.2.6))(@types/react@18.3.31)(react-dom@19.2.6(react@19.2.6))(react@19.2.6))(@mantine/hooks@9.3.2(react@19.2.6))(dayjs@1.11.21)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) + version: 9.4.0(@mantine/core@9.4.0(@mantine/hooks@9.4.0(react@19.2.6))(@types/react@18.3.31)(react-dom@19.2.6(react@19.2.6))(react@19.2.6))(@mantine/hooks@9.4.0(react@19.2.6))(dayjs@1.11.21)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) devDependencies: '@commitlint/cli': specifier: ^19.5.0 @@ -157,6 +157,9 @@ importers: '@types/jest': specifier: ^29.5.13 version: 29.5.14 + '@types/luxon': + specifier: ^3.7.1 + version: 3.7.1 '@types/multer': specifier: ^2.1.0 version: 2.1.0 @@ -550,6 +553,9 @@ importers: '@types/jest': specifier: ^29.5.11 version: 29.5.14 + '@types/luxon': + specifier: ^3.7.1 + version: 3.7.1 '@types/node': specifier: ^20.10.6 version: 20.19.42 @@ -820,6 +826,9 @@ importers: '@types/jest': specifier: ^29.5.13 version: 29.5.14 + '@types/luxon': + specifier: ^3.7.1 + version: 3.7.1 '@types/node': specifier: ^20.14.0 version: 20.19.42 @@ -2022,10 +2031,10 @@ packages: react: ^19.2.0 react-dom: ^19.2.0 - '@mantine/core@9.3.2': - resolution: {integrity: sha512-Upy/Z9Sj2eW2dGrFgUy/2kISVsxMTBYTDfP2TFdsIA3PdPSBkdqfSOPX/ug3d3F3a4bnwQSqcO6+aPEpBIh8dg==} + '@mantine/core@9.4.0': + resolution: {integrity: sha512-BvTzaJ5Nut4ZiWLCcy1/cRXE8yjCgxsBhyAynY1pEg6XBw/fChEqSgbEB2dybOnkiAxvYt89TrnTrBBo9qJtmg==} peerDependencies: - '@mantine/hooks': 9.3.2 + '@mantine/hooks': 9.4.0 react: ^19.2.0 react-dom: ^19.2.0 @@ -2038,11 +2047,11 @@ packages: react: ^18.x || ^19.x react-dom: ^18.x || ^19.x - '@mantine/dates@9.3.2': - resolution: {integrity: sha512-MzHrXGoOb3rCnHBlsI/BPAjC8K5tZ4f8pzg66tsTsupVCQBaBpHSVatQwNRJ6K2JC9pyCyTa9BL803C8AiWycA==} + '@mantine/dates@9.4.0': + resolution: {integrity: sha512-15iCWxykutEVoFUPTq4z+An3YQZb7UH6Fwzb3stsVhTMLm6FyGLYSSB6PL+9sBV1TPllIJSm1IizY2SSTDGqQQ==} peerDependencies: - '@mantine/core': 9.3.2 - '@mantine/hooks': 9.3.2 + '@mantine/core': 9.4.0 + '@mantine/hooks': 9.4.0 dayjs: '>=1.0.0' react: ^19.2.0 react-dom: ^19.2.0 @@ -2057,8 +2066,8 @@ packages: peerDependencies: react: ^19.2.0 - '@mantine/hooks@9.3.2': - resolution: {integrity: sha512-jOjpUe0x1A/k3XUiu2/aaSCasXRI5ZKZOucm3ypwsvm9F2u8C1xzwBvagrzlbNZwJRF5vNYIJtCaT7NunPyc0A==} + '@mantine/hooks@9.4.0': + resolution: {integrity: sha512-SUkge8KlhyLoSSKhEHERx7jLotNu632kldhQPlLn5kbOuJixoEbU8fKcuwpXSsZTtzRgCCT2IkoN+rORhtZTHg==} peerDependencies: react: ^19.2.0 @@ -5687,8 +5696,8 @@ packages: typescript: optional: true - country-flag-icons@1.6.17: - resolution: {integrity: sha512-Nmik0289ZVZSI3c7mJR/amg6DyY7Z59b0sTFSKayeX72mHfPzCPJygwJs2pYgQULzuAyWeCUgwAJ+Dq8OR+JFw==} + country-flag-icons@1.6.18: + resolution: {integrity: sha512-dHjIG2y2wigHYYTToUDba13BOgBqzIwBeG4TD329yHxn+dt2S6ogmRb3z2VsrX5/XOhJsbC59T9lbPagNAnPOA==} crc-32@1.2.2: resolution: {integrity: sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==} @@ -12421,10 +12430,10 @@ snapshots: transitivePeerDependencies: - '@types/react' - '@mantine/core@9.3.2(@mantine/hooks@9.3.2(react@19.2.6))(@types/react@18.3.31)(react-dom@19.2.6(react@19.2.6))(react@19.2.6)': + '@mantine/core@9.4.0(@mantine/hooks@9.4.0(react@19.2.6))(@types/react@18.3.31)(react-dom@19.2.6(react@19.2.6))(react@19.2.6)': dependencies: '@floating-ui/react': 0.27.19(react-dom@19.2.6(react@19.2.6))(react@19.2.6) - '@mantine/hooks': 9.3.2(react@19.2.6) + '@mantine/hooks': 9.4.0(react@19.2.6) clsx: 2.1.1 react: 19.2.6 react-dom: 19.2.6(react@19.2.6) @@ -12443,10 +12452,10 @@ snapshots: react: 19.2.6 react-dom: 19.2.6(react@19.2.6) - '@mantine/dates@9.3.2(@mantine/core@9.3.2(@mantine/hooks@9.3.2(react@19.2.6))(@types/react@18.3.31)(react-dom@19.2.6(react@19.2.6))(react@19.2.6))(@mantine/hooks@9.3.2(react@19.2.6))(dayjs@1.11.21)(react-dom@19.2.6(react@19.2.6))(react@19.2.6)': + '@mantine/dates@9.4.0(@mantine/core@9.4.0(@mantine/hooks@9.4.0(react@19.2.6))(@types/react@18.3.31)(react-dom@19.2.6(react@19.2.6))(react@19.2.6))(@mantine/hooks@9.4.0(react@19.2.6))(dayjs@1.11.21)(react-dom@19.2.6(react@19.2.6))(react@19.2.6)': dependencies: - '@mantine/core': 9.3.2(@mantine/hooks@9.3.2(react@19.2.6))(@types/react@18.3.31)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) - '@mantine/hooks': 9.3.2(react@19.2.6) + '@mantine/core': 9.4.0(@mantine/hooks@9.4.0(react@19.2.6))(@types/react@18.3.31)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) + '@mantine/hooks': 9.4.0(react@19.2.6) clsx: 2.1.1 dayjs: 1.11.21 react: 19.2.6 @@ -12464,7 +12473,7 @@ snapshots: dependencies: react: 19.2.6 - '@mantine/hooks@9.3.2(react@19.2.6)': + '@mantine/hooks@9.4.0(react@19.2.6)': dependencies: react: 19.2.6 @@ -17218,7 +17227,7 @@ snapshots: optionalDependencies: typescript: 5.9.3 - country-flag-icons@1.6.17: {} + country-flag-icons@1.6.18: {} crc-32@1.2.2: {} @@ -21357,7 +21366,7 @@ snapshots: react-phone-number-input@3.4.17(react-dom@19.2.6(react@19.2.6))(react@19.2.6): dependencies: classnames: 2.5.1 - country-flag-icons: 1.6.17 + country-flag-icons: 1.6.18 input-format: 0.3.14(react-dom@19.2.6(react@19.2.6))(react@19.2.6) libphonenumber-js: 1.13.6 prop-types: 15.8.1