feat: routers client and version prefixes
This commit is contained in:
0
routers/crm/v1/modules/clients/__init__.py
Normal file
0
routers/crm/v1/modules/clients/__init__.py
Normal file
56
routers/crm/v1/modules/clients/client.py
Normal file
56
routers/crm/v1/modules/clients/client.py
Normal file
@ -0,0 +1,56 @@
|
||||
from fastapi import APIRouter, Path, Query
|
||||
|
||||
from backend.dependecies import SessionDependency
|
||||
from modules.clients.schemas.client import *
|
||||
from modules.clients.services import ClientService
|
||||
|
||||
router = APIRouter(tags=["client"])
|
||||
|
||||
|
||||
@router.get(
|
||||
"/",
|
||||
response_model=GetClientsResponse,
|
||||
operation_id="get_clients",
|
||||
)
|
||||
async def get_clients(
|
||||
session: SessionDependency,
|
||||
include_deleted: bool = Query(alias="includeDeleted", default=False),
|
||||
):
|
||||
return await ClientService(session).get_all(include_deleted)
|
||||
|
||||
|
||||
@router.post(
|
||||
"/",
|
||||
response_model=CreateClientResponse,
|
||||
operation_id="create_client",
|
||||
)
|
||||
async def create_client(
|
||||
session: SessionDependency,
|
||||
request: CreateClientRequest,
|
||||
):
|
||||
return await ClientService(session).create(request)
|
||||
|
||||
|
||||
@router.patch(
|
||||
"/{pk}",
|
||||
response_model=UpdateClientResponse,
|
||||
operation_id="update_client",
|
||||
)
|
||||
async def update_client(
|
||||
session: SessionDependency,
|
||||
request: UpdateClientRequest,
|
||||
pk: int = Path(),
|
||||
):
|
||||
return await ClientService(session).update(pk, request)
|
||||
|
||||
|
||||
@router.delete(
|
||||
"/{pk}",
|
||||
response_model=DeleteClientResponse,
|
||||
operation_id="delete_client",
|
||||
)
|
||||
async def delete_product(
|
||||
session: SessionDependency,
|
||||
pk: int = Path(),
|
||||
):
|
||||
return await ClientService(session).delete(pk)
|
||||
Reference in New Issue
Block a user