feat: add session expiration tracking and validation

feat: implement Redis caching for terminated sessions
feat: add new session GUID queries for validation
refactor: extend Session model with last_refresh_exp_time
refactor: update token generation to include role and session
refactor: modify auth middleware to validate session status
refactor: replace GetUserSessions with GetValidUserSessions
chore: add uuid/v5 dependency
fix: update router to pass dependencies to auth middleware
chore: update SQL schema and queries for new expiration field
This commit is contained in:
2025-07-14 20:44:30 +03:00
parent 24cb8ecb6e
commit d8ea9f79c6
10 changed files with 248 additions and 74 deletions

View File

@@ -63,15 +63,16 @@ type ProfileSetting struct {
}
type Session struct {
ID int64
UserID int64
Guid pgtype.UUID
Name *string
Platform *string
LatestIp *string
LoginTime pgtype.Timestamp
LastSeenDate pgtype.Timestamp
Terminated *bool
ID int64
UserID int64
Guid pgtype.UUID
Name *string
Platform *string
LatestIp *string
LoginTime pgtype.Timestamp
LastRefreshExpTime pgtype.Timestamp
LastSeenDate pgtype.Timestamp
Terminated *bool
}
type User struct {