photoprism/internal/pro/session.go
Michael Mayer 46b9239026 Backend: Refactor user entity and add pro package
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-10-03 13:50:30 +02:00

23 lines
439 B
Go

package pro
import "time"
// Session represents photoprism.pro api session data.
type Session struct {
MaptilerKey string
ExpiresAt string
}
// Expired tests if the api session is expired.
func (p *Session) Expired() bool {
if p.ExpiresAt == "" {
return true
} else if date, err := time.Parse("2006-01-02T15:04:05", p.ExpiresAt); err != nil {
return true
} else if date.Before(time.Now()) {
return true
}
return false
}