team

package
v0.0.0-...-59acd12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

README

Teams routes

All routes that interact directly with teams are grouped together under \teams.

Create

Creates a new team.

Details
  • Route URL: POST /teams
  • Parameters: No parameters.
  • Body:
{
  "name": "string",
  "ident": "string",
  "descr": "string"
}
  • Responses:
    • 400 If invalid body.
    • 400 If json fields are invalid.
    • 400 If ident can be parsed to number.
    • 400 If ident is already in use.
    • 200 If succeeded.

Update

Updates a team by id or ident.

Details
  • Route URL: PATCH /teams/:(ident or id)
  • Parameters: No parameters.
  • Body:
{
  "name": "string",
  "ident": "string",
  "descr": "string"
}
  • Responses:
    • 400 If invalid body.
    • 400 If json fields are invalid.
    • 400 If ident in use.
    • 400 If ident can be parsed to number.
    • 404 If team not found.
    • 200 If succeeded.

Delete

Deletes a team by id or ident.

Details
  • Route URL: DELETE /teams/:(ident or id)
  • Parameters: No parameters.
  • Body: No body.
  • Responses:
    • 404 If team not found.
    • 200 If succeeded.

Get teams

Get a list of teams.

Details
  • Route URL: GET /teams
  • Parameters:
    • "limit" Limit of teams returned. Default is 30, max is 30, min is 0.
    • "offset" Offset for searching. Default is 0, min is 0.
  • Body: No body.
  • Responses:
    • 200 If succeeded. With body containing it's data in the format:
{
  "id": "number",
  "name": "string",
  "ident": "string",
  "descr": "string"
}[]

Get team

Get a team by id or ident.

Details
  • Route URL: GET /teams/:(ident or id)
  • Parameters: No parameters.
  • Body: No body.
  • Responses:
    • 404 If team not found.
    • 200 If succeeded. With body containing it's data in the format:
{
  "id": "number",
  "name": "string",
  "ident": "number",
  "descr": "string"
  "users-ids": "number[]"
}

Update team's users

Update users that are part of the team.

Details
  • Route URL: PATCH /teams/:(ident or id)/users
  • Parameters: No parameters.
  • Body:
{
  "users-ids": "number[]"
}
  • Responses:
    • 400 If invalid body.
    • 400 If have duplicated users.
    • 404 If team not found.
    • 200 If succeeded.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHandler

func CreateHandler(api *api.API) func(c *gin.Context)

Creates a new team on databse. Responses:

  • 400 If invalid body.
  • 400 If json fields are invalid.
  • 400 If ident is already in use.
  • 200 If succeeded.

func DeleteHandler

func DeleteHandler(api *api.API) func(c *gin.Context)

Deletes team from databse Responses:

  • 404 If team not founded
  • 204 If succeeded

func GetHandler

func GetHandler(api *api.API) func(c *gin.Context)

Get team in database Responses:

  • 404 If team not foud
  • 200 If succeeded

func MGetHandler

func MGetHandler(api *api.API) func(c *gin.Context)

Get multi teams on databse Params:

  • "limit" Limit of teams returned. Default is 30, max is 30, min is 0.
  • "offset" Offset for searching. Default is 0, min is 0.

Responses:

  • 400 If invalid params.
  • 200 If succeeded.

func UpdateHandler

func UpdateHandler(api *api.API) func(c *gin.Context)

Updates a team on database. Responses:

  • 400 If invalid body.
  • 400 If json fields are invalid
  • 400 If ident is already in use.
  • 404 If team does not exists.
  • 200 If succeeded.

func UsersHandler

func UsersHandler(api *api.API) func(c *gin.Context)

Updates a team - users relation on databse. Responses:

  • 400 If invalid body.
  • 400 If json is invalid or have duplicated elements.
  • 404 If team does not exists.
  • 200 If succeeded.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL