This commit is contained in:
2025-05-16 14:29:14 -03:00
parent 17131380ac
commit cc9bd08daa
49 changed files with 177 additions and 54 deletions

39
http-api/app/models.py Normal file
View File

@@ -0,0 +1,39 @@
from typing import Annotated
from uuid import uuid4
from layercake.extra_types import CnpjStr, CpfStr, NameStr
from pydantic import (
UUID4,
BaseModel,
ConfigDict,
EmailStr,
Field,
StringConstraints,
)
class Org(BaseModel):
id: UUID4 | str = Field(default_factory=uuid4)
name: Annotated[str, StringConstraints(strip_whitespace=True)]
cnpj: CnpjStr | None = None
class User(BaseModel):
model_config = ConfigDict(arbitrary_types_allowed=True)
id: UUID4 | str = Field(default_factory=uuid4)
name: NameStr
email: EmailStr
email_verified: bool = False
cpf: CpfStr | None = None
class Cert(BaseModel):
exp_interval: int
class Course(BaseModel):
id: UUID4 = Field(default_factory=uuid4)
name: str
cert: Cert | None = None
access_period: int = 90 # 3 months