edit_ticket

Function edit_ticket 

Source
pub async fn edit_ticket(
    __arg0: Path<i32>,
    __arg1: State<Arc<AppState>>,
    __arg2: Json<TicketUpdateScheme>,
) -> Result<impl IntoResponse, (StatusCode, Json<Value>)>
Expand description

Updates a ticket’s status.

Only admins can update ticket status (enforced by middleware). Applies TicketUpdateScheme to modify the TicketResponse. This is typically used to transition tickets through their lifecycle (open → in_progress → resolved → archived).

§Arguments

  • Path(id): Ticket ID to update, extracted from URL path
  • State(data): Application state containing AppState for database access
  • Json(body): TicketUpdateScheme update payload containing new status

§Returns

  • 200 OK with updated TicketResponse
  • 500 Internal Server Error if ticket not found or database error

§Typical Status Flow

  • open: Initial state, waiting for action
  • in_progress: Currently being worked on
  • resolved: Issue fixed
  • archived: Closed/hidden from normal view