Documentation ¶
Index ¶
- func CreateUserRoles(w http.ResponseWriter, r *http.Request)
- func Ctx(next http.Handler) http.Handler
- func DeleteUserRoles(w http.ResponseWriter, r *http.Request)
- func GetSelfRoles(w http.ResponseWriter, r *http.Request)
- func NewUserRoleListResponse(userRoles []models.UserRole) []render.Renderer
- func Router(r chi.Router)
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUserRoles ¶
func CreateUserRoles(w http.ResponseWriter, r *http.Request)
CreateUserRoles godoc @Summary Create a new user role @Description Create a new user role @Tags user-roles @Accept json @Produce json @Param cid path int true "User CID" @Param user_role body Request true "User Role" @Success 201 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/{cid}/roles [post]
func DeleteUserRoles ¶
func DeleteUserRoles(w http.ResponseWriter, r *http.Request)
DeleteUserRoles godoc @Summary Remove a user role @Description Remove a user role @Tags user-roles @Accept json @Produce json @Param cid path int true "User CID" @Param role_id path string true "Role ID" @Success 204 @Failure 400 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/{cid}/roles/{role_id} [delete]
func GetSelfRoles ¶
func GetSelfRoles(w http.ResponseWriter, r *http.Request)
GetSelfRoles godoc @Summary Get your roles @Description Get roles for the user logged in @Tags user-roles @Accept json @Produce json @Param cid path int true "User CID" @Success 200 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/{cid}/roles [get]
func NewUserRoleListResponse ¶
Types ¶
type Request ¶
type Request struct { RoleID constants.RoleID `json:"role_id" example:"ATM" validate:"required"` FacilityID constants.FacilityID `json:"facility_id" example:"ZDV" validate:"required"` }
type Response ¶
type Response struct { Role constants.RoleID `json:"role" example:"ATM"` FacilityID constants.FacilityID `json:"facility_id" example:"ZDV"` CreatedAt time.Time `json:"created_at" example:"2021-01-01T00:00:00Z"` }