get_users

Function get_users 

Source
pub async fn get_users(
    __arg0: State<Arc<AppState>>,
) -> Result<impl IntoResponse, (StatusCode, Json<Value>)>
Expand description

Retrieves all users in the system.

Only admins can call this endpoint (enforced by middleware). Returns all User records converted to FilteredUser and sorted alphabetically by last name. Password hashes are not included in the response.

§Arguments

  • State(data): Application state containing AppState for database access

§Returns

  • 200 OK with array of FilteredUser objects
  • 500 Internal Server Error if database query fails

§Example Response

[
  {
    "id": 1,
    "first_name": "Admin",
    "last_name": "User",
    "username": "admin",
    "is_admin": true
  },
  {
    "id": 2,
    "first_name": "Regular",
    "last_name": "User",
    "username": "regularuser",
    "is_admin": false
  }
]