Categorygithub.com/Aldikon/API-user
module
0.0.0-20230621152547-11955e98202d
Repository: https://github.com/aldikon/api-user.git
Documentation: pkg.go.dev

# README

API-User

This project implements a service that provides a REST API to work with user data.

Before running the project, create .env in the root directory and fill it in as in the .env.example file.

To start the program you can write a command:

    make dcup

To stop the program you can write a command:

    make dcdown

You can view the service and database logs with commands:

    make logapp

and

    make logdb

Example JSON object user:

{
    "id" : int,
    "name" : string,
    "surname" : string,
    "gender" : enum gender,
    "status" : enum gender,
    "birth_date" : format "2006-01-02",
    "creat_date" : format "2006-01-02"
}

Request format

The API supports POST requests with Content-type equal to application/json with the following parameters:

ParameterDescription
Request formatapplication/json
Response formatapplication/json
EncodingUTF-8

Enum

User status:

  • active
  • banned
  • deleted

User gender:

  • active
  • banned
  • deleted

EndPoint:


/user

Methods:

GET

Returns a list of all users.

Not required query parameters:

QueryDescription
genderenum gender
statusenum status
full_namethe hollow name is {name + " " + last name} string
descsorting in descending order, you can pass a few, the value of the attributes of the user
ascsorting in descending order, you can pass a few, the value of the attributes of the user
limitlimit the number of outputs, type number
offsetoffset, type number

POST

Creates a user.

Accepts JSON object:

{
    "name": string,
    "surname": string,
    "gender": enum gender,
    "status": enum status,
    "birth_date": format "2006-01-02"
}

/user/{user_id}

Methods:

GET

Returns the user by ID.

PUT

Change user. Accepts JSON object:

{
    "name": string,
    "surname": string,
    "gender": enum gender,
    "status": enum status,
    "birth_date": format "2006-01-02"
}

DELETE

Deletes a user by ID.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author