Skip to content

Commit

Permalink
починил присвоение отчества при создании владельца
Browse files Browse the repository at this point in the history
  • Loading branch information
Puzanovim committed Jun 1, 2021
1 parent b95b545 commit e3d7397
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/accounts/client_account/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def get_clients() -> List[ClientShort]:
clients_list = []
for client in result:
client = dict(client)
owner = await get_client_owner(client["id"])
owner = await get_or_404(client["owner_id"])
count_employees = await get_count_employees(client["id"])
clients_list.append(ClientShort(**dict({**client, "owner": owner, "count_employees": count_employees})))
return clients_list
Expand Down Expand Up @@ -85,14 +85,15 @@ async def get_dev_client_page(client_id: int) -> DevClientPage:

async def get_client(client_id: int) -> Optional[Client]:
query = clients.select().where(clients.c.id == client_id)
result = await database.fetch_one(query=query)
if result is None:
client = await database.fetch_one(query=query)
if client is None:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=Errors.CLIENT_NOT_FOUND)
owner = await get_client_owner(client_id)
client = dict(client)
owner = await get_or_404(client["owner_id"])
licences_list = await get_client_licences(client_id)
return Client(**dict({**dict(result),
return Client(**dict({**client,
"owner": owner,
"licences": licences_list}))

Expand Down Expand Up @@ -122,6 +123,7 @@ async def add_client(data: ClientAndOwnerCreate) -> Optional[ClientDB]:
password=data.password,
name=data.owner_name,
surname=data.surname,
patronymic=data.patronymic,
avatar=data.owner_avatar,
client_id=client_id,
is_owner=True,
Expand Down

0 comments on commit e3d7397

Please sign in to comment.