- Install sanic - pip install sanic
- You may need to install scoop if not installed (windows command line installer) Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time irm get.scoop.sh | iex
- Install migration tool - scoop install dbmate
- Install all requirements by - pip install -r requirements.txt
- dbmate -u 'postgres://<db_user>:<db_pass>@localhost:/<db_name>?sslmode=disable' up
Schema -
Table users {
id integer [primary key]
customer_xid string
token string
}
Table wallet {
id integer [primary key]
amount integer
customer_xid string
enabled_at timestamp
is_enabled boolean
}
Table transactions {
id integer [primary key]
amount number
final_amount number
status string
transaction_time timestamp
transaction_from string
transaction_to string
transaction_type string
reference_id string
}
Ref: users.customer_xid - wallet.customer_xid // many-to-one
Ref: users.customer_xid < transactions.transaction_from // many-to-one
Ref: users.customer_xid < transactions.transaction_to // many-to-one
Note: This service is using tortoise-ORM for database interaction.