fix
This commit is contained in:
39
http-api/app/models.py
Normal file
39
http-api/app/models.py
Normal 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
|
||||
Reference in New Issue
Block a user