services

package
v1.0.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LdapService

type LdapService struct {
	Conn              *ldap.Conn
	Bind              string
	Password          string
	UserSearchBase    string
	SocietySearchBase string
	GroupSearchBase   string
	SearchBase        string
}

func NewLdap

func NewLdap(config *config.Config) *LdapService

type MongoDatastore

type MongoDatastore struct {
	Session *mongo.Client
	// contains filtered or unexported fields
}

func NewDatastore

func NewDatastore(config *config.Config) *MongoDatastore

func (*MongoDatastore) GetAllEvents

func (ds *MongoDatastore) GetAllEvents() ([]models.EventDetails, error)

func (*MongoDatastore) GetAllPastEvents

func (ds *MongoDatastore) GetAllPastEvents() ([]models.DatabaseEvent, error)

func (*MongoDatastore) GetAllPastEventsForSocID

func (ds *MongoDatastore) GetAllPastEventsForSocID(socID int) ([]models.DatabaseEvent, error)

func (*MongoDatastore) GetAllSocieties

func (ds *MongoDatastore) GetAllSocieties() (map[string]models.Society, error)

func (*MongoDatastore) GetAllUpcomingEvents

func (ds *MongoDatastore) GetAllUpcomingEvents() ([]models.DatabaseEvent, error)

func (*MongoDatastore) GetAllUpcomingEventsForSocID

func (ds *MongoDatastore) GetAllUpcomingEventsForSocID(socID int) ([]models.DatabaseEvent, error)

TODO Theres a bug in here somewhere relating to recent (within an hour) events not showing up

func (*MongoDatastore) GetSocietyBySocietyName

func (ds *MongoDatastore) GetSocietyBySocietyName(societyName string) (*models.Society, error)

func (*MongoDatastore) UpsertEvents

func (ds *MongoDatastore) UpsertEvents(events []models.DatabaseEvent) error

* Event Database Helpers

func (*MongoDatastore) UpsertSociety

func (ds *MongoDatastore) UpsertSociety(society models.Society) error

* Society Database Helpers

type SchedulerService

type SchedulerService struct {
	Config    *config.Config
	Datastore *MongoDatastore
	Scheduler *gocron.Scheduler
}

func NewSchedulerService

func NewSchedulerService(config *config.Config) *SchedulerService

func (*SchedulerService) DoGetAllEvents

func (s *SchedulerService) DoGetAllEvents()

func (*SchedulerService) RunAllServices

func (s *SchedulerService) RunAllServices()

type SocietiesPortalService

type SocietiesPortalService struct {
	Datastore                                *MongoDatastore
	WebservicesEndpoint                      string
	AjaxEndpoint                             string
	WebservicesUsername                      string
	WebservicesPassword                      string
	WebservicesMemberServiceMethodIndividual string
	WebservicesMemberServiceMethodAll        string
	WebservicesMemberServiceSearchByOption   string
	EventService                             string
	EventServiceMethodAll                    string
	EventServiceMethodIndividual             string
	EventServiceAction                       string
}

func NewSocietiesPortalService

func NewSocietiesPortalService(config *config.Config, datastore *MongoDatastore) *SocietiesPortalService

func (*SocietiesPortalService) GetAllEvents

func (s *SocietiesPortalService) GetAllEvents(onlyUpcomingEvents bool) ([]models.Event, error)

func (*SocietiesPortalService) GetAllEventsDetails

func (s *SocietiesPortalService) GetAllEventsDetails(eventDetailIDs []int) (map[int]models.EventDetails, error)

Here we're gettings the eventDetailsIDs and contacting the Socs Poral to get details on every event. The idea then is to save them to the database so we're not annoying Socs Portal every time we want to find out about our events.

func (*SocietiesPortalService) GetEventsForSocID

func (s *SocietiesPortalService) GetEventsForSocID(socID string) ([]models.Event, error)

This contacts the Socs Portal to get the list of past and upcoming events. We then have no use for the rest of the data as it doesn't give us enough details anyways. So we've to contact the Socs Portal again on a seperate API for every eventID we get. This function just returns an array of eventDetailsIDs as strings.

func (*SocietiesPortalService) GetMemberFromSocietiesPortal

func (s *SocietiesPortalService) GetMemberFromSocietiesPortal(memberID string) (*models.SocietyMember, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL