Feature: Reserve slots currently being booked (#6909)

* Reserving slot picked up on cache

* change memory-cache to database table to block slots while reservation completes

* remove memory-cache

* update realeaseAt field when same user change te selected Slot

* Change default time to book

Co-authored-by: alannnc <[email protected]>

* remove ip field and renews the session when the user remains in the booking form

* Remove duplicate router

* types fixes

* nit picks

* Update turbo.json

* Revert unrelated change

* Uses constant

* Constant already has a fallback

* Update slots.ts

* Unit test fixes

* slot reservation on user level and support seats

* types fixes and reserve slots on click

* Fix nit var name

---------

Co-authored-by: Efraín Rochín <[email protected]>
Co-authored-by: zomars <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-04-13 19:55:26 +00:00
1 parent 7c9012738a
commit e478a46358
11 files changed
+227 -8

No files matched your search

@@ -0,0 +1,16 @@
-- CreateTable
CREATE TABLE "SelectedSlots" (
"id" SERIAL NOT NULL,
"eventTypeId" INTEGER NOT NULL,
"userId" INTEGER NOT NULL,
"slotUtcStartDate" TIMESTAMP(3) NOT NULL,
"slotUtcEndDate" TIMESTAMP(3) NOT NULL,
"uid" TEXT NOT NULL,
"releaseAt" TIMESTAMP(3) NOT NULL,
"isSeat" BOOLEAN NOT NULL DEFAULT false,
CONSTRAINT "SelectedSlots_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "SelectedSlots_userId_slotUtcStartDate_slotUtcEndDate_uid_key" ON "SelectedSlots"("userId", "slotUtcStartDate", "slotUtcEndDate", "uid");
+13
View File
@@ -723,3 +723,16 @@ enum FeatureType {
KILL_SWITCH
PERMISSION
}
model SelectedSlots {
id Int @id @default(autoincrement())
eventTypeId Int
userId Int
slotUtcStartDate DateTime
slotUtcEndDate DateTime
uid String
releaseAt DateTime
isSeat Boolean @default(false)
@@unique(fields: [userId, slotUtcStartDate, slotUtcEndDate, uid], name: "selectedSlotUnique")
}