Documentation ¶
Index ¶
- Constants
- Variables
- func New(host Subscriber, b CreatorBinding) (e Event, s EventSubscription, errs models.ValidationErrors)
- type CreatorBinding
- type Event
- func (e *Event) AttachCoverPhoto(f multipart.File) error
- func (e Event) CanDelete(host Subscriber) bool
- func (e Event) CanUpdate(host Subscriber) bool
- func (e *Event) CountGuests(db *gorm.DB) error
- func (e Event) GetHostSubscriptions(db *gorm.DB) (subs EventSubscriptions, err error)
- func (e *Event) GetHosts(db *gorm.DB) error
- func (e *Event) GetLocation(address string) error
- func (e *Event) GetMatch(guest Subscriber) error
- func (e *Event) GetRSVP(guest Subscriber, db *gorm.DB) error
- func (e Event) GetSubscription(guest Subscriber, db *gorm.DB) (s EventSubscription, err error)
- func (e Event) HasHost(host Subscriber) bool
- func (e *Event) NewGuest(guest Subscriber, rsvp RSVPType) (s EventSubscription, errs models.ValidationErrors)
- func (e *Event) NewHost(host Subscriber) (s EventSubscription, errs models.ValidationErrors)
- func (e *Event) Update(b UpdaterBinding) (errs models.ValidationErrors)
- func (e Event) Validate() (errs models.ValidationErrors)
- type EventSubscription
- type EventSubscriptions
- type Events
- func GetByGuest(guest Subscriber, offset int, db *gorm.DB) (es Events, err error)
- func GetByHost(host Subscriber, offset int, db *gorm.DB) (es Events, err error)
- func GetPastByGuest(guest Subscriber, offset int, db *gorm.DB) (es Events, err error)
- func SearchForUser(u users.User, offset int, db *gorm.DB) (es Events, err error)
- type RSVPType
- type Subscriber
- type SubscriberType
- type UpdaterBinding
Constants ¶
View Source
const ( RTNone RSVPType = "" RTGoing = "going" RTMaybe = "maybe" RTHost = "host" )
View Source
const ( STNone SubscriberType = "" STUser = "user" STOrg = "organization" )
Variables ¶
View Source
var ( ErrScanRSVPType = errors.New("Error scanning RSVP Type") ErrScanSubscriberType = errors.New("Error scanning Subscriber Type") ErrStartDate = errors.New("Invalid start date") ErrEndDate = errors.New("Invalid end date") ErrEventsNotFound = errors.New("Couldn't find any events for this search") )
Functions ¶
func New ¶
func New(host Subscriber, b CreatorBinding) (e Event, s EventSubscription, errs models.ValidationErrors)
Types ¶
type CreatorBinding ¶
type CreatorBinding struct { Title string `json:"title" form:"title" binding:"required"` StartDate string `json:"start_date" form:"start_date" binding:"required"` EndDate string `json:"end_date" form:"end_date" binding:"required"` Location string `json:"location" form:"location"` Summary string `json:"summary" form:"summary"` }
type Event ¶
type Event struct { ID string `json:"id" gorm:"primary_key" sql:"type:uuid;default:uuid_generate_v4()"` Title string `json:"title"` StartDate time.Time `json:"start_date"` EndDate time.Time `json:"end_date"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Location string `json:"location"` PoliticalMap matcher.PoliticalMap `json:"-" sql:"type:varchar(255)"` CenterX int `json:"-"` CenterY int `json:"-"` Summary string `json:"summary"` CoverPhotoURL string `json:"cover_photo_url"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Hosts []Subscriber `json:"hosts" sql:"-"` GoingCount int `json:"going_count" sql:"-"` MaybeCount int `json:"maybe_count" sql:"-"` Match float64 `json:"match" sql:"-"` RSVP RSVPType `json:"rsvp" sql:"-"` }
func (Event) CanDelete ¶
func (e Event) CanDelete(host Subscriber) bool
func (Event) CanUpdate ¶
func (e Event) CanUpdate(host Subscriber) bool
func (Event) GetHostSubscriptions ¶
func (e Event) GetHostSubscriptions(db *gorm.DB) (subs EventSubscriptions, err error)
func (*Event) GetLocation ¶
GetLocation finds the latitude/longitude by postal code
func (*Event) GetMatch ¶
func (e *Event) GetMatch(guest Subscriber) error
func (Event) GetSubscription ¶
func (e Event) GetSubscription(guest Subscriber, db *gorm.DB) (s EventSubscription, err error)
func (Event) HasHost ¶
func (e Event) HasHost(host Subscriber) bool
func (*Event) NewGuest ¶
func (e *Event) NewGuest(guest Subscriber, rsvp RSVPType) (s EventSubscription, errs models.ValidationErrors)
func (*Event) NewHost ¶
func (e *Event) NewHost(host Subscriber) (s EventSubscription, errs models.ValidationErrors)
func (*Event) Update ¶
func (e *Event) Update(b UpdaterBinding) (errs models.ValidationErrors)
func (Event) Validate ¶
func (e Event) Validate() (errs models.ValidationErrors)
type EventSubscription ¶
type EventSubscription struct { ID string `json:"id" gorm:"primary_key" sql:"type:uuid;default:uuid_generate_v4()"` SubscriberType string `json:"-"` SubscriberID string `json:"-" sql:"type:uuid"` EventID string `json:"event_id" sql:"type:uuid"` RSVP RSVPType `json:"rsvp"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Subscriber Subscriber `json:"subscriber" sql:"-"` }
type EventSubscriptions ¶
type EventSubscriptions []EventSubscription
func (*EventSubscriptions) CollectSubscribers ¶
func (subs *EventSubscriptions) CollectSubscribers(db *gorm.DB) error
func (EventSubscriptions) GetOrgIDs ¶
func (subs EventSubscriptions) GetOrgIDs() (ids []string)
func (EventSubscriptions) GetUserIDs ¶
func (subs EventSubscriptions) GetUserIDs() (ids []string)
type Events ¶
type Events []Event
func GetByGuest ¶
func GetPastByGuest ¶
func SearchForUser ¶
func (*Events) CollectMatches ¶
func (es *Events) CollectMatches(guest Subscriber)
func (*Events) CollectRSVPs ¶
func (es *Events) CollectRSVPs(guest Subscriber, db *gorm.DB) error
type Subscriber ¶
type Subscriber interface { GetID() string GetSubscriberType() string GetPoliticalMap() matcher.PoliticalMap }
type SubscriberType ¶
type SubscriberType string
func (*SubscriberType) Scan ¶
func (s *SubscriberType) Scan(src interface{}) error
type UpdaterBinding ¶
Click to show internal directories.
Click to hide internal directories.