news

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: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNews

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

CreateNews godoc @Summary Create a new news entry @Description Create a new news entry @Tags news @Accept json @Produce json @Param news body Request true "News Entry" @Param FacilityID path string true "Facility ID" @Success 201 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /facility/{FacilityID}/news [post]

func Ctx

func Ctx(next http.Handler) http.Handler

func DeleteNews

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

DeleteNews godoc @Summary Delete a news entry @Description Delete a news entry @Tags news @Accept json @Produce json @Param id path string true "News ID" @Param FacilityID path string true "Facility ID" @Success 204 @Failure 500 {object} utils.ErrResponse @Router /facility/{FacilityID}/news/{id} [delete]

func ListNews

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

ListNews godoc @Summary List all news entries @Description List all news entries @Tags news @Accept json @Produce json @Param FacilityID path string true "Facility ID" @Success 200 {object} []Response @Failure 422 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /facility/{FacilityID}/news [get]

func NewNewsListResponse

func NewNewsListResponse(news []models.News) []render.Renderer

func PatchNews

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

PatchNews godoc @Summary Patch a news entry @Description Patch a news entry @Tags news @Accept json @Produce json @Param id path string true "News ID" @Param news body Request true "News Entry" @Param FacilityID path string true "Facility ID" @Success 200 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 404 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /facility/{FacilityID}/news/{id} [patch]

func Router

func Router(r chi.Router)

func UpdateNews

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

UpdateNews godoc @Summary Update a news entry @Description Update a news entry @Tags news @Accept json @Produce json @Param id path string true "News ID" @Param news body Request true "News Entry" @Param FacilityID path string true "Facility ID" @Success 200 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 404 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /facility/{FacilityID}/news/{id} [put]

Types

type Request

type Request struct {
	Title       string `json:"title" example:"DP001 Revision 3 Released" validate:"required"`
	Description string `` /* 139-byte string literal not displayed */
}

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.News
}

func NewNewsResponse

func NewNewsResponse(news *models.News) *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