Files
flask-formula10/formula10/database/model/db_team.py
Christoph Urlacher 991a1a177e
All checks were successful
Build Formula10 Docker Image / build-docker (push) Successful in 26s
Split frontend model from backend model
2024-02-25 15:09:59 +01:00

22 lines
509 B
Python

from typing import List
from sqlalchemy import String
from sqlalchemy.orm import Mapped, mapped_column
from formula10 import db
class DbTeam(db.Model):
"""
A constructor/team (name only).
"""
__tablename__ = "team"
def __init__(self, *, name: str):
self.name = name # Primary key
@classmethod
def from_csv(cls, row: List[str]):
db_team: DbTeam = cls(name=str(row[0]))
return db_team
name: Mapped[str] = mapped_column(String(32), primary_key=True)