feat: add services and separate further

This commit is contained in:
2026-04-29 13:25:38 +02:00
parent 6c28aea655
commit 8f6b1efea0
16 changed files with 318 additions and 168 deletions
+9
View File
@@ -0,0 +1,9 @@
package assets
import "time"
type KeyRequestBody struct {
Name string `json:"name"`
// post request must contain valid: RFC3339 timestamp
ExpiresAt time.Time `json:"expiresAt"`
}
+45
View File
@@ -0,0 +1,45 @@
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,
})
}