feat(server): step usage counts endpoint

This commit is contained in:
2026-07-21 11:31:05 +01:00
parent d0442291f5
commit 93423e32e6
3 changed files with 97 additions and 0 deletions
+10
View File
@@ -23,6 +23,7 @@ func registerWorkflowRoutes(g *gin.RouterGroup) {
g.GET("/steps/:id/export", exportStep)
g.POST("/steps/import", importStep)
g.POST("/steps/seed-defaults", seedDefaults)
g.GET("/steps/usage", stepUsage)
g.POST("/steps/parse", parseStep)
g.GET("/workflows", listWorkflows)
@@ -154,6 +155,15 @@ func listSteps(c *gin.Context) {
c.JSON(http.StatusOK, steps)
}
func stepUsage(c *gin.Context) {
counts, err := services.StepUsageCounts()
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
c.JSON(http.StatusOK, counts)
}
func createStep(c *gin.Context) {
var s models.WorkflowStep
if err := c.ShouldBindJSON(&s); err != nil {