tfstated/pkg/model/session.go
Julien Dessaux 3bb5e735c6
All checks were successful
main / main (push) Successful in 3m13s
main / deploy (push) Has been skipped
main / publish (push) Has been skipped
chore(webui): rewrite all the web session code
#60
2025-04-29 01:25:11 +02:00

23 lines
388 B
Go

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