Created
November 21, 2023 12:50
-
-
Save cezarmezzalira/a6feb6004890d0fcf33028fabe09ac19 to your computer and use it in GitHub Desktop.
RACE API Models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List | |
from sqlmodel import Field, Relationship, SQLModel | |
class Provas(SQLModel, table=True): | |
id: int = Field(default=None, primary_key=True) | |
descricao: str | |
data_prova: str | |
q1: str | |
q2: str | |
q3: str | |
q4: str | |
q5: str | |
q6: str | |
q7: str | |
q8: str | |
q9: str | |
q10: str | |
resultados: List["Resultados"] = Relationship(back_populates="provas") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Optional | |
from sqlmodel import Field, Relationship, SQLModel | |
from src.models.provas_model import Provas | |
class Resultados(SQLModel, table=True): | |
id: int = Field(default=None, primary_key=True) | |
nome: str | |
q1: str | |
q2: str | |
q3: str | |
q4: str | |
q5: str | |
q6: str | |
q7: str | |
q8: str | |
q9: str | |
q10: str | |
nota: float = Optional[float] | |
prova_id: int = Field(nullable=False, foreign_key="provas.id") | |
provas: Optional[Provas] = Relationship(back_populates="resultados") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment