Main Page
From main page, we can conclude that we need an API to display category list and an API to display daily transaction. To calculate the total of each category, the value can be derived from a user’s transaction data. As a result, we don’t need a specific API to do that.
Add Transaction Page
(There should be a “Notes” section here)
In this page, we need an API to get category list for a user and an API to add a new transaction.
Add Category Page
In this page, we need an API to upload a category icon and an API to add a new category.
Merge into One
From the three pages, we can conclude that we need these functionalities:
- Get category list per user
- Get transaction list per user and per date
- Add transaction data
- Add category data
- Upload category icon
Other than the main functionalities, I add APIs related to user management:
- Get user data
- Add user data
In the next session, I will describe the appropriate request and response for each function.
API Contract
I will only explain the expected request and its expected response. Note that the contract is only valid for the current version, meaning that it does not reflect future versions.
Category
Column | Type | Not null | Notes |
---|---|---|---|
category_id | Integer | ✓ | |
category_name | String | ✓ | |
category_icon | String | ||
category_type | String | ✓ | Two possible String: EARNING, or EXPENSE |
Get Categories List
The expected input is a user’s ID, and the system will return an array that contains Category object
Get categories list
Request
Column Type Required user_id Integer ✓ Response
Column Type Required categories Category[] ✓
Save Category Data
Save category data
Request
Column Type Required user_id Integer ✓ category_name String ✓ icon_location String transaction_type String ✓ Response
Column Type Required category_id Integer ✓ message String
Upload Category Icon
There is no limitation for file types uploaded and image dimension for now. This function will be revisited later.
Upload category icon
Request
Column Type Required file Binary Data ✓ Response
Column Type Required Notes path String ✓ URL of the image message String
Transaction
Column | Type | Not null | Notes |
---|---|---|---|
transaction_id | Integer | ✓ | |
category_id | Integer | ✓ | |
amount | Integer | ✓ | |
date | Date | ✓ | |
note | String | ✓ |
Get Transaction List
Get transaction list based on user ID and transaction date
Get transaction list
Request
Column Type Not null user_id Integer ✓ date Date ✓ Response
Column Type Not null transaction_list Transaction[] ✓
Add Transaction
Add transaction
Request
Column Type Not null user_id Integer ✓ category_id Integer ✓ amount Integer ✓ transaction_date Date ✓ note String ✓ Response
Column Type Not null transaction_id Integer message String
User
A user object stores a user ID, a username, and an email.
Column | Type | Not null |
---|---|---|
user_id | String | |
username | String | ✓ |
String | ✓ |
Add User Data
Add user data
Request
Column Type Not null username String ✓ email String ✓ Response
Column Type Not null user_id Integer ✓ message String
Get User Data
Get user data
Request
Column Type Not null user_id Integer ✓ Response
Column Type Not null user User