Files
flask-formula10/formula10/database/model/db_race.py
Christoph Urlacher e57109caf4
All checks were successful
Build Formula10 Docker Image / build-docker (push) Successful in 15s
Add quali_date + has_sprint fields to race
2024-03-09 20:56:58 +01:00

24 lines
993 B
Python

from datetime import datetime
from sqlalchemy import Boolean, DateTime, Integer, String
from sqlalchemy.orm import Mapped, mapped_column
from formula10 import db
class DbRace(db.Model):
"""
A single race at a certain date and GrandPrix in the calendar.
It stores the place to guess for this race.
"""
__tablename__ = "race"
def __init__(self, *, id: int):
self.id = id # Primary key
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=False)
name: Mapped[str] = mapped_column(String(64), nullable=False, unique=True)
number: Mapped[int] = mapped_column(Integer, nullable=False, unique=True)
date: Mapped[datetime] = mapped_column(DateTime, nullable=False, unique=True)
pxx: Mapped[int] = mapped_column(Integer, nullable=False) # This is the place to guess
quali_date: Mapped[datetime] = mapped_column(DateTime, nullable=False, unique=True)
has_sprint: Mapped[bool] = mapped_column(Boolean, nullable=False)