postgres
This commit is contained in:
+14
-16
@@ -2,16 +2,14 @@ package auth
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ID bson.ObjectID `json:"id" bson:"_id"`
|
||||
Username string `json:"username" bson:"username"`
|
||||
Email string `json:"email" bson:"email"`
|
||||
PasswordHash string `json:"-" bson:"password_hash"`
|
||||
CreatedAt time.Time `json:"created_at" bson:"created_at"`
|
||||
ID string `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
PasswordHash string `json:"-"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type RegisterRequest struct {
|
||||
@@ -40,18 +38,18 @@ type LogoutRequest struct {
|
||||
}
|
||||
|
||||
type RefreshTokenDoc struct {
|
||||
ID bson.ObjectID `json:"id" bson:"_id"`
|
||||
UserID bson.ObjectID `json:"user_id" bson:"user_id"`
|
||||
TokenHash string `json:"token_hash" bson:"token_hash"`
|
||||
ExpiresAt time.Time `json:"expires_at" bson:"expires_at"`
|
||||
CreatedAt time.Time `json:"created_at" bson:"created_at"`
|
||||
ID string `json:"id"`
|
||||
UserID string `json:"user_id"`
|
||||
TokenHash string `json:"token_hash"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type UserPublic struct {
|
||||
ID bson.ObjectID `json:"id" bson:"_id"`
|
||||
Username string `json:"username" bson:"username"`
|
||||
Email string `json:"email" bson:"email"`
|
||||
CreatedAt time.Time `json:"created_at" bson:"created_at"`
|
||||
ID string `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func NewUserPublic(u *User) UserPublic {
|
||||
|
||||
Reference in New Issue
Block a user