feat(07-02): add user session schema, throttle table, and jwt config
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
22
models/throttle.go
Normal file
22
models/throttle.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// Throttle is one failed-login counter, keyed by user and optional IP.
|
||||
type Throttle struct {
|
||||
ID uint `gorm:"column:id;primaryKey"`
|
||||
UserID uint `gorm:"column:user_id"`
|
||||
IPAddress *string `gorm:"column:ip_address"`
|
||||
Attempts int `gorm:"column:attempts"`
|
||||
IsSuspended bool `gorm:"column:is_suspended"`
|
||||
SuspendedAt *time.Time `gorm:"column:suspended_at"`
|
||||
IsBanned bool `gorm:"column:is_banned"`
|
||||
CreatedAt time.Time `gorm:"column:created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at"`
|
||||
}
|
||||
|
||||
func (Throttle) TableName() string { return "user_throttle" }
|
||||
|
||||
func init() {
|
||||
Register(Throttle{})
|
||||
}
|
||||
Reference in New Issue
Block a user