mirror of
https://github.com/idrainformatica/PecFlow.git
synced 2026-06-16 12:45:42 +02:00
Modifiche varie
This commit is contained in:
@@ -17,6 +17,9 @@ class AuditLogResponse(BaseModel):
|
||||
id: int
|
||||
tenant_id: Optional[uuid.UUID] = None
|
||||
user_id: Optional[uuid.UUID] = None
|
||||
# Dati utente denormalizzati (arricchiti dalla JOIN nel service)
|
||||
user_email: Optional[str] = None
|
||||
user_full_name: Optional[str] = None
|
||||
action: str
|
||||
resource_type: Optional[str] = None
|
||||
resource_id: Optional[uuid.UUID] = None
|
||||
|
||||
@@ -11,6 +11,27 @@ from pydantic import BaseModel, model_validator
|
||||
from app.schemas.label import LabelResponse
|
||||
|
||||
|
||||
# ─── Search match info ────────────────────────────────────────────────────────
|
||||
|
||||
class AttachmentMatchInfo(BaseModel):
|
||||
"""Allegato in cui e' stato trovato il termine cercato."""
|
||||
id: uuid.UUID
|
||||
filename: str
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class SearchMatchInfo(BaseModel):
|
||||
"""Indica dove e' stato trovato il termine di ricerca in un messaggio."""
|
||||
in_subject: bool = False
|
||||
in_body: bool = False
|
||||
in_attachments: list[AttachmentMatchInfo] = []
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
# ─── Attachment ───────────────────────────────────────────────────────────────
|
||||
|
||||
class AttachmentResponse(BaseModel):
|
||||
id: uuid.UUID
|
||||
message_id: uuid.UUID
|
||||
@@ -59,6 +80,8 @@ class MessageResponse(BaseModel):
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
labels: list[LabelResponse] = []
|
||||
# Popolato solo nelle risposte di ricerca full-text
|
||||
search_match: Optional[SearchMatchInfo] = None
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
"""
|
||||
Schemi Pydantic per la gestione delle firme automatiche.
|
||||
"""
|
||||
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
# ─── Signature ────────────────────────────────────────────────────────────────
|
||||
|
||||
class SignatureCreate(BaseModel):
|
||||
name: str = Field(..., min_length=1, max_length=255)
|
||||
description: str | None = Field(None)
|
||||
body_html: str | None = Field(None)
|
||||
body_text: str | None = Field(None)
|
||||
|
||||
|
||||
class SignatureUpdate(BaseModel):
|
||||
name: str | None = Field(None, min_length=1, max_length=255)
|
||||
description: str | None = Field(None)
|
||||
body_html: str | None = Field(None)
|
||||
body_text: str | None = Field(None)
|
||||
|
||||
|
||||
class SignatureResponse(BaseModel):
|
||||
id: uuid.UUID
|
||||
tenant_id: uuid.UUID
|
||||
name: str
|
||||
description: str | None
|
||||
body_html: str | None
|
||||
body_text: str | None
|
||||
created_by: uuid.UUID | None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class SignatureListResponse(BaseModel):
|
||||
items: list[SignatureResponse]
|
||||
total: int
|
||||
|
||||
|
||||
# ─── SignatureAssignment ───────────────────────────────────────────────────────
|
||||
|
||||
SignatureContext = Literal["reply", "compose", "both"]
|
||||
|
||||
|
||||
class SignatureAssignmentCreate(BaseModel):
|
||||
signature_id: uuid.UUID
|
||||
mailbox_id: uuid.UUID | None = None
|
||||
virtual_box_id: uuid.UUID | None = None
|
||||
context: SignatureContext = "both"
|
||||
|
||||
|
||||
class SignatureAssignmentResponse(BaseModel):
|
||||
id: uuid.UUID
|
||||
tenant_id: uuid.UUID
|
||||
signature_id: uuid.UUID
|
||||
mailbox_id: uuid.UUID | None
|
||||
virtual_box_id: uuid.UUID | None
|
||||
context: str
|
||||
created_at: datetime
|
||||
# Nome della firma (join eagerly nel service)
|
||||
signature_name: str | None = None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class SignatureAssignmentListResponse(BaseModel):
|
||||
items: list[SignatureAssignmentResponse]
|
||||
total: int
|
||||
Reference in New Issue
Block a user