stubbed simulations page content: set inventory
This commit is contained in:
@@ -82,6 +82,7 @@ func Routes(
|
||||
simulations := r.Group("/:acctID/simulations")
|
||||
simulations.POST("/sale", response.Handler(as.postNewSale))
|
||||
simulations.POST("/refund", response.Handler(as.postNewRefund))
|
||||
simulations.PUT("/shops/:shopID/listings/:listingID/count", response.Handler(as.setListingCount))
|
||||
}
|
||||
|
||||
// POST /
|
||||
@@ -792,6 +793,32 @@ func (s *accountSubrouter) postNewRefund(c *gin.Context) (response.Response, err
|
||||
return response.StatusCreated(), nil
|
||||
}
|
||||
|
||||
// PUT /:acctID/simulations/shops/:shopID/listings/:listingID/count
|
||||
func (s *accountSubrouter) setListingCount(c *gin.Context) (response.Response, error) {
|
||||
acctID := auth.GetIdentity(c).Account.AccountID
|
||||
|
||||
var (
|
||||
shopID string
|
||||
listingID string
|
||||
count int
|
||||
)
|
||||
|
||||
if err := param.Path("shopID", param.Text(&shopID)).
|
||||
Path("listingID", param.Text(&listingID)).
|
||||
Form("count", param.Int(&count)).
|
||||
Unmarshal(c); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s.log.Debugf("listing inventory set:")
|
||||
s.log.Debugf(" account: %d", acctID)
|
||||
s.log.Debugf(" shop: %s", shopID)
|
||||
s.log.Debugf(" listing: %s", listingID)
|
||||
s.log.Debugf(" count: %d", count)
|
||||
|
||||
return response.StatusOK(), nil
|
||||
}
|
||||
|
||||
func lowerSnakeCase(s accounts.Platform) string {
|
||||
return strings.ToLower(strings.Join(strings.Split(string(s), " "), "_"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user