stubbed simulations page content: sale
This commit is contained in:
@@ -78,6 +78,9 @@ func Routes(
|
||||
mockSyncGroupBeingEdited.PUT("/listings/:orderIndex/shop", response.Handler(as.setShopInListingInMockSyncGroupBeingEdited))
|
||||
mockSyncGroupBeingEdited.PUT("/listings/:orderIndex/listing", response.Handler(as.setListingInListingInMockSyncGroupBeingEdited))
|
||||
mockSyncGroupBeingEdited.DELETE("/listings/:orderIndex", response.Handler(as.deleteListingInListingInMockSyncGroupBeingEdited))
|
||||
|
||||
simulations := r.Group("/:acctID/simulations")
|
||||
simulations.POST("/sale", response.Handler(as.postNewSale))
|
||||
}
|
||||
|
||||
// POST /
|
||||
@@ -736,6 +739,32 @@ func (s *accountSubrouter) deleteListingInListingInMockSyncGroupBeingEdited(c *g
|
||||
return response.StatusOK(), nil
|
||||
}
|
||||
|
||||
// POST /:acctID/simulations/sale
|
||||
func (s *accountSubrouter) postNewSale(c *gin.Context) (response.Response, error) {
|
||||
acctID := auth.GetIdentity(c).Account.AccountID
|
||||
|
||||
var (
|
||||
shopID string
|
||||
listingID string
|
||||
count int
|
||||
)
|
||||
|
||||
if err := param.Form("shop-id", param.Text(&shopID)).
|
||||
Form("listing-id", param.Text(&listingID)).
|
||||
Form("count", param.Int(&count)).
|
||||
Unmarshal(c); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s.log.Debugf("sale posted:")
|
||||
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.StatusCreated(), nil
|
||||
}
|
||||
|
||||
func lowerSnakeCase(s accounts.Platform) string {
|
||||
return strings.ToLower(strings.Join(strings.Split(string(s), " "), "_"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user