Giter Site home page Giter Site logo

igorhoffmann / gms-app Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 108 KB

๐Ÿ‘จโ€๐Ÿ’ป REST API for Gym Management System

Go 97.11% Dockerfile 1.87% Makefile 0.42% Shell 0.60%
docker go golang dockerfile clean-ar dokcer-compose gin golang-api golang-examples golang-jwt

gms-app's Introduction

REST API "Gym Management System" on Go

The application implements a service for sending methods GET, POST, DELETE, PUT to interact with the database, which is described in this file. Additionally implemented authorization and authentication using jwt.

API:

POST /auth/sign-up

Creates new user

Example Input:
{
	"username": "UncleBob",
	"password": "cleanArch"
} 

POST /auth/sign-in

Request to get JWT Token based on user credentials

Example Input:
{
	"username": "UncleBob",
	"password": "cleanArch"
} 
Example Response:
{
	"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzEwMzgyMjQuNzQ0MzI0MiwidXNlciI6eyJJRCI6IjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMCIsIlVzZXJuYW1lIjoiemhhc2hrZXZ5Y2giLCJQYXNzd29yZCI6IjQyODYwMTc5ZmFiMTQ2YzZiZDAyNjlkMDViZTM0ZWNmYmY5Zjk3YjUifX0.3dsyKJQ-HZJxdvBMui0Mzgw6yb6If9aB8imGhxMOjsk"
} 

POST /api/info

Creates new info

Example Input:
Case instructor:
{
      "first_name": "Marlon",
      "last_name": "Brando",
      "relationship": "istructor",
      "phone": "+380000000000",
      "date_of_birth": "03.04.1998",
      "salary": 3000
} 
Case member:
{
      "first_name": "Steven",
      "last_name": "Jobs",
      "relationship": "member",
      "phone": "+380000000001",
      "date_of_birth": "07.08.2000",
      "membership_id": 1,
      "expires_at": "16.11.2022"
} 

GET /api/info

Returns all user info

Example Response:
{
	"info": [
            {
                "id": 1
                "first_name": "Marlon",
                "last_name": "Brando",
                "middle_name": "",
                "relationship": "istructor",
                "phone": "+380000000000",
                "date_of_birth": "03.04.1998",
                "date_of_registry": "16.08.2022",
                "hire_date": "16.08.2022",
                "salary": 3000
            }
    ]
} 

DELETE /api/info

Deletes info by ID:

Example Input:
{
	"id": "1"
} 

Requirements

  • go 1.18
  • docker & docker-compose
  • postman (for testing)

To launch an application:

make build && make run

If the application is running for the first time, you need to apply migrations to the database:

make migrate

You can simply copy and paste the contents of the file in the terminal, opening the desired database.

If you're using Git Bash on Windows and don't have a make command in the terminal, I recommend this guide.

Application testing

The postman folder contains a collection for testing the application. Postman download link.

P.s.

Inspired by Maksim Zhashkevych.

gms-app's People

Contributors

igorhoffmann avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.