user

package
v0.0.0-...-487d63a Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package user contains the user controller

Package user contains the user controller

Package user contains the user controller

Package user contains the user controller

Package user contains the user controller

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	UserService useCaseUser.Service
}

Controller is a struct that contains the user service

func (*Controller) DeleteUser

func (c *Controller) DeleteUser(ctx *gin.Context)

DeleteUser godoc @Tags user @Summary Get users by ID @Description Get Users by ID on the system @Param user_id path int true "id of user" @Security ApiKeyAuth @Success 200 {object} MessageResponse @Failure 400 {object} MessageResponse @Failure 500 {object} MessageResponse @Router /user/{user_id} [get]

func (*Controller) GetAllUsers

func (c *Controller) GetAllUsers(ctx *gin.Context)

GetAllUsers godoc @Tags user @Summary Get all Users @Security ApiKeyAuth @Description Get all Users on the system @Success 200 {object} []ResponseUser @Failure 400 {object} MessageResponse @Failure 500 {object} MessageResponse @Router /user [get]

func (*Controller) GetUsersByID

func (c *Controller) GetUsersByID(ctx *gin.Context)

GetUsersByID godoc @Tags user @Summary Get users by ID @Description Get Users by ID on the system @Param user_id path int true "id of user" @Security ApiKeyAuth @Success 200 {object} ResponseUser @Failure 400 {object} MessageResponse @Failure 500 {object} MessageResponse @Router /user/{user_id} [get]

func (*Controller) NewUser

func (c *Controller) NewUser(ctx *gin.Context)

NewUser godoc @Tags user @Summary Create New UserName @Description Create new user on the system @Security ApiKeyAuth @Accept json @Produce json @Param data body NewUserRequest true "body data" @Success 200 {object} ResponseUser @Failure 400 {object} MessageResponse @Failure 500 {object} MessageResponse @Router /user [post]

func (*Controller) UpdateUser

func (c *Controller) UpdateUser(ctx *gin.Context)

UpdateUser godoc @Tags user @Summary Get users by ID @Description Get Users by ID on the system @Param user_id path int true "id of user" @Security ApiKeyAuth @Success 200 {object} ResponseUser @Failure 400 {object} MessageResponse @Failure 500 {object} MessageResponse @Router /user/{user_id} [get]

type DataUserRequest

type DataUserRequest struct {
	Limit           int64                                   `json:"limit" example:"10"`
	Page            int64                                   `json:"page" example:"1"`
	GlobalSearch    string                                  `json:"globalSearch" example:"John"`
	Filters         map[string][]string                     `json:"filters"`
	SorBy           controllers.SortByDataRequest           `json:"sortBy"`
	FieldsDateRange []controllers.FieldDateRangeDataRequest `json:"fieldsDateRange"`
}

DataUserRequest is a struct that contains the request body for get users

type MessageResponse

type MessageResponse struct {
	Message string `json:"message"`
}

MessageResponse is a struct that contains the response body for the message

type NewUserRequest

type NewUserRequest struct {
	UserName  string `json:"user" example:"someUser" gorm:"unique" binding:"required"`
	Email     string `json:"email" example:"mail@mail.com" gorm:"unique" binding:"required"`
	FirstName string `json:"firstName" example:"John" binding:"required"`
	LastName  string `json:"lastName" example:"Doe" binding:"required"`
	Password  string `json:"password" example:"Password123" binding:"required"`
	Role      string `json:"role" example:"admin" binding:"required"`
}

NewUserRequest is a struct that contains the request body for the new user

type ResponseUser

type ResponseUser struct {
	ID        int       `json:"id" example:"1099"`
	UserName  string    `json:"user" example:"BossonH"`
	Email     string    `json:"email" example:"some@mail.com"`
	FirstName string    `json:"firstName" example:"John"`
	LastName  string    `json:"lastName" example:"Doe"`
	Status    bool      `json:"status" example:"false"`
	CreatedAt time.Time `json:"createdAt,omitempty" example:"2021-02-24 20:19:39" gorm:"autoCreateTime:mili"`
	UpdatedAt time.Time `json:"updatedAt,omitempty" example:"2021-02-24 20:19:39" gorm:"autoUpdateTime:mili"`
}

ResponseUser is a struct that contains the response body for the user

Jump to

Keyboard shortcuts

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