adiet95 / costumer-order

Aim to test for K-Style Hub

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go-Order-API

Simple app product order with Echo HTTP Response Framework, GORM for Object relation model, PostgreSQL for database.

πŸ”— Description

This Backend Application is used for simple order product, in this application there are two models / ERD Schema likes User / Costumer & Products. Also have several features like JWT, Authentication & Authorization. There are 3 main modules :

  1. Customer Management (Get with paginate, Get Detail, Insert, Update, Delete, Search)
  2. Order Management (Get with paginate, Get Detail, Insert, Update, Delete, Search)
  3. Authentication Management (Get Login Data, Insert Login Data)

Notes : 1In this application there are two types of users (Roles). admins and costumer. Admin can do Costumer Management but Role Costumer can't, Registration page can only register Costumer roles, Admins can only be registered through seeding data.

ERD (Entity Relation Database)

erd.jpg

Table Specification

Costumer's Table

cost.jpg

Order's Table

order.jpg

Several command you must know in this app :

1. go run . serve //to run the app / server
2. go run . migrate -u //for database migration
# or
go run . migrate -d //for rollback
3. go run . seed // to seeding data Role admin if u want Email : "admin@gmail.com" Pass : admin12345678

πŸ› οΈ Installation Steps

  1. Clone the repository
https://github.com/adiet95/costumer-order.git
  1. Install dependencies
go mod tidy

Wait a minute, if still error run

go mod vendor
  1. Add Env File
  DB_USER="postgres"
  DB_HOST="localhost"
  DB_NAME="go-order"
  DB_PASS="root"
  JWT_KEYS="Rahasiaaaa"
  PORT=":8080"
  DB_PORT="5432"
  1. Database Migration and Rollback
go run main.go migrate --up //for database migration table
# or
go run main.go migrate --down //for rollback the database
  1. Seeding data admin
go run . seed

Purpose to login as Admin's Role

{
  "email": "admin@gmail.com",
  "password": "admin12345678"
}
  1. Run the app
go run . serve

πŸš€ You are all set

πŸ”— RESTful Documentation Endpoints

API Documentation <- Click Link

πŸ’» Built with

πŸš€ About Me

About

Aim to test for K-Style Hub

License:MIT License


Languages

Language:Go 98.0%Language:Dockerfile 2.0%