Split frontend model from backend model
All checks were successful
Build Formula10 Docker Image / build-docker (push) Successful in 26s
All checks were successful
Build Formula10 Docker Image / build-docker (push) Successful in 26s
This commit is contained in:
22
formula10/database/model/db_team.py
Normal file
22
formula10/database/model/db_team.py
Normal file
@ -0,0 +1,22 @@
|
||||
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)
|
Reference in New Issue
Block a user