crappy
This commit is contained in:
15
services/client.py
Normal file
15
services/client.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from sqlalchemy import select
|
||||
|
||||
from models import Client
|
||||
from services.base import BaseService
|
||||
from schemas.client import *
|
||||
|
||||
|
||||
class ClientService(BaseService):
|
||||
async def search_clients(self, request: ClientSearchRequest) -> ClientSearchResponse:
|
||||
query = await self.session.scalars(select(Client)
|
||||
.where(Client.name.ilike(f'%{request.name}%')))
|
||||
clients = []
|
||||
for client in query.all():
|
||||
clients.append(ClientSchema.model_validate(client))
|
||||
return ClientSearchResponse(clients=clients)
|
||||
Reference in New Issue
Block a user