Automated Action 9e56bda916 Implement Multimodal Ticketing System with FastAPI and SQLite
This commit includes:
- Project structure and FastAPI setup
- SQLAlchemy models for users, vehicles, schedules, and tickets
- Alembic migrations
- User authentication and management
- Vehicle and schedule management
- Ticket purchase and cancellation with time restrictions
- Comprehensive API documentation
2025-06-17 11:08:42 +00:00

46 lines
881 B
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel
from app.models.ticket import TicketStatus
from app.schemas.user import User
from app.schemas.vehicle import ScheduleWithoutVehicle
class TicketBase(BaseModel):
schedule_id: int
seat_number: Optional[str] = None # Optional for cars and buses
class TicketCreate(TicketBase):
pass
class TicketUpdate(BaseModel):
status: Optional[TicketStatus] = None
is_active: Optional[bool] = None
class TicketInDBBase(TicketBase):
id: int
user_id: int
purchase_time: datetime
status: TicketStatus
is_active: bool
ticket_number: str
class Config:
from_attributes = True
class Ticket(TicketInDBBase):
schedule: ScheduleWithoutVehicle
class TicketWithUser(Ticket):
user: User
class TicketWithoutSchedule(TicketInDBBase):
pass