Function create_ticket

Source
pub async fn create_ticket(
    __arg0: State<AppState>,
    __arg1: Path<(i64, i64)>,
    __arg2: Extension<AuthUser>,
    __arg3: Json<TicketRequest>,
) -> impl IntoResponse
Expand description

Creates a new ticket.

Endpoint: POST /modules/{module_id}/assignments/{assignment_id}/tickets
Permissions: Authenticated users can create tickets for the assignment.

§Path parameters

  • module_id → ID of the module (unused in handler, kept for route consistency)
  • assignment_id → ID of the assignment for which the ticket is created

§Request body

{
  "title": "Issue with submission",
  "description": "I am unable to submit my assignment due to..."
}

§Responses

  • 200 OK → Ticket created successfully
{
  "success": true,
  "data": {
      "id": 123,
      "title": "Issue with submission",
      "description": "I am unable to submit my assignment due to...",
      "status": "open",
      "user_id": 456
  },
  "message": "Ticket created successfully"
}
  • 500 Internal Server Error → Failed to create the ticket
{
  "success": false,
  "data": null,
  "message": "Failed to create ticket: <error message>"
}