🏓 Initial ServeSync demo build
- FastAPI backend with PostgreSQL + Redis - 4 core features: Registration, Courts, Matchmaking, Tournament - Double elimination tournament with bracket visualization - ELO-based matchmaking (Stage 1 Open, Stage 2 Skill-Based) - Real-time WebSocket updates - TV Screen display for courts - Vue 3 + Tailwind CSS frontend - Seed data: 12 players, 4 courts, active matches, tournament in progress - Docker compose stack with Nginx reverse proxy
This commit is contained in:
33
backend/app/models/booking.py
Normal file
33
backend/app/models/booking.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from sqlalchemy import Column, Integer, ForeignKey, DateTime, Float, String, Enum, Boolean
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import func
|
||||
from app.database import Base
|
||||
import enum
|
||||
|
||||
|
||||
class BookingStatus(str, enum.Enum):
|
||||
PENDING = "pending"
|
||||
CONFIRMED = "confirmed"
|
||||
IN_PROGRESS = "in_progress"
|
||||
COMPLETED = "completed"
|
||||
CANCELLED = "cancelled"
|
||||
|
||||
|
||||
class Booking(Base):
|
||||
__tablename__ = "bookings"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
player_id = Column(Integer, ForeignKey("players.id"), nullable=False)
|
||||
court_id = Column(Integer, ForeignKey("courts.id"), nullable=False)
|
||||
start_time = Column(DateTime(timezone=True), nullable=False)
|
||||
end_time = Column(DateTime(timezone=True), nullable=False)
|
||||
duration_hours = Column(Float, default=1.0)
|
||||
total_cost = Column(Float, default=0.0)
|
||||
status = Column(Enum(BookingStatus), default=BookingStatus.CONFIRMED)
|
||||
is_match_booking = Column(Boolean, default=False)
|
||||
notes = Column(String(500))
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
# Relationships
|
||||
player = relationship("Player", back_populates="bookings")
|
||||
court = relationship("Court", back_populates="bookings")
|
||||
Reference in New Issue
Block a user