Function get_user

Source
pub async fn get_user(
    __arg0: State<AppState>,
    __arg1: Query<GetUserParams>,
) -> impl IntoResponse
Expand description

GET /api/test/users?username={username}

Fetches a user by their username.

This endpoint is only available in non-production environments
and exists for the sole purpose of E2E/integration tests.
It must never be exposed in production.

§Query parameters

  • username — The unique username of the user to fetch.

§Example request

curl -X GET "http://localhost:3000/api/test/users?username=student42"

§Response examples

§200 OK

{
  "success": true,
  "data": {
    "id": 1,
    "username": "student42",
    "email": "[email protected]",
    "admin": false
  },
  "message": "OK"
}

§404 Not Found

{
  "success": false,
  "data": null,
  "message": "User not found"
}

§500 Internal Server Error

{
  "success": false,
  "data": null,
  "message": "Database error: <details>"
}