danielblagy / budget-app

0 stars 0 forks source link

[server] implement reporting by month #42

Open danielblagy opened 1 year ago

danielblagy commented 1 year ago

GET /report/monthly

parameters: month, year

Returns incomes and expenses for a specific month, separated by categories

For example:

GET v1/report/montly?month=5&year=2023

Output:

{
    "user": "Daniel Blagy",
    "year": 2023,
    "month": 5,
    "expenses": [
        {
            "category_id": 1,
            "category_name": "groceries",
            "amount": 25786.5,
        },
        {
            "category_id": 5,
            "category_name": "eating out",
            "amount": 15309.86,
        }
    ],
    "incomes": [
        {
            "category_id": 2,
            "category_name": "day job",
            "amount": 45000,
        },
        {
            "category_id": 3,
            "category_name": "vigilante",
            "amount": 850000,
        }
    ]
}
  1. Create a migration with carefully curated test data for testing reporting (must include 2 separate months, a couple of categories for each type with a couple of entries for each category, leave at least one category without any entries).
  2. Write a db query that creates a report (show it to me when you have).
  3. Implement reporting feature (create a dedicated service, e.g. internal/report).
danielblagy commented 1 year ago

Blocked by #14