40 lines
844 B
Python
40 lines
844 B
Python
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 | str = Field(default_factory=uuid4)
|
|
name: str
|
|
cert: Cert | None = None
|
|
access_period: int | None = None
|