feat: add Nailong Fund advisor capabilities
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
"""Reviewed publication workflow for client-facing recommendation plans."""
|
||||
|
||||
from fastapi import APIRouter, Depends, Header, Query, status
|
||||
|
||||
from app.api.dependencies.auth import build_request_context
|
||||
from app.api.schemas.recommendation_plans import (
|
||||
RecommendationPlanGenerate,
|
||||
RecommendationPlanReview,
|
||||
)
|
||||
from app.core.contracts import RequestContext
|
||||
from app.service.recommendation_plan_service import RecommendationPlanService
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/api/v1/advisor/recommendation-plans",
|
||||
tags=["advisor-recommendation-plans"],
|
||||
)
|
||||
admin_router = APIRouter(
|
||||
prefix="/api/v1/admin/advisor/recommendation-plans",
|
||||
tags=["advisor-recommendation-plan-review"],
|
||||
)
|
||||
|
||||
|
||||
@router.post("", status_code=status.HTTP_201_CREATED)
|
||||
async def generate_plan(
|
||||
payload: RecommendationPlanGenerate,
|
||||
context: RequestContext = Depends(build_request_context), # noqa: B008
|
||||
key: str | None = Header(default=None, alias="Idempotency-Key"),
|
||||
) -> dict[str, object]:
|
||||
return await RecommendationPlanService().generate(payload, context, key)
|
||||
|
||||
|
||||
@router.get("/published")
|
||||
async def published_plans(
|
||||
limit: int = Query(default=20, ge=1, le=100),
|
||||
context: RequestContext = Depends(build_request_context), # noqa: B008
|
||||
) -> dict[str, object]:
|
||||
return await RecommendationPlanService().published(context, limit=limit)
|
||||
|
||||
|
||||
@admin_router.get("/review-queue")
|
||||
async def pending_plans(
|
||||
limit: int = Query(default=100, ge=1, le=100),
|
||||
context: RequestContext = Depends(build_request_context), # noqa: B008
|
||||
) -> dict[str, object]:
|
||||
return await RecommendationPlanService().pending(context, limit=limit)
|
||||
|
||||
|
||||
@admin_router.post("/{content_id}/reviews")
|
||||
async def review_plan(
|
||||
content_id: int,
|
||||
payload: RecommendationPlanReview,
|
||||
context: RequestContext = Depends(build_request_context), # noqa: B008
|
||||
key: str | None = Header(default=None, alias="Idempotency-Key"),
|
||||
) -> dict[str, object]:
|
||||
return await RecommendationPlanService().review(content_id, payload, context, key)
|
||||
Reference in New Issue
Block a user