Seats report, supplementary change for bookings added

This commit is contained in:
Stephanos A
2026-07-16 11:43:04 +03:00
parent 3bc492ea83
commit a852b4e619
15 changed files with 1392 additions and 176 deletions

View File

@@ -0,0 +1,33 @@
-- CreateTable
CREATE TABLE "SupplementaryCharge" (
"id" TEXT NOT NULL,
"bookingId" TEXT NOT NULL,
"reason" TEXT NOT NULL,
"amountMinor" INTEGER NOT NULL,
"currency" TEXT NOT NULL DEFAULT 'ETB',
"status" TEXT NOT NULL DEFAULT 'PENDING',
"paymentToken" TEXT NOT NULL,
"providerTxnId" TEXT,
"notes" TEXT,
"createdBy" TEXT NOT NULL,
"paidAt" TIMESTAMP(3),
"expiresAt" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "SupplementaryCharge_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "SupplementaryCharge_paymentToken_key" ON "SupplementaryCharge"("paymentToken");
-- CreateIndex
CREATE INDEX "SupplementaryCharge_bookingId_idx" ON "SupplementaryCharge"("bookingId");
-- CreateIndex
CREATE INDEX "SupplementaryCharge_paymentToken_idx" ON "SupplementaryCharge"("paymentToken");
-- CreateIndex
CREATE INDEX "SupplementaryCharge_status_idx" ON "SupplementaryCharge"("status");
-- AddForeignKey
ALTER TABLE "SupplementaryCharge" ADD CONSTRAINT "SupplementaryCharge_bookingId_fkey" FOREIGN KEY ("bookingId") REFERENCES "Booking"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -567,6 +567,7 @@ model Booking {
cancellation BookingCancellation?
baggage BaggageBooking[]
excessBaggageCharges ExcessBaggageCharge[]
supplementaryCharges SupplementaryCharge[]
journey Journey?
@@index([passengerId, status])
@@ -1234,6 +1235,28 @@ model BaggageBooking {
@@schema("passenger")
}
model SupplementaryCharge {
id String @id @default(uuid())
bookingId String
reason String // e.g. "UNDERPAYMENT", "FARE_CORRECTION"
amountMinor Int
currency String @default("ETB")
status String @default("PENDING") // PENDING | PAID | WAIVED | EXPIRED
paymentToken String @unique @default(uuid())
providerTxnId String?
notes String?
createdBy String
paidAt DateTime?
expiresAt DateTime?
createdAt DateTime @default(now())
booking Booking @relation(fields: [bookingId], references: [id])
@@index([bookingId])
@@index([paymentToken])
@@index([status])
@@schema("passenger")
}
model ExcessBaggageCharge {
id String @id @default(uuid())
bookingId String