From 66cca70588473c754cf2cb542e7b1bd294368bb5 Mon Sep 17 00:00:00 2001 From: Michael Chihlas Date: Thu, 16 Apr 2026 02:50:56 +0000 Subject: [PATCH] feat(psa): expand PSATicketSearchResult with IDs, add psa_tickets.py schemas Co-Authored-By: Claude Sonnet 4.6 --- backend/app/schemas/psa_connection.py | 4 ++ backend/app/schemas/psa_tickets.py | 64 +++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 backend/app/schemas/psa_tickets.py diff --git a/backend/app/schemas/psa_connection.py b/backend/app/schemas/psa_connection.py index f0dfde42..ece87b9f 100644 --- a/backend/app/schemas/psa_connection.py +++ b/backend/app/schemas/psa_connection.py @@ -53,9 +53,13 @@ class PSATicketSearchResult(BaseModel): id: str summary: str company_name: str | None = None + company_id: str | None = None board_name: str | None = None + board_id: int | None = None status_name: str | None = None + status_id: int | None = None priority_name: str | None = None + priority_id: int | None = None closed: bool = False diff --git a/backend/app/schemas/psa_tickets.py b/backend/app/schemas/psa_tickets.py new file mode 100644 index 00000000..91a37d73 --- /dev/null +++ b/backend/app/schemas/psa_tickets.py @@ -0,0 +1,64 @@ +"""Normalized DTOs for ticket management endpoints.""" +from __future__ import annotations +from pydantic import BaseModel + + +class PSAResourceSchema(BaseModel): + member_id: int + member_name: str + member_identifier: str + is_rf_user: bool = False + + +class PSATicketCreatedSchema(BaseModel): + id: int + summary: str + board_name: str + status_name: str + priority_name: str + company_name: str + resources: list[PSAResourceSchema] = [] + + +class PSATicketStatusUpdateSchema(BaseModel): + ticket_id: int + previous_status: str + new_status: str + + +class TicketCreatePayloadSchema(BaseModel): + summary: str + company_id: int + board_id: int + status_id: int + priority_id: int + description: str | None = None + assigned_member_id: int | None = None + + +class TicketListResponseSchema(BaseModel): + items: list = [] + total: int = 0 + page: int = 1 + page_size: int = 25 + + +class AiParseRequestSchema(BaseModel): + prompt: str + + +class AiParseResponseSchema(BaseModel): + summary: str | None = None + company_id: int | None = None + board_id: int | None = None + priority_id: int | None = None + status_id: int | None = None + assigned_member_id: int | None = None + description: str | None = None + missing_fields: list[str] = [] + warnings: list[str] = [] + + +class PSAPrioritySchema(BaseModel): + id: int + name: str