Documentation ¶
Index ¶
- Constants
- Variables
- func Authenticate(eventService *EventService, superAdminPassword string, userId string, ...) bool
- func GetActivityBucketName(eventCode string) string
- func GetEventAdminLogin(eventCode string) string
- func GetProperty(repositoryService *RepositoryService, code string, defautValue string) string
- func NewPassword(length int) string
- type ActivityService
- func (as *ActivityService) AddAParticipantToAnActivity(w rest.ResponseWriter, r *rest.Request)
- func (as *ActivityService) GetActivity(w rest.ResponseWriter, r *rest.Request)
- func (as *ActivityService) GetOrCreateActivity(activityCode string, eventCode string) *entities.Activity
- func (as *ActivityService) RemoveAParticipantFromAnActivity(w rest.ResponseWriter, r *rest.Request)
- func (as *ActivityService) SaveActivity(activity *entities.Activity, eventCode string) error
- func (as *ActivityService) UpdateActivityState(w rest.ResponseWriter, r *rest.Request)
- type EventService
- func (es *EventService) ConfirmAndSaveEvent(event *entities.Event) error
- func (es *EventService) ConfirmEvent(w rest.ResponseWriter, r *rest.Request)
- func (es *EventService) CreatePendingEvent(w rest.ResponseWriter, r *rest.Request)
- func (es *EventService) GetEvent(eventCode string) *entities.Event
- func (es *EventService) GetEventConfig(w rest.ResponseWriter, r *rest.Request)
- func (es *EventService) GetEventStatus(w rest.ResponseWriter, r *rest.Request)
- func (es *EventService) SaveEvent(event *entities.Event) error
- func (es *EventService) SendEventInformationByMail(w rest.ResponseWriter, r *rest.Request)
- func (es *EventService) SetEventConfig(w rest.ResponseWriter, r *rest.Request)
- type Property
- type RepositoryService
- func (es *RepositoryService) Backup(w rest.ResponseWriter, r *rest.Request)
- func (rs *RepositoryService) CommitDocument(collection string, identifier string, document interface{}) error
- func (rs *RepositoryService) CreateCollectionIfNotExists(collection string) error
- func (rs *RepositoryService) GetDocument(collection string, identifier string, document interface{}) error
- func (rs *RepositoryService) ShutDown()
- type SecurityToken
Constants ¶
const ( SuperAdminLogin = "superadmin" AdminLoginSuffix = "admin" )
const (
EventsBucketName = "events"
)
const (
PropertiesBucketName = "properties"
)
Variables ¶
var (
PasswordRune = []byte("ABCDEFGHIJKLPQRSTUVWXYZabcdefghijkpqrstuvwxyz23456789!@")
)
Functions ¶
func Authenticate ¶
func Authenticate(eventService *EventService, superAdminPassword string, userId string, password string) bool
func GetActivityBucketName ¶
GetActivityBucketName is a convenient method to generate the collection name where to save activities for a specific event
func GetEventAdminLogin ¶
func GetProperty ¶
func GetProperty(repositoryService *RepositoryService, code string, defautValue string) string
func NewPassword ¶
NewPassword generates random passwords Inspired by "github.com/cmiceli/password-generator-go"
Types ¶
type ActivityService ¶
type ActivityService struct {
RepositoryService *RepositoryService
}
func (*ActivityService) AddAParticipantToAnActivity ¶
func (as *ActivityService) AddAParticipantToAnActivity(w rest.ResponseWriter, r *rest.Request)
AddAParticipantToAnActivity adds a participant to an activity
func (*ActivityService) GetActivity ¶
func (as *ActivityService) GetActivity(w rest.ResponseWriter, r *rest.Request)
GetActivity returns an activity by its code or inits a new activity without saving it to the database
func (*ActivityService) GetOrCreateActivity ¶
func (as *ActivityService) GetOrCreateActivity(activityCode string, eventCode string) *entities.Activity
GetOrCreateActivity gets an activity from bolt database or creates a new one (without saving it to the database)
func (*ActivityService) RemoveAParticipantFromAnActivity ¶
func (as *ActivityService) RemoveAParticipantFromAnActivity(w rest.ResponseWriter, r *rest.Request)
RemoveAParticipantFromAnActivity removes a participant from an activity
func (*ActivityService) SaveActivity ¶
func (as *ActivityService) SaveActivity(activity *entities.Activity, eventCode string) error
SaveActivity saves an activity to the bolt database
func (*ActivityService) UpdateActivityState ¶
func (as *ActivityService) UpdateActivityState(w rest.ResponseWriter, r *rest.Request)
UpdateActivityState updates activity state
type EventService ¶
type EventService struct { RepositoryService *RepositoryService EmailRelay *email.EmailRelay Secret string }
func (*EventService) ConfirmAndSaveEvent ¶
func (es *EventService) ConfirmAndSaveEvent(event *entities.Event) error
ConfirmAndSaveEvent confirms an event an init activities collection for this event
func (*EventService) ConfirmEvent ¶
func (es *EventService) ConfirmEvent(w rest.ResponseWriter, r *rest.Request)
ConfirmEvent validates an event (link from a event confirmation email)
func (*EventService) CreatePendingEvent ¶
func (es *EventService) CreatePendingEvent(w rest.ResponseWriter, r *rest.Request)
CreatePendingEvent creates a new pending confirmation event
func (*EventService) GetEvent ¶
func (es *EventService) GetEvent(eventCode string) *entities.Event
GetEvent gets an event from database
func (*EventService) GetEventConfig ¶
func (es *EventService) GetEventConfig(w rest.ResponseWriter, r *rest.Request)
GetEventConfig returns the config field value
func (*EventService) GetEventStatus ¶
func (es *EventService) GetEventStatus(w rest.ResponseWriter, r *rest.Request)
GetEventStatus returns an event state (can be used to check if an event code is used or not)
func (*EventService) SaveEvent ¶
func (es *EventService) SaveEvent(event *entities.Event) error
SaveEvent saves an event to the database
func (*EventService) SendEventInformationByMail ¶
func (es *EventService) SendEventInformationByMail(w rest.ResponseWriter, r *rest.Request)
SendEventInformationByMail sends an email to the event admin with the event informations
func (*EventService) SetEventConfig ¶
func (es *EventService) SetEventConfig(w rest.ResponseWriter, r *rest.Request)
SetEventConfig updates the config field
type RepositoryService ¶
func NewRepositoryService ¶
func NewRepositoryService(dbFilePath string) *RepositoryService
NewRepositoryService opens existing database or creates a new one
func (*RepositoryService) Backup ¶
func (es *RepositoryService) Backup(w rest.ResponseWriter, r *rest.Request)
GetBackup returns the database dump
func (*RepositoryService) CommitDocument ¶
func (rs *RepositoryService) CommitDocument(collection string, identifier string, document interface{}) error
CommitDocument commits a document to the database (create / update)
func (*RepositoryService) CreateCollectionIfNotExists ¶
func (rs *RepositoryService) CreateCollectionIfNotExists(collection string) error
CreateCollectionIfNotExists creates a new document collection
func (*RepositoryService) GetDocument ¶
func (rs *RepositoryService) GetDocument(collection string, identifier string, document interface{}) error
GetDocument gets a document from a collection
func (*RepositoryService) ShutDown ¶
func (rs *RepositoryService) ShutDown()
ShutDown closes the database (do defer this)
type SecurityToken ¶
type SecurityToken struct {
Token string `json:"token"`
}