68 lines
1.4 KiB
Python
68 lines
1.4 KiB
Python
from datetime import datetime
|
|
|
|
from ninja import Schema
|
|
|
|
|
|
class SolutionIn(Schema):
|
|
title: str
|
|
problem_signature: str
|
|
related_system: str = ""
|
|
environment_scope: str = ""
|
|
root_cause: str
|
|
solution: str
|
|
risk_note: str = ""
|
|
status: str = "draft"
|
|
allow_auto_resolve: bool = False
|
|
requires_human_action: bool = False
|
|
requires_external_confirmation: bool = False
|
|
requires_production_change: bool = False
|
|
|
|
|
|
class SolutionOut(Schema):
|
|
id: int
|
|
title: str
|
|
problem_signature: str
|
|
related_system: str
|
|
environment_scope: str
|
|
root_cause: str
|
|
solution: str
|
|
risk_note: str
|
|
status: str
|
|
allow_auto_resolve: bool
|
|
requires_human_action: bool
|
|
requires_external_confirmation: bool
|
|
requires_production_change: bool
|
|
usage_count: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class TicketSolutionLinkIn(Schema):
|
|
ticket_id: int
|
|
link_type: str = "referenced"
|
|
agent_run_id: int | None = None
|
|
|
|
|
|
class AdoptSolutionIn(Schema):
|
|
ticket_id: int
|
|
remark: str = "采纳解决方案并标记工单已解决"
|
|
replied_to_customer: bool = False
|
|
|
|
|
|
class TicketSolutionLinkOut(Schema):
|
|
id: int
|
|
ticket_id: int
|
|
solution_id: int
|
|
link_type: str
|
|
solution_usage_count: int
|
|
created_at: datetime
|
|
|
|
|
|
class TicketSolutionOut(Schema):
|
|
id: int
|
|
ticket_id: int
|
|
solution_id: int
|
|
link_type: str
|
|
solution: SolutionOut
|
|
created_at: datetime
|