feat: add advisor rollout gate and rollback playbook
This commit is contained in:
@@ -8,12 +8,13 @@ from app.api.dependencies.auth import build_request_context
|
||||
from app.api.dependencies.rate_limit import enforce_rate_limit
|
||||
from app.core.contracts import RequestContext
|
||||
from app.core.product_recommendation_contracts import ProductRecommendationQuery
|
||||
from app.service.advisor_rollout_service import enforce_advisor_rollout
|
||||
from app.service.product_recommendation_service import ProductRecommendationService
|
||||
|
||||
advisor_router = APIRouter(
|
||||
prefix="/api/v1/advisor",
|
||||
tags=["advisor-recommendations"],
|
||||
dependencies=[Depends(enforce_rate_limit)],
|
||||
dependencies=[Depends(enforce_rate_limit), Depends(enforce_advisor_rollout)],
|
||||
)
|
||||
admin_router = APIRouter(
|
||||
prefix="/api/v1/admin",
|
||||
@@ -40,7 +41,10 @@ async def published_recommendations(
|
||||
return await ProductRecommendationService().published(context)
|
||||
|
||||
|
||||
@admin_router.post("/advisor/recommendations/{content_id}/reviews")
|
||||
@admin_router.post(
|
||||
"/advisor/recommendations/{content_id}/reviews",
|
||||
dependencies=[Depends(enforce_advisor_rollout)],
|
||||
)
|
||||
async def review_recommendation(
|
||||
payload: dict[str, Any],
|
||||
content_id: int = Path(gt=0),
|
||||
@@ -58,7 +62,10 @@ async def review_recommendation(
|
||||
return await ProductRecommendationService().review(content_id, decision, comment, context, key)
|
||||
|
||||
|
||||
@admin_router.post("/advisor/recommendations/{content_id}/publications")
|
||||
@admin_router.post(
|
||||
"/advisor/recommendations/{content_id}/publications",
|
||||
dependencies=[Depends(enforce_advisor_rollout)],
|
||||
)
|
||||
async def publish_recommendation(
|
||||
content_id: int = Path(gt=0),
|
||||
context: RequestContext = Depends(build_request_context), # noqa: B008
|
||||
|
||||
Reference in New Issue
Block a user