feat: add profile drift governance workflow

This commit is contained in:
Windows
2026-09-11 16:42:31 +08:00
parent 4088c634de
commit 852bafb374
11 changed files with 436 additions and 31 deletions
+27
View File
@@ -19,8 +19,10 @@ from app.api.schemas.admin import (
)
from app.core.advisor_backtest_contracts import AllocationBacktestQuery
from app.core.contracts import RequestContext
from app.core.profile_governance_contracts import ProfileDriftReviewRequest
from app.service.admin_service import AdminService
from app.service.allocation_backtest_service import AllocationBacktestService
from app.service.profile_governance_service import ProfileGovernanceService
router = APIRouter(
prefix="/api/v1/admin", tags=["platform-admin"], dependencies=[Depends(enforce_rate_limit)]
@@ -36,6 +38,31 @@ async def run_asset_allocation_backtest(
return await AllocationBacktestService().run(payload, context, key)
@router.get("/advisor/profile-tags")
async def list_profile_tags(
customer_id: int = Query(gt=0),
context: RequestContext = Depends(build_request_context), # noqa: B008
) -> dict[str, object]:
return await ProfileGovernanceService().tags(customer_id, context)
@router.get("/advisor/profile-drift-reviews")
async def list_profile_drift_reviews(
context: RequestContext = Depends(build_request_context), # noqa: B008
) -> dict[str, object]:
return await ProfileGovernanceService().pending_reviews(context)
@router.post("/advisor/profile-drift-reviews/{review_id}/reviews")
async def review_profile_drift(
payload: ProfileDriftReviewRequest,
review_id: int = Path(gt=0),
context: RequestContext = Depends(build_request_context), # noqa: B008
key: str | None = Header(default=None, alias="Idempotency-Key"),
) -> dict[str, object]:
return await ProfileGovernanceService().review(review_id, payload, context, key)
def register_resource(
resource: str,
schema: type[BaseModel],