feat: update docs models responses

This commit is contained in:
d3m0k1d
2026-02-14 15:35:25 +03:00
parent 3bf3e2a233
commit 9ec570688c
6 changed files with 405 additions and 84 deletions

View File

@@ -0,0 +1,27 @@
package models
import (
"github.com/gin-gonic/gin"
)
type SuccessResponse struct {
Data interface{} `json:"data"`
}
type ErrorResponse struct {
Error ErrorDetail `json:"error"`
}
type ErrorDetail struct {
Code int `json:"code"`
Message string `json:"message"`
Detail string `json:"detail"`
}
func Success(c *gin.Context, data interface{}) {
c.JSON(200, SuccessResponse{Data: data})
}
func Error(c *gin.Context, code int, message string, detail string) {
c.JSON(code, ErrorResponse{Error: ErrorDetail{Code: code, Message: message, Detail: detail}})
}