fix(daemons): block owner transfer while assigned
This commit is contained in:
@@ -8,6 +8,7 @@ from fastapi import APIRouter, Depends, HTTPException, Response, status
|
||||
|
||||
from app.core.auth import AuthContext, require_admin
|
||||
from app.core.config import Settings, get_settings
|
||||
from app.domain.errors import DaemonInUseError
|
||||
from app.repositories.factory import get_portfolio_repository_from_settings
|
||||
from app.schemas.v1 import (
|
||||
DaemonAdminResponse,
|
||||
@@ -38,6 +39,8 @@ def _to_response(daemon) -> DaemonAdminResponse:
|
||||
|
||||
def _daemon_error_to_http(exc: ValueError) -> HTTPException:
|
||||
detail = str(exc)
|
||||
if isinstance(exc, DaemonInUseError):
|
||||
return HTTPException(status_code=status.HTTP_409_CONFLICT, detail=detail)
|
||||
if "찾을 수 없습니다" in detail:
|
||||
return HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=detail)
|
||||
if "이미 존재하는 daemon slug" in detail:
|
||||
|
||||
Reference in New Issue
Block a user