Contents
- Quick start
- Decisions
- use RDBMS to make trade data consistency
- use repository pattern to encapsulate DB access
- how long you spent on the test
Quick start
There are two methods that can launch the application.
- via the Makefile to setup the application (recommend)
make run
- through the docker-compose to buildup the application manually
docker-compose up --build
How to use
- The server is listening to 8080 port, you can change it in the docker-compose.yaml
authorization
- add header {"Authorization", {token}} in your HTTP.Header
- for simplicity, we have some hardcode tokens to handle it
['Tim', 'Alex', 'Arthur', 'Ray', 'HD', 'peko', 'miko', 'rushia', 'gura', 'Ame']
withdraw
POST: localhost:8080/api/v1/wallet/withdraw
Header: {
"Authorization": {{token}},
"Content-Type": "application/json"
}
RequestBody: {
"amount": integer (required)
}
Response:
200: OK
400: BadRequest
401: Unauthorized
500: serverError
Deposit
POST: localhost:8080/api/v1/wallet/deposit
Header: {
"Authorization": {{token}},
"Content-Type": "application/json"
}
RequestBody: {
"amount": integer (required)
}
Response:
200: OK
400: BadRequest
401: Unauthorized
500: serverError
Transfer
POST: localhost:8080/api/v1/wallet/transfer
Header: {
"Authorization": {{token}},
"Content-Type": "application/json"
}
RequestBody: {
"toAccount": string (required)
"amount": integer (required)
}
Response:
200: OK
400: BadRequest
401: Unauthorized
500: serverError
GetAccount
GET: localhost:8080/api/v1/wallet/account
Header: {
"Authorization": {{token}}
}
Response:
200: OK
401: Unauthorized
500: serverError
Others
- build images
make build
- clean up the environment
make clean