check_admin_exists

Function check_admin_exists 

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

Checks if any administrator user exists in the system.

This endpoint is used during initialization to determine if the setup page should be displayed. It counts all User records with is_admin = true in the database.

§Arguments

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

§Returns

  • 200 OK with JSON: {"has_admin": bool} - Whether at least one admin exists
  • 500 Internal Server Error if database query fails

§Example Response

{"has_admin": false}