18 lines
251 B
Go
18 lines
251 B
Go
package invite
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type Invite struct {
|
|
Token string
|
|
Quota int
|
|
Uses int
|
|
ExpiresAt time.Time
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
func (i *Invite) IsValid() bool {
|
|
return time.Now().UTC().Before(i.ExpiresAt) || i.Uses < i.Quota
|
|
}
|