chore: sync
This commit is contained in:
11
sproutgate-backend/internal/models/pending.go
Normal file
11
sproutgate-backend/internal/models/pending.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package models
|
||||
|
||||
type PendingUser struct {
|
||||
Account string `json:"account"`
|
||||
PasswordHash string `json:"passwordHash"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
CodeHash string `json:"codeHash"`
|
||||
ExpiresAt string `json:"expiresAt"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
9
sproutgate-backend/internal/models/reset.go
Normal file
9
sproutgate-backend/internal/models/reset.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package models
|
||||
|
||||
type ResetPassword struct {
|
||||
Account string `json:"account"`
|
||||
Email string `json:"email"`
|
||||
CodeHash string `json:"codeHash"`
|
||||
ExpiresAt string `json:"expiresAt"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
9
sproutgate-backend/internal/models/secondary_email.go
Normal file
9
sproutgate-backend/internal/models/secondary_email.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package models
|
||||
|
||||
type SecondaryEmailVerification struct {
|
||||
Account string `json:"account"`
|
||||
Email string `json:"email"`
|
||||
CodeHash string `json:"codeHash"`
|
||||
ExpiresAt string `json:"expiresAt"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
52
sproutgate-backend/internal/models/user.go
Normal file
52
sproutgate-backend/internal/models/user.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type UserRecord struct {
|
||||
Account string `json:"account"`
|
||||
PasswordHash string `json:"passwordHash"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Level int `json:"level"`
|
||||
SproutCoins int `json:"sproutCoins"`
|
||||
SecondaryEmails []string `json:"secondaryEmails,omitempty"`
|
||||
Phone string `json:"phone,omitempty"`
|
||||
AvatarURL string `json:"avatarUrl,omitempty"`
|
||||
Bio string `json:"bio,omitempty"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
|
||||
type UserPublic struct {
|
||||
Account string `json:"account"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Level int `json:"level"`
|
||||
SproutCoins int `json:"sproutCoins"`
|
||||
SecondaryEmails []string `json:"secondaryEmails,omitempty"`
|
||||
Phone string `json:"phone,omitempty"`
|
||||
AvatarURL string `json:"avatarUrl,omitempty"`
|
||||
Bio string `json:"bio,omitempty"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (u UserRecord) Public() UserPublic {
|
||||
return UserPublic{
|
||||
Account: u.Account,
|
||||
Username: u.Username,
|
||||
Email: u.Email,
|
||||
Level: u.Level,
|
||||
SproutCoins: u.SproutCoins,
|
||||
SecondaryEmails: u.SecondaryEmails,
|
||||
Phone: u.Phone,
|
||||
AvatarURL: u.AvatarURL,
|
||||
Bio: u.Bio,
|
||||
CreatedAt: u.CreatedAt,
|
||||
UpdatedAt: u.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func NowISO() string {
|
||||
return time.Now().Format(time.RFC3339)
|
||||
}
|
||||
Reference in New Issue
Block a user