Skip to content

Commit

Permalink
endpoint for getting all transactions now with name instead of slug
Browse files Browse the repository at this point in the history
  • Loading branch information
sliwaszymon committed Dec 21, 2023
1 parent 18a849b commit 21620d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/web_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ async def get_transactions(
) -> list[GetTransactionWithProjectSlugSchema]:
transactions = ctx.call(get_all_transactions)
projects = ctx.call(get_all_projects)
project_id_slug_map = {project.id: project.slug for project in projects}
project_id_name_map = {project.id: project.name for project in projects}
transactions = [GetTransactionWithProjectSlugSchema(
**transaction.model_dump(), project_slug=project_id_slug_map.get(transaction.project_id, None))
**transaction.model_dump(), project_name=project_id_name_map.get(transaction.project_id, None))
for transaction in transactions]
return transactions
2 changes: 1 addition & 1 deletion src/transactions/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GetTransactionSchema(BaseModel):
class GetTransactionWithProjectSlugSchema(BaseModel):
id: str
project_id: str
project_slug: str | None
project_name: str
request: dict[str, Any]
response: dict[str, Any]
timestamp: datetime

0 comments on commit 21620d6

Please sign in to comment.