add GET delivery count route

This commit is contained in:
Egor Pozharov
2026-04-14 15:38:45 +06:00
parent fc46fb372f
commit 10233808f4
5 changed files with 46 additions and 1 deletions

View File

@@ -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{}