Files
orbits/internal/server/api/assets/response.go
T

46 lines
1.0 KiB
Go

package assets
import (
"net/http"
"time"
"github.com/gin-gonic/gin"
)
const (
OkMes string = "OK"
IntErrMes string = "An internal error occured, contact your administrator"
)
type BasicResponse struct {
Msg string `json:"msg"`
Data any `json:"data"`
}
// we swap out the hash for the keycontent
type KeyResponse struct {
ID int `json:"id"`
MetaName string `json:"metaName"`
KeyName string `json:"keyName"`
KeyContent string `json:"keyContent"`
Revoked bool `json:"revoked"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
ExpiresAt time.Time `json:"expiresAt"`
}
type FileResponse struct {
ID int `json:"id"`
MetaName string `json:"metaName"`
FileName string `json:"fileName"`
MediaType string `json:"mediaType"`
CreatedAt time.Time `json:"createdAt"`
ExpiresAt time.Time `json:"expiresAt"`
}
func InternalErrorResponse(c *gin.Context) {
c.JSON(http.StatusInternalServerError, BasicResponse{
Msg: IntErrMes,
})
}