add GET delivery count route
This commit is contained in:
@@ -69,6 +69,17 @@ func (h *Handler) GetDeliveries(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{"deliveries": deliveries})
|
||||
}
|
||||
|
||||
// GET /api/deliveries/count
|
||||
func (h *Handler) GetDeliveryCount(c *gin.Context) {
|
||||
counts, err := h.queries.GetDeliveryCount(c.Request.Context())
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to get delivery count", "details": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"counts": counts})
|
||||
}
|
||||
|
||||
// POST /api/deliveries
|
||||
func (h *Handler) CreateDelivery(c *gin.Context) {
|
||||
var req DeliveryRequest = DeliveryRequest{}
|
||||
|
||||
Reference in New Issue
Block a user