# POS-Miniku **Repository Path**: tegara/POS-Miniku ## Basic Information - **Project Name**: POS-Miniku - **Description**: No description available - **Primary Language**: Go - **License**: Not specified - **Default Branch**: development - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-11-10 - **Last Updated**: 2021-11-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # POS MINIKU This project is test case Backend Developer at Majoo # Entity Relations Diagram (ERD) This is the relational database that we build. # Data Manipulation Language (DML) This is my example of DML on this project. ~~~~sql INSERT INTO dbposmini.merchants (name) VALUES ('Bisnisnya Tegar'); INSERT INTO dbposmini.merchants (name) VALUES ('Bisnisnya Aditia'); INSERT INTO dbposmini.merchants (name) VALUES ('Bisnisnya Pratama'); INSERT INTO dbposmini.outlets (merchant_id, name) VALUES (1, 'Toko Tegar 1'); INSERT INTO dbposmini.outlets (merchant_id, name) VALUES (1, 'Toko Tegar 2'); INSERT INTO dbposmini.outlets (merchant_id, name) VALUES (2, 'Toko Aditia'); INSERT INTO dbposmini.outlets (merchant_id, name) VALUES (3, 'Toko Pratama'); INSERT INTO dbposmini.products (merchant_id, name, sku, img) VALUES (1, 'Sabun Wing', '234231412', 'sbn_wing.jpg'); INSERT INTO dbposmini.products (merchant_id, name, sku, img) VALUES (1, 'Pepsodent', '923489823', 'pepso.jpg'); INSERT INTO dbposmini.products (merchant_id, name, sku, img) VALUES (2, 'Baju Koko', '345345345', 'baju_koko.jpg'); INSERT INTO dbposmini.products (merchant_id, name, sku, img) VALUES (2, 'Makromah Cantik', '234234233', 'kudung23.jpg'); INSERT INTO dbposmini.products (merchant_id, name, sku, img) VALUES (3, 'Joran Pancing Mania Mantap', '585675673', 'joran23.jpg'); INSERT INTO dbposmini.prices (outlet_id, product_id, price) VALUES (1, 1, 2500); INSERT INTO dbposmini.prices (outlet_id, product_id, price) VALUES (2, 1, 3000); INSERT INTO dbposmini.prices (outlet_id, product_id, price) VALUES (1, 2, 7000); INSERT INTO dbposmini.prices (outlet_id, product_id, price) VALUES (2, 2, 6500); INSERT INTO dbposmini.prices (outlet_id, product_id, price) VALUES (3, 3, 50000); INSERT INTO dbposmini.prices (outlet_id, product_id, price) VALUES (3, 4, 35000); INSERT INTO dbposmini.prices (outlet_id, product_id, price) VALUES (4, 5, 100000); ~~~~ # Activity Diagrams ``` Soon will be updated``` # Use Case Diagrams ``` Soon will be updated``` # How to use Make sure to install Go and MySQL in order to use this API, you can use Google Cloud Platform or AWS to deploy this API. - Clone this repository in your directory: ``` $ git clone https://github.com/tegarap/POS-Miniku.git ``` - Rename ```example.env``` to ```.env``` - Run the main.go. ``` $ go run main.go ``` # Example Request - User Request ```jsonpath POST http://localhost:8080/users/register Accept: application/json Content-Type: application/json { "outlet_id": 3, "username": "tegar", "name": "Tegaru", "password": "inipasswrot" } ### POST http://localhost:8080/users/login Accept: application/json Content-Type: application/json { "username": "tegar", "password": "inipasswrot" } ### GET http://localhost:8080/users/profile Accept: application/json Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJ1c2VySWQiOjF9.O2CAZ6d_DF7Rx1jGC79Y5cImSZFj0UN6YoneZS2GGFM ### PUT http://localhost:8080/users/profile Accept: application/json Content-Type: application/json Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJ1c2VySWQiOjF9.O2CAZ6d_DF7Rx1jGC79Y5cImSZFj0UN6YoneZS2GGFM { "name": "Tegar Aditia Pratama" } ### DELETE http://localhost:8080/users/delete Accept: application/json Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJ1c2VySWQiOjF9.O2CAZ6d_DF7Rx1jGC79Y5cImSZFj0UN6YoneZS2GGFM ``` - Product Request ```jsonpath POST http://localhost:8080/products Accept: application/json Content-Type: application/json Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJ1c2VySWQiOjF9.O2CAZ6d_DF7Rx1jGC79Y5cImSZFj0UN6YoneZS2GGFM { "merchant_id": 3, "name": "Cacing Alaska", "sku": "231287483", "img": "cacing43.jpg", "outlet_id": 4, "price": 25000 } ### GET http://localhost:8080/products Accept: application/json Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJ1c2VySWQiOjJ9.nrEOrjT5gglipQcZOjSaHWBBlOleuMRRXz-NdnRUCp0 ### DELETE http://localhost:8080/products/1 Accept: application/json Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJ1c2VySWQiOjF9.O2CAZ6d_DF7Rx1jGC79Y5cImSZFj0UN6YoneZS2GGFM ``` # Disclaimer This is my first time using sqlx for my project because using sqlx is faster than gorm which I have used before. So, please understand :)