https://github.com/ariebrainware/paylist-api
Pay bill, set budget per month, and jot down some buy list easily with Paylist
https://github.com/ariebrainware/paylist-api
backend database digital-finance gin go golang goose goose-migration paylist
Last synced: 5 months ago
JSON representation
Pay bill, set budget per month, and jot down some buy list easily with Paylist
- Host: GitHub
- URL: https://github.com/ariebrainware/paylist-api
- Owner: ariebrainware
- License: mit
- Created: 2019-07-13T06:00:25.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-09-23T12:14:54.000Z (over 1 year ago)
- Last Synced: 2025-06-01T18:46:40.979Z (about 1 year ago)
- Topics: backend, database, digital-finance, gin, go, golang, goose, goose-migration, paylist
- Language: Go
- Homepage: https://api.paylist.ariebrainware.com
- Size: 280 KB
- Stars: 13
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PayList-API
[](https://github.com/ariebrainware/paylist-api/blob/master/LICENSE)





Pay your bill easily!
## Setup
1. Install golang and setup `$GOPATH`. Download in [here](https://golang.org/dl/) and Installation instruction can be found in [here](https://golang.org/doc/install)
2. `go get -u github.com/ariebrainware/paylist-api`
3. Setup `connString` variable inside `config.go`
4. `go run main.go`
5. Install go get -u github.com/pressly/goose/cmd/goose for goose migration or you can find Installation instruction in [here](https://github.com/pressly/goose)
## API Design
| Endpoint | Method | Description |
| --------------- | ------ | ----------------------------------------------------- |
| /paylist | GET | Show all user-paylist data |
| /paylist | POST | Add new user-paylist data |
| /paylist/:id | PUT | Update paylist based on `id` in parameter request |
| /paylist/:id | DELETE | Delete user-paylist based on input `id` parameter |
| /paylist/:id | GET | Show single paylist based on id in parameter request |
| /users | GET | Show all user |
| /users/:id | GET | Show single user bases on `id` in parameter request |
| /users/:id | PUT | Update paylist based on `id` in parameter request |
| /users/:id | DELETE | Delete user based on `id` in parameter |
| /users/signup | POST | Sign Up user or create new user |
| /users/signin | POST | Sign in for user |
| /user/signout | GET | Sign out user or logout |
| /user-paylist/:id | PUT | Update user-paylist status(complete or not) |
| /users/refresh-token | POST | Refresh Expired Token |
| /editpassword/:id | PUT | Handling user change password |
| /addsaldo | POST | Add User Balance |
## Database Design
Use GORM
Database design will automatically create by using `db.AutoMigrate`. So you just need to config database connection string inside `config.go`, then run `main.go`
Goose Migration
Create a new SQL migration.
```
goose create add_some_column sql
```
Usage: goose [OPTIONS] DRIVER DBSTRING COMMAND
```
goose postgres "host=localhost user=postgres password='' dbname=postgres sslmode=disable" status
```
Commands:
```
up Migrate the DB to the most recent version available
down Roll back the version by 1
status Dump the migration status for the current DB
create NAME [sql|go] Creates new migration file with the current timestamp
```
```go
Paylists Table
+------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| created_at | timestamp | YES | | NULL | |
| updated_at | timestamp | YES | | NULL | |
| deleted_at | timestamp | YES | MUL | NULL | |
| name | varchar(255) | YES | | NULL | |
| amount | int(11) | YES | | NULL | |
| due_date | date | YES | | NULL | |
| username | varchar(255) | YES | | NULL | |
| completed | tinyint(1) | YES | | NULL | |
+------------+------------------+------+-----+---------+----------------+
```
```go
Users Table
+------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| created_at | timestamp | YES | | NULL | |
| updated_at | timestamp | YES | | NULL | |
| deleted_at | timestamp | YES | MUL | NULL | |
| email | varchar(255) | YES | | NULL | |
| name | varchar(255) | YES | | NULL | |
| username | varchar(255) | NO | PRI | NULL | |
| password | varchar(255) | YES | | NULL | |
| balance | int(11) | YES | | NULL | |
+------------+------------------+------+-----+---------+----------------+
```
```go
Loggings Table
+------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------+----------------+
| username | varchar(255) | YES | | NULL | |
| token | varchar(255) | YES | | NULL | |
| user_status| tinyint(1) | YES | | NULL | |
| created_at | timestamp | YES | | NULL | |
| deleted_at | timestamp | YES | MUL | NULL | |
+------------+------------------+------+-----+---------+----------------+
```