fatto ordine
This commit is contained in:
71
models.go
Normal file
71
models.go
Normal file
@@ -0,0 +1,71 @@
|
||||
package main
|
||||
|
||||
// Subscriber maps the subscribers table.
|
||||
type Subscriber struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;autoIncrement"`
|
||||
Email string `gorm:"column:email;uniqueIndex;not null"`
|
||||
IPAddress string `gorm:"column:ip_address;not null"`
|
||||
UserAgent string `gorm:"column:user_agent;not null"`
|
||||
AcceptLanguage string `gorm:"column:accept_language"`
|
||||
BrowserData string `gorm:"column:browser_data"`
|
||||
CreatedAt string `gorm:"column:created_at;not null"`
|
||||
}
|
||||
|
||||
func (Subscriber) TableName() string {
|
||||
return "subscribers"
|
||||
}
|
||||
|
||||
// User maps the users table.
|
||||
type User struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;autoIncrement"`
|
||||
Email string `gorm:"column:email;uniqueIndex;not null"`
|
||||
PasswordHash string `gorm:"column:password_hash;not null"`
|
||||
EmailVerified int `gorm:"column:email_verified;not null;default:0"`
|
||||
CreatedAt string `gorm:"column:created_at;not null"`
|
||||
UpdatedAt string `gorm:"column:updated_at;not null"`
|
||||
}
|
||||
|
||||
func (User) TableName() string {
|
||||
return "users"
|
||||
}
|
||||
|
||||
// Session maps the sessions table.
|
||||
type Session struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;autoIncrement"`
|
||||
UserID int64 `gorm:"column:user_id;not null;index"`
|
||||
TokenHash string `gorm:"column:token_hash;uniqueIndex;not null"`
|
||||
ExpiresAt int64 `gorm:"column:expires_at;not null"`
|
||||
CreatedAt string `gorm:"column:created_at;not null"`
|
||||
}
|
||||
|
||||
func (Session) TableName() string {
|
||||
return "sessions"
|
||||
}
|
||||
|
||||
// PasswordResetToken maps the password_reset_tokens table.
|
||||
type PasswordResetToken struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;autoIncrement"`
|
||||
UserID int64 `gorm:"column:user_id;not null;index"`
|
||||
TokenHash string `gorm:"column:token_hash;uniqueIndex;not null"`
|
||||
ExpiresAt int64 `gorm:"column:expires_at;not null"`
|
||||
UsedAt *int64 `gorm:"column:used_at"`
|
||||
CreatedAt string `gorm:"column:created_at;not null"`
|
||||
}
|
||||
|
||||
func (PasswordResetToken) TableName() string {
|
||||
return "password_reset_tokens"
|
||||
}
|
||||
|
||||
// EmailVerificationToken maps the email_verification_tokens table.
|
||||
type EmailVerificationToken struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;autoIncrement"`
|
||||
UserID int64 `gorm:"column:user_id;not null;index"`
|
||||
TokenHash string `gorm:"column:token_hash;uniqueIndex;not null"`
|
||||
ExpiresAt int64 `gorm:"column:expires_at;not null"`
|
||||
UsedAt *int64 `gorm:"column:used_at"`
|
||||
CreatedAt string `gorm:"column:created_at;not null"`
|
||||
}
|
||||
|
||||
func (EmailVerificationToken) TableName() string {
|
||||
return "email_verification_tokens"
|
||||
}
|
||||
Reference in New Issue
Block a user