feat: add admin user initialization endpoint with request handling
This commit is contained in:
@@ -9,6 +9,40 @@
|
||||
"version": "0.1.0"
|
||||
},
|
||||
"paths": {
|
||||
"/api/auth/init_admin": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Authentication"
|
||||
],
|
||||
"summary": "Initializes the admin user",
|
||||
"description": "Initializes the admin user if no admin user exists and the correct setup secret is provided.",
|
||||
"operationId": "init_admin",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AdminInitRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Admin user initialized successfully"
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request payload"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized: Admin user already exists or invalid setup secret"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/auth/login": {
|
||||
"post": {
|
||||
"tags": [
|
||||
@@ -75,6 +109,26 @@
|
||||
},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"AdminInitRequest": {
|
||||
"type": "object",
|
||||
"description": "Login request payload",
|
||||
"required": [
|
||||
"username",
|
||||
"password",
|
||||
"setup_secret"
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"setup_secret": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"HealthInfo": {
|
||||
"type": "object",
|
||||
"description": "System health information",
|
||||
|
||||
Reference in New Issue
Block a user