prompt 1,2,3

This commit is contained in:
fabio
2026-02-22 17:36:16 +01:00
parent e9d7941c7e
commit be462b814c
18 changed files with 714 additions and 3 deletions

View File

@@ -0,0 +1,21 @@
package models
import "time"
type EmailVerificationToken struct {
ID uint `gorm:"primaryKey"`
UserID uint `gorm:"not null;index"`
TokenHash string `gorm:"size:64;uniqueIndex;not null"`
ExpiresAt time.Time `gorm:"not null;index"`
CreatedAt time.Time
UpdatedAt time.Time
}
type PasswordResetToken struct {
ID uint `gorm:"primaryKey"`
UserID uint `gorm:"not null;index"`
TokenHash string `gorm:"size:64;uniqueIndex;not null"`
ExpiresAt time.Time `gorm:"not null;index"`
CreatedAt time.Time
UpdatedAt time.Time
}

18
internal/models/user.go Normal file
View File

@@ -0,0 +1,18 @@
package models
import "time"
const (
RoleAdmin = "admin"
RoleUser = "user"
)
type User struct {
ID uint `gorm:"primaryKey"`
Email string `gorm:"size:320;uniqueIndex;not null"`
PasswordHash string `gorm:"size:255;not null"`
EmailVerified bool `gorm:"not null;default:false"`
Role string `gorm:"size:32;index;not null;default:user"`
CreatedAt time.Time
UpdatedAt time.Time
}