sriharshakappala / wallet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple Wallet Service

Setup Environment

This app uses MYSQL for database. For convenience a docker-compose.yml file has been added in this repo for spinning up local environment quickly.

  1. Navigate to the root directory of this app
  2. Run docker-compose up
  3. Once the MYSQL image is pulled and container is started execute this command migrate -path ./migrations -database "mysql://admin:password@tcp(localhost:3306)/wallet" up. This will run the migrations and creates the schema & seeds with initial data.
Screenshot 2023-11-27 at 8 55 21 PM

Stack

  1. App is written in Go Lang
  2. Schema is managed by Go Lang migrations utility. This can be installed via brew install golang-migrate. Sample command to create migrations - migrate create -ext sql -dir migrations -seq create_users
  3. This uses MYSQL database
  4. Dev environment & dependencies managed by docker

Schema

Screenshot 2023-11-27 at 6 25 32 PM
Table users {
  id integer [primary key]
  username varchar
  created_at timestamp
  updated_at timestamp
}

Table wallet {
  id integer [primary key]
  user_id integer
  balance float
  created_at timestamp
  updated_at timestamp
}

Table transactions {
  id integer [primary key]
  user_id integer
  txn_type string
  txn_date timestamp
  txn_amount float
  closing_balance float
  other_party_id integer
  created_at timestamp
  updated_at timestamp
}

Ref: wallet.user_id - users.id

Ref: users.id < transactions.user_id

Ref: users.id < transactions.other_party_id

Execution

User creation
Screenshot 2023-11-27 at 8 56 51 PM Screenshot 2023-11-27 at 8 57 51 PM Screenshot 2023-11-27 at 8 57 56 PM
View Balances
Screenshot 2023-11-27 at 8 59 50 PM
Transaction
Screenshot 2023-11-27 at 9 54 26 PM Screenshot 2023-11-27 at 9 54 45 PM Screenshot 2023-11-27 at 9 54 53 PM
Refund
Screenshot 2023-11-27 at 10 00 21 PM Screenshot 2023-11-27 at 10 01 18 PM Screenshot 2023-11-27 at 10 01 25 PM
View Statement
Screenshot 2023-11-27 at 10 28 41 PM Screenshot 2023-11-27 at 10 28 51 PM Screenshot 2023-11-27 at 10 32 38 PM

About


Languages

Language:Go 100.0%