Skip to content

havrydotdev/expenses-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Expenses tracker

Technologies

Endpoints

  • GET /api/expense

Endpoint description:

Response type Controller method Description OK code
Expense[] getAllExpenses() Get all expenses 200

Response example:

[
    {
        "id": "64bbe71c5686733de69370b9",
        "name": "Netflix",
        "category": "ENTERTAINMENT",
        "amount": 20
    },
    {
        "id": "64bbf18334eac8418631fc11",
        "name": "Movie Tickets",
        "category": "ENTERTAINMENT",
        "amount": 50
    },
    {
        "id": "64bbf18334eac8418631fc12",
        "name": "Dinner",
        "category": "RESTAURANT",
        "amount": 10
    },
    {
        "id": "64bbf18334eac8418631fc13",
        "name": "Netflix",
        "category": "ENTERTAINMENT",
        "amount": 30
    },
    {
        "id": "64bbf18334eac8418631fc14",
        "name": "Gym",
        "category": "MISC",
        "amount": 70
    },
    {
        "id": "64bbf18334eac8418631fc15",
        "name": "Internet",
        "category": "UTILITIES",
        "amount": 5
    }
]

  • POST /api/expense

Endpoint description:

Controller method Request body Response body Description OK code
addExpense() Expense Empty Add new expense 201

  • PUT /api/expense

Endpoint description:

Controller method Request body Response body Description OK code
updateExpense() Expense Empty Update expense by id in req body 200

  • GET /api/expense/{name}

Path variables:

Name Required Type Description
name required string Name of expense

Endpoint description:

Controller method Response body Description OK code
getExpenseByName() Expense Get expense by id 200

Response example:

GET /api/expense/Internet

{
    "id": "64bbf18334eac8418631fc15",
    "name": "Internet",
    "category": "UTILITIES",
    "amount": 5
}

  • DELETE /api/expense/{id}

Path variables:

Name Required Type Description
id required string Id of expense

Endpoint description:

Controller method Response body Description OK code
deleteExpense() Empty Get expense by id 204

Project types

  • Expense:

Name Required Type Description
id only in response string Id of expense
name required string Name of expense
category required ExpenseCategory Category of expense
amount required BigDecimal Expense amount
  • Enum ExpenseCategory:

Field
ENTERTAINMENT
GROCERIES
RESTAURANT
UTILITIES
MISC