-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentity.go
107 lines (93 loc) · 3.36 KB
/
entity.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package auth
import (
firebase_auth "firebase.google.com/go/auth"
"github.com/downsized-devs/sdk-go/null"
)
const (
revokedTokenMessage = "ID token has been revoked"
expiredTokenMessage = "ID token has expired"
)
type Token struct {
TokenType string `json:"token_type"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
}
type FirebaseUser struct {
ID string `json:"id"`
Email string `json:"email"`
IsEmailVerified null.Bool `json:"is_email_verified"`
PhoneNumber string `json:"phone_number"`
Password string `json:"password"`
DisplayName string `json:"display_name"`
PhotoURL string `json:"photo_url"`
IsDisabled null.Bool `json:"is_disabled"`
CreationTimestamp int64 `json:"creation_timestamp"`
LastLoginTimestamp int64 `json:"last_login_timestamp"`
}
type FirebaseUserParam struct {
ID string `json:"id"`
Email string `json:"email"`
PhoneNumber string `json:"phone_number"`
}
type UserAuthInfo struct {
User User `json:"user"`
FirebaseToken firebase_auth.Token `json:"firebaseToken"`
UserCredential UserCredential `json:"userCredential"`
}
type UserAuthParam struct {
User User `json:"user"`
FirebaseToken *firebase_auth.Token `json:"firebaseToken"`
UserCredential *UserCredential `json:"userCredential"`
}
type UserCredential struct {
ID int64 `db:"id" json:"id"`
UserID int64 `db:"fk_user_id" json:"userId"`
ServiceID int64 `db:"fk_service_id" json:"serviceId"`
AccessToken string `db:"access_token" json:"accessToken"`
RefreshToken string `db:"refresh_token" json:"refreshToken"`
UserAgent string `db:"user_agent" json:"userAgent"`
ExpiredAt null.Time `db:"expired_at" json:"expiredAt"`
IsRevoke bool `db:"is_revoke" json:"isRevoke"`
}
type User struct {
ID int64 `db:"id" json:"id"`
CompanyID int64 `db:"fk_company_id" json:"companyId"`
Name string `db:"name" json:"name"`
Email string `db:"email" json:"email"`
UID string `db:"uid" json:"uid"`
RoleID int64 `db:"fk_role_id" json:"roleId"`
RoleRank int64 `db:"rank" json:"roleRank"`
PhoneNumber string `db:"phone_num" json:"phoneNumber"`
IsQA bool `db:"is_qa" json:"isQa"`
}
type UserLogin struct {
Email string `json:"email"`
Password string `json:"password"`
}
type RefreshTokenRequest struct {
GrantType string `json:"grant_type"`
RefreshToken string `json:"refresh_token"`
}
type RefreshTokenResponse struct {
ExpiresIn string `json:"expires_in"`
TokenType string `json:"token_type"`
RefreshToken string `json:"refresh_token"`
IDToken string `json:"id_token"`
UserID string `json:"user_id"`
ProjectID string `json:"project_id"`
}
type UserRefreshTokenParam struct {
RefreshToken string `form:"refreshToken"`
}
type UserLoginResponse struct {
Kind string `json:"kind"`
LocalID string `json:"localId"`
Email string `json:"email"`
DisplayName string `json:"displayName"`
IDToken string `json:"idToken"`
Registered bool `json:"registered"`
ProfilePicture string `json:"profilePicture"`
RefreshToken string `json:"refreshToken"`
ExpiresIn int64 `json:"expiresIn"`
}