services

package
v0.0.0-...-e606923 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuperAdminLogin  = "superadmin"
	AdminLoginSuffix = "admin"
)
View Source
const (
	EventsBucketName = "events"
)
View Source
const (
	PropertiesBucketName = "properties"
)

Variables

View Source
var (
	PasswordRune = []byte("ABCDEFGHIJKLPQRSTUVWXYZabcdefghijkpqrstuvwxyz23456789!@")
)

Functions

func Authenticate

func Authenticate(eventService *EventService, superAdminPassword string, userId string, password string) bool

func GetActivityBucketName

func GetActivityBucketName(eventCode string) string

GetActivityBucketName is a convenient method to generate the collection name where to save activities for a specific event

func GetEventAdminLogin

func GetEventAdminLogin(eventCode string) string

func GetProperty

func GetProperty(repositoryService *RepositoryService, code string, defautValue string) string

func NewPassword

func NewPassword(length int) string

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 Property

type Property struct {
	Value string
}

type RepositoryService

type RepositoryService struct {
	Db *bolt.DB
}

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"`
}

Jump to

Keyboard shortcuts

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