6c86f0f571
- integrated request-module into module registry - moved backend into modules/request-module - added manifest.json and module.py - implemented dynamic router mounting - implemented dynamic static mounting - removed direct dependencies from platform core - verified startup with request-module - verified startup without request-module - added implementation_report_003.md
79 lines
1.8 KiB
Python
79 lines
1.8 KiB
Python
"""Ticket schemas."""
|
|
|
|
from pydantic import BaseModel, Field
|
|
from typing import Optional, List
|
|
from datetime import datetime
|
|
|
|
|
|
class TicketCreate(BaseModel):
|
|
"""Ticket creation schema."""
|
|
|
|
subject: str = Field(..., min_length=1, max_length=4000)
|
|
description: Optional[str] = None
|
|
category_id: int = Field(..., description="Category ID")
|
|
priority_id: int = Field(..., description="Priority ID")
|
|
status_id: int = Field(..., description="Status ID")
|
|
assigned_to_id: Optional[int] = None
|
|
source: str = Field(default="web")
|
|
|
|
|
|
class TicketUpdate(BaseModel):
|
|
"""Ticket update schema."""
|
|
|
|
subject: Optional[str] = Field(None, min_length=1, max_length=4000)
|
|
description: Optional[str] = None
|
|
category_id: Optional[int] = None
|
|
priority_id: Optional[int] = None
|
|
status_id: Optional[int] = None
|
|
assigned_to_id: Optional[int] = None
|
|
closed_at: Optional[datetime] = None
|
|
|
|
|
|
class CommentCreate(BaseModel):
|
|
"""Comment creation schema."""
|
|
|
|
comment_text: str = Field(..., min_length=1)
|
|
|
|
|
|
class CommentResponse(BaseModel):
|
|
"""Comment response schema."""
|
|
|
|
id: int
|
|
ticket_id: int
|
|
created_by: int
|
|
comment_text: str
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class TicketResponse(BaseModel):
|
|
"""Ticket response schema."""
|
|
|
|
id: int
|
|
subject: str
|
|
description: Optional[str]
|
|
category_id: int
|
|
priority_id: int
|
|
status_id: int
|
|
source: str
|
|
opened_by: int
|
|
assigned_to_id: Optional[int]
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
closed_at: Optional[datetime]
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class TicketListResponse(BaseModel):
|
|
"""Ticket list response schema."""
|
|
|
|
tickets: List[TicketResponse]
|
|
total: int
|
|
page: int
|
|
page_size: int
|
|
total_pages: int
|