mirror of
https://github.com/idrainformatica/PecFlow.git
synced 2026-06-16 12:45:42 +02:00
Implementazioni varie
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
"""
|
||||
Schemi Pydantic per PecContact (Feature 6 – Rubrica indirizzi PEC).
|
||||
"""
|
||||
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, EmailStr, field_validator
|
||||
|
||||
|
||||
class PecContactCreate(BaseModel):
|
||||
email: EmailStr
|
||||
name: str | None = None
|
||||
organization: str | None = None
|
||||
notes: str | None = None
|
||||
is_favorite: bool = False
|
||||
|
||||
@field_validator("email")
|
||||
@classmethod
|
||||
def email_lowercase(cls, v: str) -> str:
|
||||
return v.lower().strip()
|
||||
|
||||
|
||||
class PecContactUpdate(BaseModel):
|
||||
name: str | None = None
|
||||
organization: str | None = None
|
||||
notes: str | None = None
|
||||
is_favorite: bool | None = None
|
||||
|
||||
|
||||
class PecContactResponse(BaseModel):
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
id: uuid.UUID
|
||||
tenant_id: uuid.UUID
|
||||
email: str
|
||||
name: str | None = None
|
||||
organization: str | None = None
|
||||
notes: str | None = None
|
||||
is_favorite: bool
|
||||
auto_saved: bool
|
||||
created_by: uuid.UUID | None = None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class PecContactListResponse(BaseModel):
|
||||
items: list[PecContactResponse]
|
||||
total: int
|
||||
|
||||
|
||||
class PecContactImportResult(BaseModel):
|
||||
created: int
|
||||
updated: int
|
||||
skipped: int
|
||||
errors: list[str] = []
|
||||
Reference in New Issue
Block a user