Fix swagger deps
This commit is contained in:
parent
28f068c890
commit
f63210272d
28 changed files with 307 additions and 310 deletions
|
@ -6,25 +6,24 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"gitlab.unjx.de/flohoss/cafe-plaetschwiesle/internal/types"
|
||||
)
|
||||
|
||||
// @Schemes
|
||||
// @Summary get all bills
|
||||
// @Description gets all bills as array
|
||||
// @Tags bills
|
||||
// @Produce json
|
||||
// @Param year query int true "year"
|
||||
// @Param month query int true "month (1-12)"
|
||||
// @Param day query int true "day (1-31)"
|
||||
// @Success 200 {array} Bill
|
||||
// @Router /bills [get]
|
||||
// @Schemes
|
||||
// @Summary get all bills
|
||||
// @Description gets all bills as array
|
||||
// @Tags bills
|
||||
// @Produce json
|
||||
// @Param year query int true "year"
|
||||
// @Param month query int true "month (1-12)"
|
||||
// @Param day query int true "day (1-31)"
|
||||
// @Success 200 {array} Bill
|
||||
// @Router /bills [get]
|
||||
func (c *Controller) GetBills(ctx echo.Context) error {
|
||||
year := ctx.QueryParam("year")
|
||||
month := ctx.QueryParam("month")
|
||||
day := ctx.QueryParam("day")
|
||||
if year == "" || month == "" || day == "" {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, types.MissingInformation.String())
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, MissingInformation.String())
|
||||
}
|
||||
bills, err := c.GetAllBills(year, month, day)
|
||||
if err != nil {
|
||||
|
@ -33,14 +32,14 @@ func (c *Controller) GetBills(ctx echo.Context) error {
|
|||
return ctx.JSON(http.StatusOK, bills)
|
||||
}
|
||||
|
||||
// @Schemes
|
||||
// @Summary get all billItems
|
||||
// @Description gets all billItems for bill
|
||||
// @Tags bills
|
||||
// @Produce json
|
||||
// @Param bill query int true "Bill ID"
|
||||
// @Success 200 {array} BillItem
|
||||
// @Router /bills/items [get]
|
||||
// @Schemes
|
||||
// @Summary get all billItems
|
||||
// @Description gets all billItems for bill
|
||||
// @Tags bills
|
||||
// @Produce json
|
||||
// @Param bill query int true "Bill ID"
|
||||
// @Success 200 {array} BillItem
|
||||
// @Router /bills/items [get]
|
||||
func (c *Controller) GetBillItems(ctx echo.Context) error {
|
||||
bill, err := c.DoesBillExist(ctx.QueryParam("bill"))
|
||||
if err != nil {
|
||||
|
@ -53,21 +52,21 @@ func (c *Controller) GetBillItems(ctx echo.Context) error {
|
|||
return ctx.JSON(http.StatusOK, billItems)
|
||||
}
|
||||
|
||||
// @Schemes
|
||||
// @Summary create new bill
|
||||
// @Description creates a new bill and returns it
|
||||
// @Tags bills
|
||||
// @Produce json
|
||||
// @Param table query int true "Table ID"
|
||||
// @Param filter query string false "filter"
|
||||
// @Success 201 {object} Bill
|
||||
// @Failure 404 "Not Found"
|
||||
// @Failure 500 "Internal Server Error"
|
||||
// @Router /bills [post]
|
||||
// @Schemes
|
||||
// @Summary create new bill
|
||||
// @Description creates a new bill and returns it
|
||||
// @Tags bills
|
||||
// @Produce json
|
||||
// @Param table query int true "Table ID"
|
||||
// @Param filter query string false "filter"
|
||||
// @Success 201 {object} Bill
|
||||
// @Failure 404 "Not Found"
|
||||
// @Failure 500 "Internal Server Error"
|
||||
// @Router /bills [post]
|
||||
func (c *Controller) CreateBill(ctx echo.Context) error {
|
||||
table, tableErr := strconv.ParseUint(ctx.QueryParam("table"), 10, 64)
|
||||
if tableErr != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, types.MissingInformation.String())
|
||||
return echo.NewHTTPError(http.StatusBadRequest, MissingInformation.String())
|
||||
}
|
||||
stringFiler := ctx.QueryParam("filter")
|
||||
var filter []string
|
||||
|
@ -81,16 +80,16 @@ func (c *Controller) CreateBill(ctx echo.Context) error {
|
|||
return ctx.JSON(http.StatusCreated, bill)
|
||||
}
|
||||
|
||||
// @Schemes
|
||||
// @Summary delete a bill
|
||||
// @Description deletes a bill
|
||||
// @Tags bills
|
||||
// @Produce json
|
||||
// @Param id path int true "Bill ID"
|
||||
// @Success 200 "OK"
|
||||
// @Failure 404 "Not Found"
|
||||
// @Failure 500 "Internal Server Error"
|
||||
// @Router /bills/{id} [delete]
|
||||
// @Schemes
|
||||
// @Summary delete a bill
|
||||
// @Description deletes a bill
|
||||
// @Tags bills
|
||||
// @Produce json
|
||||
// @Param id path int true "Bill ID"
|
||||
// @Success 200 "OK"
|
||||
// @Failure 404 "Not Found"
|
||||
// @Failure 500 "Internal Server Error"
|
||||
// @Router /bills/{id} [delete]
|
||||
func (c *Controller) DeleteBill(ctx echo.Context) error {
|
||||
id := ctx.Param("id")
|
||||
bill, err := c.DoesBillExist(id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue