mirror of
https://github.com/serty2005/rmser.git
synced 2026-02-04 19:02:33 -06:00
0302-добавил куки и сломал десктоп авторизацию.
сложно поддерживать однояйцевых близнецов - desktop и TMA, подготовил к рефакторингу структуры
This commit is contained in:
@@ -88,6 +88,18 @@ type RMSServer struct {
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// Session - Сессия пользователя для аутентификации
|
||||
type Session struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()"`
|
||||
UserID uuid.UUID `gorm:"type:uuid;not null;index"`
|
||||
RefreshToken string `gorm:"type:varchar(255);not null;index"` // Уникальный токен сессии
|
||||
UserAgent string `gorm:"type:varchar(255)"`
|
||||
IP string `gorm:"type:varchar(50)"`
|
||||
ExpiresAt time.Time `gorm:"index"`
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time // Для отслеживания sliding expiration
|
||||
}
|
||||
|
||||
// Repository интерфейс
|
||||
type Repository interface {
|
||||
// Users
|
||||
@@ -151,4 +163,10 @@ type Repository interface {
|
||||
UpdateLastSync(serverID uuid.UUID) error
|
||||
// GetServersForSync возвращает серверы, готовые для синхронизации
|
||||
GetServersForSync(idleThreshold time.Duration) ([]RMSServer, error)
|
||||
|
||||
// === Session Management ===
|
||||
CreateSession(session *Session) error
|
||||
GetSessionByToken(token string) (*Session, error)
|
||||
UpdateSessionExpiry(sessionID uuid.UUID, newExpiry time.Time) error
|
||||
DeleteSession(token string) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user