feat: add CourtSession model and isOpenPlay field to Court

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ivan
2026-03-02 03:44:54 +00:00
parent 08cdad3a4e
commit f521eeb698

View File

@@ -144,13 +144,15 @@ model Court {
description String? description String?
features String[] @default([]) features String[] @default([])
displayOrder Int @default(0) displayOrder Int @default(0)
isOpenPlay Boolean @default(false)
isActive Boolean @default(true) isActive Boolean @default(true)
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
site Site @relation(fields: [siteId], references: [id], onDelete: Cascade) site Site @relation(fields: [siteId], references: [id], onDelete: Cascade)
bookings Booking[] bookings Booking[]
matches Match[] matches Match[]
sessions CourtSession[]
@@index([siteId]) @@index([siteId])
@@index([status]) @@index([status])
@@ -215,6 +217,7 @@ model Client {
payments Payment[] payments Payment[]
sales Sale[] sales Sale[]
inscriptions TournamentInscription[] inscriptions TournamentInscription[]
courtSessions CourtSession[]
@@unique([organizationId, email]) @@unique([organizationId, email])
@@unique([organizationId, dni]) @@unique([organizationId, dni])
@@ -544,3 +547,28 @@ model Match {
@@index([round, position]) @@index([round, position])
@@index([scheduledAt]) @@index([scheduledAt])
} }
// =============================================================================
// COURT SESSIONS (Live Player Tracking)
// =============================================================================
model CourtSession {
id String @id @default(cuid())
courtId String
clientId String?
walkInName String?
startTime DateTime @default(now())
endTime DateTime?
isActive Boolean @default(true)
notes String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
court Court @relation(fields: [courtId], references: [id], onDelete: Cascade)
client Client? @relation(fields: [clientId], references: [id], onDelete: SetNull)
@@index([courtId])
@@index([clientId])
@@index([isActive])
@@index([startTime])
}