rating_change

package
v0.0.0-...-48f5382 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRatingChange

func CreateRatingChange(w http.ResponseWriter, r *http.Request)

CreateRatingChange godoc @Summary Create a new rating change @Description Create a new rating change @Tags rating-change @Accept json @Produce json @Param cid path int true "CID" @Param rating_change body Request true "Rating Change" @Success 201 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/{cid}/rating-change [post]

func Ctx

func Ctx(next http.Handler) http.Handler

func DeleteRatingChange

func DeleteRatingChange(w http.ResponseWriter, r *http.Request)

DeleteRatingChange godoc @Summary Delete a rating change @Description Delete a rating change @Tags rating-change @Accept json @Produce json @Param id path int true "Rating Change ID" @Success 204 @Failure 400 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/{cid}/rating-change/{id} [delete]

func ListRatingChanges

func ListRatingChanges(w http.ResponseWriter, r *http.Request)

ListRatingChanges godoc @Summary List rating changes @Description List rating changes @Tags rating-change @Accept json @Produce json @Param cid path int true "CID" @Success 200 {object} []Response @Failure 422 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/{cid}/rating-change [get]

func NewRatingChangeListResponse

func NewRatingChangeListResponse(rc []models.RatingChange) []render.Renderer

func PatchRatingChange

func PatchRatingChange(w http.ResponseWriter, r *http.Request)

PatchRatingChange godoc @Summary Patch a rating change @Description Patch a rating change @Tags rating-change @Accept json @Produce json @Param cid path int true "CID" @Param id path int true "Rating Change ID" @Param rating_change body Request true "Rating Change" @Success 200 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 404 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/{cid}/rating-change/{id} [patch]

func Router

func Router(r chi.Router)

func UpdateRatingChange

func UpdateRatingChange(w http.ResponseWriter, r *http.Request)

UpdateRatingChange godoc @Summary Update a rating change @Description Update a rating change @Tags rating-change @Accept json @Produce json @Param cid path int true "CID" @Param id path int true "Rating Change ID" @Param rating_change body Request true "Rating Change" @Success 200 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 404 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/{cid}/rating-change/{id} [put]

Types

type Request

type Request struct {
	OldRating constants.ATCRating `json:"old_rating" example:"1" validate:"required"`
	NewRating constants.ATCRating `json:"new_rating" example:"2" validate:"required"`
}

func (*Request) Bind

func (req *Request) Bind(r *http.Request) error

func (*Request) Validate

func (req *Request) Validate() error

type Response

type Response struct {
	*models.RatingChange
}

func NewRatingChangeResponse

func NewRatingChangeResponse(rc *models.RatingChange) *Response

func (*Response) Render

func (res *Response) Render(w http.ResponseWriter, r *http.Request) error

Jump to

Keyboard shortcuts

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