tfstated/pkg/model/session.go
Julien Dessaux a8ec6bd793
All checks were successful
main / main (push) Successful in 2m42s
main / deploy (push) Has been skipped
main / publish (push) Has been skipped
feat(webui): add sessions expiration
Closes #28
2025-04-18 23:34:34 +02:00

22 lines
358 B
Go

package model
import (
"time"
"go.n16f.net/uuid"
)
type SessionContextKey struct{}
type Session struct {
Id string
AccountId uuid.UUID
Created time.Time
Updated time.Time
Data any
}
func (session *Session) IsExpired() bool {
expires := session.Created.Add(12 * time.Hour) // 12 hours sessions
return time.Now().After(expires)
}