Initial commit
This commit is contained in:
28
storage/events.go
Normal file
28
storage/events.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package storage
|
||||
|
||||
import "time"
|
||||
|
||||
type Event struct {
|
||||
ID string `json:"id" bson:"_id"`
|
||||
Namespace string `json:"namespace"`
|
||||
Owners []string `json:"owners"`
|
||||
RestrictedTo []string `json:"restricted_to"`
|
||||
Type string `json:"type"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Startdate time.Time `json:"startdate"`
|
||||
Enddate time.Time `json:"enddate"`
|
||||
Starttime string `json:"starttime"`
|
||||
Endtime string `json:"endtime"`
|
||||
Allday bool `json:"allday"`
|
||||
MaxSubscribers int64 `json:"max_subscribers"`
|
||||
Subscribers []string `json:"subscribers" bson:"subscribers,omitempty`
|
||||
Data map[string]any `json:"data"`
|
||||
}
|
||||
|
||||
func (e Event) RemainingSubscriptions() int {
|
||||
if e.MaxSubscribers == 0 {
|
||||
return 999
|
||||
}
|
||||
return int(e.MaxSubscribers) - len(e.Subscribers)
|
||||
}
|
||||
Reference in New Issue
Block a user