Documentation
¶
Index ¶
- type Config
- type ContactUserTemplate
- type Context
- type DocumentTemplate
- type InternalContext
- type ManagerTemplate
- type NewsTemplate
- type PlayerTemplate
- type ProgrammeTemplate
- type ProgrammeTemplateStruct
- type RedisConfig
- type SMTPConfig
- type SeasonTemplate
- type SecurityConfig
- type SponsorTemplate
- type TeamTemplate
- type TemplateHelper
- type UserTemplate
- type Views
- func (v *Views) AccountFunc(c echo.Context) error
- func (v *Views) AffiliationAddFunc(c echo.Context) error
- func (v *Views) AffiliationDeleteFunc(c echo.Context) error
- func (v *Views) ChangePasswordFunc(c echo.Context) error
- func (v *Views) ContactFunc(c echo.Context) error
- func (v *Views) CustomHTTPErrorHandler(err error, c echo.Context)
- func (v *Views) DeleteResetToken(ctx context.Context, token string)
- func (v *Views) DocumentAddFunc(c echo.Context) error
- func (v *Views) DocumentDeleteFunc(c echo.Context) error
- func (v *Views) DocumentsFunc(c echo.Context) error
- func (v *Views) DownloadFunc(c echo.Context) error
- func (v *Views) Error404(c echo.Context) error
- func (v *Views) GalleryFunc(c echo.Context) error
- func (v *Views) GetResetToken(ctx context.Context, token string) (int, bool)
- func (v *Views) GetVisitorCount() int
- func (v *Views) HomeFunc(c echo.Context) error
- func (v *Views) ImageAddFunc(c echo.Context) error
- func (v *Views) ImageDeleteFunc(c echo.Context) error
- func (v *Views) InfoEditFunc(c echo.Context) error
- func (v *Views) InfoFunc(c echo.Context) error
- func (v *Views) LoginFunc(c echo.Context) error
- func (v *Views) LogoutFunc(c echo.Context) error
- func (v *Views) NewsAddFunc(c echo.Context) error
- func (v *Views) NewsArticleFunc(c echo.Context) error
- func (v *Views) NewsDeleteFunc(c echo.Context) error
- func (v *Views) NewsEditFunc(c echo.Context) error
- func (v *Views) NewsFunc(c echo.Context) error
- func (v *Views) PlayerAddFunc(c echo.Context) error
- func (v *Views) PlayerDeleteFunc(c echo.Context) error
- func (v *Views) PlayerEditFunc(c echo.Context) error
- func (v *Views) PlayersFunc(c echo.Context) error
- func (v *Views) ProgrammeAddFunc(c echo.Context) error
- func (v *Views) ProgrammeDeleteFunc(c echo.Context) error
- func (v *Views) ProgrammeSeasonAddFunc(c echo.Context) error
- func (v *Views) ProgrammeSeasonDeleteFunc(c echo.Context) error
- func (v *Views) ProgrammeSeasonEditFunc(c echo.Context) error
- func (v *Views) ProgrammeSeasonSelectFunc(c echo.Context) error
- func (v *Views) ProgrammesFunc(c echo.Context) error
- func (v *Views) ProgrammesSeasonsFunc(c echo.Context) error
- func (v *Views) RecordVisit(visitorID string)
- func (v *Views) RemoveImageFunc(c echo.Context) error
- func (v *Views) RequireClubSecretaryHigher(next echo.HandlerFunc) echo.HandlerFunc
- func (v *Views) RequireNotManager(next echo.HandlerFunc) echo.HandlerFunc
- func (v *Views) RequireNotManagerNotPhotographer(next echo.HandlerFunc) echo.HandlerFunc
- func (v *Views) RequireUserManagement(next echo.HandlerFunc) echo.HandlerFunc
- func (v *Views) RequiresLogin(next echo.HandlerFunc) echo.HandlerFunc
- func (v *Views) ResetURLFunc(c echo.Context) error
- func (v *Views) ResetUserPasswordFunc(c echo.Context) error
- func (v *Views) SetResetToken(ctx context.Context, token string, userID int, ttl time.Duration) error
- func (v *Views) SponsorAddFunc(c echo.Context) error
- func (v *Views) SponsorDeleteFunc(c echo.Context) error
- func (v *Views) SponsorsFunc(c echo.Context) error
- func (v *Views) Stop()
- func (v *Views) TeamAddFunc(c echo.Context) error
- func (v *Views) TeamDeleteFunc(c echo.Context) error
- func (v *Views) TeamEditFunc(c echo.Context) error
- func (v *Views) TeamFunc(c echo.Context) error
- func (v *Views) TeamsFunc(c echo.Context) error
- func (v *Views) UploadImageFunc(c echo.Context) error
- func (v *Views) UserAddFunc(c echo.Context) error
- func (v *Views) UserDeleteFunc(c echo.Context) error
- func (v *Views) UserEditFunc(c echo.Context) error
- func (v *Views) UsersFunc(c echo.Context) error
- func (v *Views) UsersSetDisplayEmailFunc(c echo.Context) error
- func (v *Views) VisitorTrackingMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func (v *Views) WhatsOnAddFunc(c echo.Context) error
- func (v *Views) WhatsOnArticleFunc(c echo.Context) error
- func (v *Views) WhatsOnDeleteFunc(c echo.Context) error
- func (v *Views) WhatsOnEditFunc(c echo.Context) error
- func (v *Views) WhatsOnFunc(c echo.Context) error
- func (v *Views) WhatsOnSelectFunc(c echo.Context) error
- func (v *Views) WhatsOnTomePeriodFunc(c echo.Context) error
- type WhatsOnTemplate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Address string
DatabaseURL string
DomainName string
SessionCookieName string
S3 storage.Config
Mail SMTPConfig
Security SecurityConfig
Redis RedisConfig
}
type ContactUserTemplate ¶
type ContactUserTemplate struct {
ID int
Name string
Email string
Role string
FileName null.String
}
func DBUsersContactToTemplateFormat ¶
func DBUsersContactToTemplateFormat(usersDB []user.User) ([]ContactUserTemplate, error)
type Context ¶
type Context struct {
// Message is used for sending a message back to the user trying to log in, might decide to move later as it may not be needed
Message string
// MsgType is the bulma.io class used to indicate what should be displayed
MsgType string
// MsgViewed is used to clear the message after it has been viewed once
MsgViewed bool
// User is the stored logged-in user
User user.User
}
Context is a struct applied to the templates.
type DocumentTemplate ¶
func DBDocumentsToTemplateFormat ¶
func DBDocumentsToTemplateFormat(documentsDB []document.Document) []DocumentTemplate
type InternalContext ¶
type ManagerTemplate ¶
func DBManagersToTemplateFormat ¶
func DBManagersToTemplateFormat(managersDB []user.User) []ManagerTemplate
type NewsTemplate ¶
type NewsTemplate struct {
ID int
Title string
Content string
Date string
IsFileValid bool
FileName null.String
}
func DBNewsToArticleTemplateFormat ¶
func DBNewsToArticleTemplateFormat(newsDB news.News) NewsTemplate
func DBNewsToTemplateFormat ¶
func DBNewsToTemplateFormat(newsDB []news.News) []NewsTemplate
type PlayerTemplate ¶
type PlayerTemplate struct {
ID int
Name string
DateOfBirth string
DateOfBirthForm string
IsFileValid bool
FileName null.String
Age int
Position null.String
IsCaptain bool
Team TeamTemplate
}
func DBPlayersTeamToTemplateFormat ¶
func DBPlayersTeamToTemplateFormat(playersDB []player.Player, isYouthTeam bool) []PlayerTemplate
func DBPlayersToTemplateFormat ¶
func DBPlayersToTemplateFormat(playersDB []player.Player, teamsDB []team.Team) []PlayerTemplate
type ProgrammeTemplate ¶
type ProgrammeTemplate struct {
ID int
Name string
DateOfProgramme string
Season SeasonTemplate
FileName string
}
func DBProgrammesToTemplateFormat ¶
func DBProgrammesToTemplateFormat(programmesDB []programme.Programme, seasonsDB []programme.Season) []ProgrammeTemplate
type ProgrammeTemplateStruct ¶
type RedisConfig ¶ added in v0.5.4
type RedisConfig struct {
// Addresses is one or more "host:port" pairs. More than one
// address puts the client into cluster mode, unless MasterName
// is set, in which case it uses Sentinel-based failover.
Addresses []string
MasterName string
Username string
Password string
DB int
TLS bool
// KeyPrefix namespaces every key this app writes to Redis/Valkey,
// e.g. "afc:dev:" or "afc:prod:". Set it differently per
// environment so a Valkey ACL user can be scoped to only that
// environment's keys (~afc:dev:* / ~afc:prod:*) on a shared
// instance or cluster. Defaults to "afc:" if empty.
KeyPrefix string
}
RedisConfig stores the configuration for an optional Redis/Valkey cache, used to share state (e.g. password reset tokens) across multiple app instances. When Addresses is empty, an in-process cache is used instead, which is only suitable for a single instance.
type SMTPConfig ¶
SMTPConfig stores the SMTP Mailer configuration
type SeasonTemplate ¶
type SecurityConfig ¶
type SecurityConfig struct {
EncryptionKey string
AuthenticationKey string
Iterations int
ScryptWorkFactor int
ScryptBlockSize int
ScryptParallelismFactor int
KeyLength int
}
SecurityConfig stores the security configuration
type SponsorTemplate ¶
type SponsorTemplate struct {
ID int
Name string
Website null.String
Purpose null.String
FileName null.String
}
func DBSponsorsToTemplateFormat ¶
func DBSponsorsToTemplateFormat(sponsorsDB []sponsor.Sponsor) []SponsorTemplate
type TeamTemplate ¶
func DBTeamsToTemplateFormat ¶
func DBTeamsToTemplateFormat(teamsDB []team.Team) []TeamTemplate
type TemplateHelper ¶
type UserTemplate ¶
type UserTemplate struct {
ID int
Name string
Email string
Phone string
TeamID int
Role string
RoleTemplate string
IsFileValid bool
FileName null.String
}
func DBUserToTemplateFormat ¶
func DBUserToTemplateFormat(userDB user.User) UserTemplate
func DBUsersToTemplateFormat ¶
func DBUsersToTemplateFormat(usersDB []user.User) []UserTemplate
type Views ¶
type Views struct {
// contains filtered or unexported fields
}
Views encapsulates our view dependencies
func (*Views) ChangePasswordFunc ¶
ChangePasswordFunc handles the password change from a user
func (*Views) CustomHTTPErrorHandler ¶
func (*Views) DeleteResetToken ¶ added in v0.5.4
DeleteResetToken invalidates a password reset token after use.
func (*Views) GetResetToken ¶ added in v0.5.4
GetResetToken looks up the user ID a password reset token was issued for.
func (*Views) GetVisitorCount ¶
func (*Views) LoginFunc ¶
LoginFunc implements the login functionality, will add a cookie to the cookie store for managing authentication
func (*Views) LogoutFunc ¶
LogoutFunc Implements the logout functionality. Will delete the session information from the cookie store
func (*Views) ProgrammeSeasonDeleteFunc ¶
func (*Views) ProgrammeSeasonEditFunc ¶
func (*Views) ProgrammeSeasonSelectFunc ¶
func (*Views) RecordVisit ¶
func (*Views) RequireClubSecretaryHigher ¶
func (v *Views) RequireClubSecretaryHigher(next echo.HandlerFunc) echo.HandlerFunc
func (*Views) RequireNotManager ¶
func (v *Views) RequireNotManager(next echo.HandlerFunc) echo.HandlerFunc
func (*Views) RequireNotManagerNotPhotographer ¶
func (v *Views) RequireNotManagerNotPhotographer(next echo.HandlerFunc) echo.HandlerFunc
func (*Views) RequireUserManagement ¶
func (v *Views) RequireUserManagement(next echo.HandlerFunc) echo.HandlerFunc
func (*Views) RequiresLogin ¶
func (v *Views) RequiresLogin(next echo.HandlerFunc) echo.HandlerFunc
RequiresLogin is a middleware which will be used for each httpHandler to check if there is any active session
func (*Views) SetResetToken ¶ added in v0.5.4
func (v *Views) SetResetToken(ctx context.Context, token string, userID int, ttl time.Duration) error
SetResetToken stores a mapping of a one-time password reset token to a user ID, expiring after ttl. When Redis is configured this is shared across every app instance; otherwise it only lives in this instance's memory, which requires sticky sessions/single-instance deployment for the reset flow to work reliably.
func (*Views) UsersSetDisplayEmailFunc ¶
func (*Views) VisitorTrackingMiddleware ¶
func (v *Views) VisitorTrackingMiddleware(next echo.HandlerFunc) echo.HandlerFunc
type WhatsOnTemplate ¶
type WhatsOnTemplate struct {
ID int
Title string
Content string
Date string
DateOfEvent string
DateOfEventForm string
IsFileValid bool
FileName null.String
}
func DBWhatsOnToArticleTemplateFormat ¶
func DBWhatsOnToArticleTemplateFormat(whatsOnDB whatson.WhatsOn) WhatsOnTemplate
func DBWhatsOnToTemplateFormat ¶
func DBWhatsOnToTemplateFormat(whatsOnsDB []whatson.WhatsOn) []WhatsOnTemplate