feat: add full project - backend, frontend, docker, specs and configs
This commit is contained in:
parent
b77c7d5a01
commit
e6cb06255b
24489 changed files with 61341 additions and 36 deletions
56
backend/app/schemas/agent.py
Normal file
56
backend/app/schemas/agent.py
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, EmailStr, field_validator
|
||||
|
||||
|
||||
class AgentOut(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
name: str
|
||||
photo_url: str | None
|
||||
creci: str
|
||||
email: str
|
||||
phone: str
|
||||
bio: str | None
|
||||
is_active: bool
|
||||
display_order: int
|
||||
|
||||
|
||||
class AgentIn(BaseModel):
|
||||
name: str
|
||||
photo_url: str | None = None
|
||||
creci: str
|
||||
email: str
|
||||
phone: str
|
||||
bio: str | None = None
|
||||
is_active: bool = True
|
||||
display_order: int = 0
|
||||
|
||||
@field_validator("name")
|
||||
@classmethod
|
||||
def name_not_empty(cls, v: str) -> str:
|
||||
if not v.strip():
|
||||
raise ValueError("name não pode ser vazio")
|
||||
return v.strip()
|
||||
|
||||
@field_validator("creci")
|
||||
@classmethod
|
||||
def creci_not_empty(cls, v: str) -> str:
|
||||
if not v.strip():
|
||||
raise ValueError("creci não pode ser vazio")
|
||||
return v.strip()
|
||||
|
||||
@field_validator("email")
|
||||
@classmethod
|
||||
def email_not_empty(cls, v: str) -> str:
|
||||
if not v.strip():
|
||||
raise ValueError("email não pode ser vazio")
|
||||
return v.strip()
|
||||
|
||||
@field_validator("phone")
|
||||
@classmethod
|
||||
def phone_not_empty(cls, v: str) -> str:
|
||||
if not v.strip():
|
||||
raise ValueError("phone não pode ser vazio")
|
||||
return v.strip()
|
||||
Loading…
Add table
Add a link
Reference in a new issue