24 lines
456 B
Go
24 lines
456 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
func (h *Handler) PostSeed(c echo.Context) error {
|
|
rows, err := h.DataClient.Seed()
|
|
if err != nil {
|
|
return c.JSON(http.StatusInternalServerError, map[string]string{
|
|
"message": "Seed failed",
|
|
"error": err.Error(),
|
|
})
|
|
}
|
|
|
|
return c.JSON(http.StatusOK, map[string]interface{}{
|
|
"message": "Seed successful",
|
|
"data": map[string]interface{}{
|
|
"rows": rows,
|
|
},
|
|
})
|
|
}
|