users

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	List(ctx *gin.Context)
	Find(ctx *gin.Context)
	Create(ctx *gin.Context)
	Update(ctx *gin.Context)
	Delete(ctx *gin.Context)
	ResetPassword(ctx *gin.Context)
}

Handler defines methods for users to interact with the server

type Users

type Users struct {
	*deps.Deps
}

Users defines the handler for all user routes.

func New

func New(d *deps.Deps) *Users

New

Creates a new users handler.

func (*Users) Create

func (u *Users) Create(ctx *gin.Context)

Create

Returns http.StatusOK if the user was created. Returns http.StatusInternalServerError if there was an error creating the user. Returns http.StatusBadRequest if the the validation failed or a user already exists.

func (*Users) Delete

func (u *Users) Delete(ctx *gin.Context)

Delete

Returns http.StatusOK if the user was deleted. Returns http.StatusInternalServerError if there was an error deleting the user. Returns http.StatusBadRequest if the the user wasn't found or no ID was passed.

func (*Users) Find

func (u *Users) Find(ctx *gin.Context)

Find

Returns http.StatusOK if the user was obtained. Returns http.StatusInternalServerError if there as an error obtaining the user. Returns http.StatusBadRequest if the ID wasn't passed or failed to convert.

func (*Users) List

func (u *Users) List(ctx *gin.Context)

List

Returns http.StatusOK if the users were obtained successfully. Returns http.StatusInternalServerError if there was an error getting the users. Returns http.StatusBadRequest if there was conflict or the request was invalid.

func (*Users) ResetPassword

func (u *Users) ResetPassword(ctx *gin.Context)

ResetPassword

Returns http.StatusOK if the reset password was successful. Returns http.StatusInternalServerError if there was an error resetting the user failed. Returns http.StatusBadRequest if the the user wasn't found, no ID was passed or validation failed.

func (*Users) Update

func (u *Users) Update(ctx *gin.Context)

Update

Returns http.StatusOK if the user was updated. Returns http.StatusInternalServerError if there was an error updating the user. Returns http.StatusBadRequest if the the validation failed or the user wasn't found.

Jump to

Keyboard shortcuts

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