rebuild(stage-8): deliver market insight workspaces
This commit is contained in:
@@ -7,12 +7,16 @@ from fastapi import APIRouter, Path, Query, Request
|
||||
from backend.features.accounts.auth import AdminWritePrincipal, AuthenticatedPrincipal
|
||||
from backend.features.market.schemas import (
|
||||
ChartResponse,
|
||||
MarketInsightResponse,
|
||||
MarketSummaryResponse,
|
||||
MarketWorkspaceResponse,
|
||||
ReferenceSyncResponse,
|
||||
RotationMembersResponse,
|
||||
SearchResponse,
|
||||
SeatAliasRequest,
|
||||
SeatAliasResponse,
|
||||
SnapshotSyncResponse,
|
||||
ThemeDetailResponse,
|
||||
TradeContextResponse,
|
||||
)
|
||||
|
||||
@@ -95,3 +99,52 @@ def rotation_members(
|
||||
requested_date: Annotated[str | None, Query(alias="date")] = None,
|
||||
) -> dict:
|
||||
return request.app.state.container.market.rotation_members(sector_name, requested_date)
|
||||
|
||||
|
||||
@router.get("/insights/{key}", response_model=MarketInsightResponse)
|
||||
def insight(
|
||||
request: Request,
|
||||
principal: AuthenticatedPrincipal,
|
||||
key: Annotated[
|
||||
Literal["auction", "themes", "popularity", "dragon-list"], Path()
|
||||
],
|
||||
requested_date: Annotated[str | None, Query(alias="date")] = None,
|
||||
) -> dict:
|
||||
return request.app.state.container.market.insight(
|
||||
key, requested_date, principal.user.id
|
||||
)
|
||||
|
||||
|
||||
@router.post("/insights/{key}/sync", response_model=MarketInsightResponse)
|
||||
def sync_insight(
|
||||
request: Request,
|
||||
principal: AdminWritePrincipal,
|
||||
key: Annotated[
|
||||
Literal["auction", "themes", "popularity", "dragon-list"], Path()
|
||||
],
|
||||
requested_date: Annotated[str | None, Query(alias="date")] = None,
|
||||
) -> dict:
|
||||
return request.app.state.container.market.sync_insight(
|
||||
key, requested_date, principal.user.id
|
||||
)
|
||||
|
||||
|
||||
@router.get("/themes/{identifier}", response_model=ThemeDetailResponse)
|
||||
def theme_detail(
|
||||
request: Request,
|
||||
_principal: AuthenticatedPrincipal,
|
||||
identifier: Annotated[str, Path(min_length=1, max_length=40)],
|
||||
requested_date: Annotated[str | None, Query(alias="date")] = None,
|
||||
) -> dict:
|
||||
return request.app.state.container.market.theme_detail(identifier, requested_date)
|
||||
|
||||
|
||||
@router.put("/seat-aliases", response_model=SeatAliasResponse)
|
||||
def save_seat_alias(
|
||||
payload: SeatAliasRequest,
|
||||
request: Request,
|
||||
principal: AdminWritePrincipal,
|
||||
) -> dict[str, str]:
|
||||
return request.app.state.container.market.save_seat_alias(
|
||||
payload.seat_name, payload.alias_name, principal.user.id
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user