Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BalancesQuery ¶
type BalancesQuery struct {
Ids []string `query:"ids[]"`
}
type Handlers ¶
type Handlers struct { Db db.Db Log *zap.SugaredLogger }
Handlers is the overall struct for all http request handlers
func (Handlers) GetStockBalances ¶
GetStockBalances godoc @Summary Get stock balances @Description Gets a list of all stock and their balances @ID get-stock-balances @Accept json @Produce json @Param ids[] query string false "Array of ids" @Success 200 {object} map[string]db.StockItem @Failure 500 {object} []ResJSONError @Router /stock-balances [get]
func (Handlers) PostAddStockItems ¶
PostAddStockItems godoc @Summary Add stock balances @ID add-balances @Accept json @Produce json @Param body body []db.StockItem true "Array of stock items to add balances to" @Success 200 {string} JSON string "OK" @Failure 400 {object} []ResJSONError @Failure 500 {object} []ResJSONError @Router /add-stock-items [post]
func (Handlers) PostSubtractStockItems ¶
PostSubtractStockItems godoc @Summary Subtract stock balances @ID subtract-balances @Accept json @Produce json @Param body body []StockItemAdjuster true "Array of stock items to subtract balance in" @Success 200 {string} JSON string "OK" @Failure 400 {object} []ResJSONError @Failure 500 {object} []ResJSONError @Router /subtract-stock-items [post]
func (Handlers) RequireJSON ¶
RequireJSON is a middleware that makes sure the request content-type always is application/json (or nothing, defaulting to application/json)
type ResJSONError ¶
ResJSONError is an error field that is used in JSON error responses
type StockItemAdjuster ¶
Used when adjusting the balance of a StockItem