2823fb45f5
Phone+OTP auth, staged onboarding, admin approval workflow, and a full discovery/swipe/match/chat system with photo upload and approximate distance (haversine) based on user location. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
28 lines
642 B
Go
28 lines
642 B
Go
package utils
|
|
|
|
import "github.com/gin-gonic/gin"
|
|
|
|
// Response قالب استاندارد تمام پاسخهای API
|
|
type Response struct {
|
|
Success bool `json:"success"`
|
|
Message string `json:"message,omitempty"`
|
|
Data interface{} `json:"data,omitempty"`
|
|
Errors interface{} `json:"errors,omitempty"`
|
|
}
|
|
|
|
func Success(c *gin.Context, code int, message string, data interface{}) {
|
|
c.JSON(code, Response{
|
|
Success: true,
|
|
Message: message,
|
|
Data: data,
|
|
})
|
|
}
|
|
|
|
func Fail(c *gin.Context, code int, message string, errs interface{}) {
|
|
c.JSON(code, Response{
|
|
Success: false,
|
|
Message: message,
|
|
Errors: errs,
|
|
})
|
|
}
|