27 lines
525 B
Go
27 lines
525 B
Go
package common
|
|
|
|
import (
|
|
"net/http"
|
|
"users_management/m/model/dto/res"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func SingleResponses(ctx *gin.Context, description string, data any) {
|
|
ctx.JSON(http.StatusOK, res.SingleResponses{
|
|
Status: res.Status{
|
|
Code: http.StatusCreated,
|
|
Description: description,
|
|
},
|
|
Data: data,
|
|
})
|
|
}
|
|
|
|
func ErrorResponses(ctx *gin.Context, code int, description string) {
|
|
ctx.JSON(code, res.SingleResponses{
|
|
Status: res.Status{
|
|
Code: code,
|
|
Description: description,
|
|
},
|
|
})
|
|
} |