feat: client endpoints fixes for client tab in deal editor
This commit is contained in:
@ -17,8 +17,12 @@ class ClientRepository(
|
||||
entity_class = Client
|
||||
entity_not_found_msg = "Клиент не найден"
|
||||
|
||||
def _process_get_all_stmt(self, stmt: Select) -> Select:
|
||||
return stmt.where(Client.is_deleted.is_(False)).order_by(Client.created_at)
|
||||
def _process_get_all_stmt_with_args(
|
||||
self, stmt: Select, include_deleted: bool
|
||||
) -> Select:
|
||||
if not include_deleted:
|
||||
stmt = stmt.where(Client.is_deleted.is_(False))
|
||||
return stmt.order_by(Client.created_at)
|
||||
|
||||
async def create(self, data: CreateClientSchema) -> int:
|
||||
details = ClientDetails(**data.details.model_dump())
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from fastapi import APIRouter, Path
|
||||
from fastapi import APIRouter, Path, Query
|
||||
|
||||
from backend.dependecies import SessionDependency
|
||||
from modules.clients.schemas.client import *
|
||||
@ -14,8 +14,9 @@ router = APIRouter(tags=["client"])
|
||||
)
|
||||
async def get_clients(
|
||||
session: SessionDependency,
|
||||
include_deleted: bool = Query(alias="includeDeleted", default=False),
|
||||
):
|
||||
return await ClientService(session).get_all()
|
||||
return await ClientService(session).get_all(include_deleted)
|
||||
|
||||
|
||||
@router.post(
|
||||
|
||||
@ -22,6 +22,7 @@ class CreateClientSchema(BaseSchema):
|
||||
|
||||
class ClientSchema(CreateClientSchema):
|
||||
id: int
|
||||
is_deleted: bool = False
|
||||
|
||||
|
||||
class UpdateClientSchema(BaseSchema):
|
||||
|
||||
Reference in New Issue
Block a user