Documentation
¶
Index ¶
- Constants
- type EventForm
- type Events
- func (e *Events) Create(w http.ResponseWriter, r *http.Request)
- func (e *Events) Delete(w http.ResponseWriter, r *http.Request)
- func (e *Events) Edit(w http.ResponseWriter, r *http.Request)
- func (e *Events) Index(w http.ResponseWriter, r *http.Request)
- func (e *Events) Show(w http.ResponseWriter, r *http.Request)
- func (e *Events) Update(w http.ResponseWriter, r *http.Request)
- type FencerForm
- type FencerList
- type Fencers
- func (f *Fencers) Create(w http.ResponseWriter, r *http.Request)
- func (f *Fencers) Delete(w http.ResponseWriter, r *http.Request)
- func (f *Fencers) Edit(w http.ResponseWriter, r *http.Request)
- func (f *Fencers) Index(w http.ResponseWriter, r *http.Request)
- func (f *Fencers) New(w http.ResponseWriter, r *http.Request)
- func (f *Fencers) Show(w http.ResponseWriter, r *http.Request)
- func (f *Fencers) Update(w http.ResponseWriter, r *http.Request)
- type LoadMatchForm
- type LoginForm
- type MatchForm
- type Matches
- func (m *Matches) Create(w http.ResponseWriter, r *http.Request)
- func (m *Matches) Delete(w http.ResponseWriter, r *http.Request)
- func (m *Matches) Edit(w http.ResponseWriter, r *http.Request)
- func (m *Matches) New(w http.ResponseWriter, r *http.Request)
- func (m *Matches) Show(w http.ResponseWriter, r *http.Request)
- func (m *Matches) Update(w http.ResponseWriter, r *http.Request)
- type NewMatchForm
- type RegisterForm
- type ResetPwForm
- type SchoolForm
- type Schools
- func (s *Schools) Create(w http.ResponseWriter, r *http.Request)
- func (s *Schools) Delete(w http.ResponseWriter, r *http.Request)
- func (s *Schools) Edit(w http.ResponseWriter, r *http.Request)
- func (s *Schools) Index(w http.ResponseWriter, r *http.Request)
- func (s *Schools) Show(w http.ResponseWriter, r *http.Request)
- func (s *Schools) Update(w http.ResponseWriter, r *http.Request)
- type Seeding
- type SeedingForm
- type Squads
- type Static
- type UserList
- type Users
- func (u *Users) CompleteReset(w http.ResponseWriter, r *http.Request)
- func (u *Users) Create(w http.ResponseWriter, r *http.Request)
- func (u *Users) Demote(w http.ResponseWriter, r *http.Request)
- func (u *Users) Index(w http.ResponseWriter, r *http.Request)
- func (u *Users) InitiateReset(w http.ResponseWriter, r *http.Request)
- func (u *Users) Login(w http.ResponseWriter, r *http.Request)
- func (u *Users) Logout(w http.ResponseWriter, r *http.Request)
- func (u *Users) New(w http.ResponseWriter, r *http.Request)
- func (u *Users) Promote(w http.ResponseWriter, r *http.Request)
- func (u *Users) ResetPw(w http.ResponseWriter, r *http.Request)
Constants ¶
const ( // IndexEvents is the name of the events index route. IndexEvents = "index_events" // ShowEvent is the name of the event show route. ShowEvent = "show_event" // EditEvent is the name of the event edit route. EditEvent = "edit_event" )
const ( // IndexFencers is the name of the index fencers route. IndexFencers = "index_fencers" // ShowFencer is the name of the show fencer route. ShowFencer = "show_fencer" // EditFencer is the name of the edit fencer route. EditFencer = "edit_fencer" )
const ( // ShowMatch is the name of the show match route. ShowMatch = "show_match" // EditMatch is the name of the edit match route. EditMatch = "edit_match" )
const ( // IndexSchools is the name of the schools index route. IndexSchools = "index_schools" // ShowSchool is the name of the school show route. ShowSchool = "show_school" // EditSchool is the name of the school edit route. EditSchool = "edit_school" )
const (
// ShowSquad is the name of the squad show route.
ShowSquad = "show_squad"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventForm ¶
type EventForm struct { Name string `scheme:"name"` Date string `scheme:"date"` Rounds uint `scheme:"rounds"` }
EventForm holds and maps data from the new event form.
type Events ¶
type Events struct { IndexView *views.View New *views.View ShowView *views.View EditView *views.View // contains filtered or unexported fields }
Events holds a models.EventService and a mux.Router.
func NewEvents ¶
func NewEvents(es models.EventService, r *mux.Router) *Events
NewEvents returns a *Events, for use as an Events controller.
func (*Events) Create ¶
func (e *Events) Create(w http.ResponseWriter, r *http.Request)
Create proceses the new event form and creates a new event.
POST /event
func (*Events) Delete ¶
func (e *Events) Delete(w http.ResponseWriter, r *http.Request)
Delete removes an event from the database.
POST /event/:id/delete
func (*Events) Edit ¶
func (e *Events) Edit(w http.ResponseWriter, r *http.Request)
Edit renders the details of an event in the event form for editing.
GET /event/:id/edit
func (*Events) Index ¶
func (e *Events) Index(w http.ResponseWriter, r *http.Request)
Index renders the events index page with all of the events.
GET /events
type FencerForm ¶
type FencerForm struct { Name string `schema:"name"` SchoolID uint `schema:"school"` Category models.Category `schema:"category"` SchoolOptions []models.School CategoryOptions [6]models.Category }
FencerForm holds and maps data from the new fencer form.
type FencerList ¶
FencerList is a slice of fencers using the models.Fencer.
type Fencers ¶
type Fencers struct { NewView *views.View IndexView *views.View ShowView *views.View EditView *views.View // contains filtered or unexported fields }
Fencers holds a models.FencerService, a mux.Router, and all of the fencer-related views.
func NewFencers ¶
func NewFencers(fs models.FencerService, sqs models.SquadService, ss models.SchoolService, r *mux.Router) *Fencers
NewFencers returns a *Fencers, for use as a FencersController (e.g., for routing).
func (*Fencers) Create ¶
func (f *Fencers) Create(w http.ResponseWriter, r *http.Request)
Create is used to process the new fencer form when a user tries to create a new fencer.
POST /fencers
func (*Fencers) Delete ¶
func (f *Fencers) Delete(w http.ResponseWriter, r *http.Request)
Delete is used to trigger deletion of a particular fencer in the models package. TODO: Enforce permissions on fencer being deleted.
POST /fencers/:id/delete
func (*Fencers) Edit ¶
func (f *Fencers) Edit(w http.ResponseWriter, r *http.Request)
Edit is used to edit a particular fencer's details.
GET /fencers/:id/edit
func (*Fencers) Index ¶
func (f *Fencers) Index(w http.ResponseWriter, r *http.Request)
Index is used to list all of the created fencers.
GET /fencers
func (*Fencers) New ¶
func (f *Fencers) New(w http.ResponseWriter, r *http.Request)
New is used to render the new fencer form.
GET /fencers/new
type LoadMatchForm ¶
type LoadMatchForm struct { ID uint Event *models.Event Round uint `schema:"round"` Category models.Category SquadLeft *models.Squad SquadRight *models.Squad Bouts []models.Bout FencersLeft []models.Fencer FencersRight []models.Fencer }
LoadMatchForm contains the data needed to render the match form.
type MatchForm ¶
MatchForm contains the data submitted by the match form, used by the Update action.
type Matches ¶
type Matches struct { NewView *views.View ShowView *views.View EditView *views.View // contains filtered or unexported fields }
Matches holds a models.MatchService, a *mux.Router, and all of the match-related views.
func NewMatches ¶
func NewMatches( ms models.MatchService, ss models.SchoolService, sqs models.SquadService, es models.EventService, bs models.BoutService, r *mux.Router, ) *Matches
NewMatches returns a *Matches, for use as a Matches controller.
func (*Matches) Create ¶
func (m *Matches) Create(w http.ResponseWriter, r *http.Request)
Create processes the new match form and saves the match.
POST /matches
func (*Matches) Delete ¶
func (m *Matches) Delete(w http.ResponseWriter, r *http.Request)
Delete is used to delete a particular match.
POST /matches/:id/delete
func (*Matches) Edit ¶
func (m *Matches) Edit(w http.ResponseWriter, r *http.Request)
Edit renders the match form, where match details and scores are entered.
GET /matches/:id/edit
func (*Matches) New ¶
func (m *Matches) New(w http.ResponseWriter, r *http.Request)
New renders the new match form.
GET /matches/new
type NewMatchForm ¶
type NewMatchForm struct { Events []models.Event EventID uint `schema:"event"` Round uint `schema:"round"` Categories [6]models.Category Category models.Category `schema:"category"` Schools []models.School SchoolIDLeft uint `schema:"school_left"` SchoolIDRight uint `schema:"school_right"` }
NewMatchForm is used to load data for the New action and process for the Create action.
type RegisterForm ¶
type RegisterForm struct { Name string `schema:"name"` Email string `schema:"email"` Password string `schema:"password"` }
RegisterForm contains the data used to create a new user, entered on NewView and processed by Create.
type ResetPwForm ¶
type ResetPwForm struct { Email string `schema:"email"` Token string `schema:"token"` Password string `schema:"password"` }
ResetPwForm is used to process the forgot password form // and the reset password form.
type SchoolForm ¶
SchoolForm holds and maps data from the new school form.
type Schools ¶
type Schools struct { IndexView *views.View New *views.View ShowView *views.View EditView *views.View // contains filtered or unexported fields }
Schools holds a models.SchoolService, a models.SquadService (to manage squads), a mux.Router, and all of the school-related views.
func NewSchools ¶
func NewSchools(ss models.SchoolService, sqs models.SquadService, r *mux.Router) *Schools
NewSchools returns a *Schools, for use as a SchoolsControllers.
func (*Schools) Create ¶
func (s *Schools) Create(w http.ResponseWriter, r *http.Request)
Create is used to process a new school form submission to create a new school and the associated squads.
POST /schools
func (*Schools) Delete ¶
func (s *Schools) Delete(w http.ResponseWriter, r *http.Request)
Delete is used to delete a school. TODO: Enforce permissions on school being deleted.
POST /schools/:id/delete
func (*Schools) Edit ¶
func (s *Schools) Edit(w http.ResponseWriter, r *http.Request)
Edit is used to edit a particular school's details using the edit form. TODO: Enforce permissions on school being updated.
GET /schools/:id/edit
func (*Schools) Index ¶
func (s *Schools) Index(w http.ResponseWriter, r *http.Request)
Index is used to list all of the created schools.
GET /schools
type Seeding ¶
Seeding holds all services needed to build seedings and a mux.Router.
func NewSeeding ¶
func NewSeeding(ss models.SeedingService, r *mux.Router) *Seeding
NewSeeding returns a *Seeding, for use as a SeedingController (e.g., for routing).
func (*Seeding) Create ¶
func (s *Seeding) Create(w http.ResponseWriter, r *http.Request)
Create processes the new seeding form when a user tries to create a new seeding. Create will generate a table of competitors sorted by their rankings in a CSV file which can be downloaded and imported into Fencing Time (or other tournament software) by the user.
POST /seeding
type SeedingForm ¶
type SeedingForm struct { Category models.Category `schema:"category"` Plurality models.Plurality `schema:"plurality"` CategoryOptions [6]models.Category PluralityOptions [2]models.Plurality }
SeedingForm holds and maps data from the new seeding form.
type Squads ¶
Squads holds a models.SquadService, a mux.Router, and all of the squad-related views.
type Users ¶
type Users struct { NewView *views.View LoginView *views.View ForgotPwView *views.View ResetPwView *views.View IndexView *views.View // contains filtered or unexported fields }
Users holds a models.UserService and all of the user-related views.
func NewUsers ¶
func NewUsers(us models.UserService) *Users
NewUsers returns *Users, for use as a Users controller.
func (*Users) CompleteReset ¶
func (u *Users) CompleteReset(w http.ResponseWriter, r *http.Request)
CompleteReset processed the reset password form
POST /reset
func (*Users) Create ¶
func (u *Users) Create(w http.ResponseWriter, r *http.Request)
Create is used to process the register form when a user tries to create a new user account.
POST /register
func (*Users) Demote ¶
func (u *Users) Demote(w http.ResponseWriter, r *http.Request)
Demote changes a user's role from Admin to User Or updates user Permissionlvl from 0 to 1
POST /demote/{email}
func (*Users) Index ¶
func (u *Users) Index(w http.ResponseWriter, r *http.Request)
Index renders the page to manage user permissions When only admins are implemented, admin can promote but not demote users When superadmins are implemented, superadmins can promote and demote
GET /users
func (*Users) InitiateReset ¶
func (u *Users) InitiateReset(w http.ResponseWriter, r *http.Request)
POST /forgot
func (*Users) Login ¶
func (u *Users) Login(w http.ResponseWriter, r *http.Request)
Login is used to process the login form when a user tries to log in as an existing user with email and password.
POST /login
func (*Users) Logout ¶
func (u *Users) Logout(w http.ResponseWriter, r *http.Request)
Logout is used to delete a user's session cookie and invalidate their current remember token, which will sign-out the current user.
POST /logout
func (*Users) New ¶
func (u *Users) New(w http.ResponseWriter, r *http.Request)
New is used to render the form where a user can create a new user account.
GET /register