/
types.go
37 lines (33 loc) · 901 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package db
import "github.com/gin-gonic/gin"
type ErrorResponse struct {
Status int
Message error
Type string
}
type TokenResponse struct {
RefreshToken string `json:"refresh_token"`
AccessToken string `json:"access_token"`
}
type GoogleUserInfoType struct {
Id string `json:"id"`
Email string `json:"email"`
VerifiedEmail bool `json:"verified_email"`
Name string `json:"name"` // full name
GivenName string `json:"given_name"` // first name
FamilyName string `json:"family_name"` // last name
Picture string `json:"picture"`
Locale string `json:"locale"`
}
var Roles []string = []string{
"customer",
"driver",
"merchant",
}
func (e *ErrorResponse) Error(c *gin.Context) {
if e.Type == "string" {
c.String(e.Status, e.Message.Error())
return
}
c.JSON(e.Status, e.Message)
}