feat: переименование доменной области
This commit is contained in:
74
src/controller/http/purchase_plans.py
Normal file
74
src/controller/http/purchase_plans.py
Normal file
@@ -0,0 +1,74 @@
|
||||
import uuid
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Depends
|
||||
from fastapi.routing import APIRouter
|
||||
|
||||
from src import deps, dto
|
||||
from src.adapter.jwt import JWTPayload
|
||||
|
||||
purchase_plan_channels_router = APIRouter(
|
||||
prefix='/workspaces/{workspace_id}/projects/{project_id}/purchase-plan/channels',
|
||||
tags=['purchase plan'],
|
||||
)
|
||||
|
||||
|
||||
@purchase_plan_channels_router.get('')
|
||||
async def get_purchase_plan_channels(
|
||||
workspace_id: uuid.UUID,
|
||||
project_id: uuid.UUID,
|
||||
current_user: Annotated[JWTPayload, Depends(deps.get_current_user)],
|
||||
) -> dto.GetPurchasePlanChannelsOutput:
|
||||
input = dto.GetPurchasePlanChannelsInput(
|
||||
user_id=current_user.user_id,
|
||||
workspace_id=workspace_id,
|
||||
project_id=project_id,
|
||||
)
|
||||
return await deps.get_usecase().get_purchase_plan_channels(input=input)
|
||||
|
||||
|
||||
@purchase_plan_channels_router.post('')
|
||||
async def attach_channel_to_purchase_plan(
|
||||
request: dto.AttachChannelToPurchasePlanInput,
|
||||
workspace_id: uuid.UUID,
|
||||
project_id: uuid.UUID,
|
||||
current_user: Annotated[JWTPayload, Depends(deps.get_current_user)],
|
||||
) -> dto.PurchasePlanChannelOutput:
|
||||
return await deps.get_usecase().attach_channel_to_purchase_plan(
|
||||
project_id=project_id,
|
||||
workspace_id=workspace_id,
|
||||
user_id=current_user.user_id,
|
||||
input=request,
|
||||
)
|
||||
|
||||
|
||||
@purchase_plan_channels_router.patch('/{channel_id}')
|
||||
async def update_purchase_plan_channel(
|
||||
channel_id: uuid.UUID,
|
||||
request: dto.UpdatePurchasePlanChannelInput,
|
||||
workspace_id: uuid.UUID,
|
||||
project_id: uuid.UUID,
|
||||
current_user: Annotated[JWTPayload, Depends(deps.get_current_user)],
|
||||
) -> dto.PurchasePlanChannelOutput:
|
||||
return await deps.get_usecase().update_purchase_plan_channel(
|
||||
channel_id=channel_id,
|
||||
project_id=project_id,
|
||||
workspace_id=workspace_id,
|
||||
user_id=current_user.user_id,
|
||||
input=request,
|
||||
)
|
||||
|
||||
|
||||
@purchase_plan_channels_router.delete('/{channel_id}')
|
||||
async def remove_purchase_plan_channel(
|
||||
channel_id: uuid.UUID,
|
||||
workspace_id: uuid.UUID,
|
||||
project_id: uuid.UUID,
|
||||
current_user: Annotated[JWTPayload, Depends(deps.get_current_user)],
|
||||
) -> None:
|
||||
await deps.get_usecase().remove_purchase_plan_channel(
|
||||
channel_id=channel_id,
|
||||
project_id=project_id,
|
||||
workspace_id=workspace_id,
|
||||
user_id=current_user.user_id,
|
||||
)
|
||||
Reference in New Issue
Block a user