rag/models/user.go

46 lines
1.2 KiB
Go
Raw Normal View History

2024-07-14 14:14:20 +00:00
package models
2024-06-13 07:36:51 +00:00
2024-07-15 17:48:05 +00:00
import "time"
2024-06-13 07:36:51 +00:00
type UserTokenInfo struct {
2024-07-15 17:48:05 +00:00
Aud string `json:"aud"`
Iss string `json:"iss"`
Iat float64 `json:"iat"`
Exp float64 `json:"exp"`
Sub string `json:"sub"`
Scopes []string `json:"scopes"`
Id int `json:"id"`
Uuid string `json:"uuid"`
Avatar string `json:"avatar"`
Name string `json:"name"`
EmailVerified bool `json:"email_verified"`
RealNameVerified bool `json:"real_name_verified"`
PhoneVerified bool `json:"phone_verified"`
Email string `json:"email"`
Phone string `json:"phone"`
CreatedAt time.Time `json:"created_at"`
2024-06-13 07:36:51 +00:00
}
2024-06-13 08:36:10 +00:00
2024-06-15 16:45:32 +00:00
type User struct {
Token UserTokenInfo
2024-07-14 09:44:49 +00:00
Valid bool
2024-06-15 16:45:32 +00:00
}
2024-07-14 10:14:01 +00:00
type JWTTokenTypes string
const (
JWTAccessToken JWTTokenTypes = "access_token"
JWTIDToken JWTTokenTypes = "id_token"
)
func (jwtTokenTypes JWTTokenTypes) String() string {
return string(jwtTokenTypes)
}
2024-07-14 14:29:59 +00:00
type CurrentUserResponse struct {
IP string `json:"ip"`
Valid bool `json:"valid"`
UserEmail string `json:"userEmail"`
UserId string `json:"userId"`
}