## 27) Error response body shape is inconsistent
This commit is contained in:
@@ -8,9 +8,10 @@ return ``409 Conflict``.
|
||||
from __future__ import annotations
|
||||
|
||||
import structlog
|
||||
from fastapi import APIRouter, HTTPException, status
|
||||
from fastapi import APIRouter, status
|
||||
|
||||
from app.dependencies import AppDep, SettingsDep, SettingsServiceContextDep
|
||||
from app.exceptions import SetupAlreadyCompleteError
|
||||
from app.models.setup import SetupRequest, SetupResponse, SetupStatusResponse, SetupTimezoneResponse
|
||||
from app.services import setup_service
|
||||
from app.utils.runtime_state import update_app_settings
|
||||
@@ -59,13 +60,10 @@ async def post_setup(
|
||||
:class:`~app.models.setup.SetupResponse` on success.
|
||||
|
||||
Raises:
|
||||
HTTPException: 409 if setup has already been completed.
|
||||
SetupAlreadyCompleteError: if setup has already been completed.
|
||||
"""
|
||||
if is_setup_complete_cached(app) or await setup_service.is_setup_complete(settings_ctx.db):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_409_CONFLICT,
|
||||
detail="Setup has already been completed.",
|
||||
)
|
||||
raise SetupAlreadyCompleteError()
|
||||
|
||||
await setup_service.run_setup(
|
||||
settings_ctx.db,
|
||||
|
||||
Reference in New Issue
Block a user