You've already forked reloading-manager
43 lines
983 B
Go
43 lines
983 B
Go
package handlers
|
|
|
|
import (
|
|
"github.com/labstack/echo/v4"
|
|
"net/http"
|
|
)
|
|
|
|
const DateFormat = "2006-01-02 15:04:05"
|
|
|
|
type Response[T any] struct {
|
|
Status string `json:"status"`
|
|
Message string `json:"message,omitempty"`
|
|
Payload T `json:"payload"`
|
|
}
|
|
|
|
func BadRequest(c echo.Context, message string) error {
|
|
return c.JSON(http.StatusBadRequest, Response[string]{
|
|
Status: http.StatusText(http.StatusBadRequest),
|
|
Message: message,
|
|
})
|
|
}
|
|
|
|
func NotFound(c echo.Context, message string) error {
|
|
return c.JSON(http.StatusNotFound, Response[string]{
|
|
Status: http.StatusText(http.StatusNotFound),
|
|
Message: message,
|
|
})
|
|
}
|
|
|
|
type Manufacturer struct {
|
|
Id string `json:"id"`
|
|
Name string `json:"name"`
|
|
Url string `json:"url"`
|
|
}
|
|
|
|
type Powder struct {
|
|
Id string `json:"id"`
|
|
Name string `json:"name"`
|
|
Meta string `json:"meta"`
|
|
Photo string `json:"photo,omitempty"`
|
|
Manufacturer Manufacturer `json:"manufacturer"`
|
|
}
|