Documentation
¶
Overview ¶
Package actions contains all controllers and application business logic
Index ¶
- Constants
- Variables
- func App() *buffalo.App
- func AuthCreate(c buffalo.Context) error
- func AuthDestroy(c buffalo.Context) error
- func AuthLanding(c buffalo.Context) error
- func AuthNew(c buffalo.Context) error
- func Authorize(next buffalo.Handler) buffalo.Handler
- func HomeHandler(c buffalo.Context) error
- func InstructionsIndex(c buffalo.Context) error
- func NewBlockMessage(baseURL string, i models.Incident) *slack.WebhookMessage
- func SendSlackNotification(baseURL string, webhookURL string, incident models.Incident) error
- func SetCurrentUser(next buffalo.Handler) buffalo.Handler
- func SettingsEdit(c buffalo.Context) error
- func SettingsIndex(c buffalo.Context) error
- func UsersCreate(c buffalo.Context) error
- func UsersNew(c buffalo.Context) error
- type IncidentsResource
- func (v IncidentsResource) Create(c buffalo.Context) error
- func (v IncidentsResource) Destroy(c buffalo.Context) error
- func (v IncidentsResource) Edit(c buffalo.Context) error
- func (v IncidentsResource) List(c buffalo.Context) error
- func (v IncidentsResource) New(c buffalo.Context) error
- func (v IncidentsResource) Show(c buffalo.Context) error
- func (v IncidentsResource) Update(c buffalo.Context) error
- type Slack
- type SlackPayload
- type SlackRequest
- type UserResource
Constants ¶
const MaxStringLen = 500
Variables ¶
var ENV = envy.Get("GO_ENV", "development")
ENV is used to help switch settings based on where the application is being run. Default is "development".
var T *i18n.Translator
Functions ¶
func App ¶
App is where all routes and middleware for buffalo should be defined. This is the nerve center of your application.
Routing, middleware, groups, etc... are declared TOP -> DOWN. This means if you add a middleware to `app` *after* declaring a group, that group will NOT have that new middleware. The same is true of resource declarations as well.
It also means that routes are checked in the order they are declared. `ServeFiles` is a CATCH-ALL route, so it should always be placed last in the route declarations, as it will prevent routes declared after it to never be called.
func AuthCreate ¶
AuthCreate attempts to log the user in with an existing account.
func AuthDestroy ¶
AuthDestroy clears the session and logs a user out
func AuthLanding ¶
AuthLanding shows a landing page to login
func HomeHandler ¶
HomeHandler is a default handler to serve up a home page.
func InstructionsIndex ¶
InstructionsIndex default implementation.
func NewBlockMessage ¶ added in v0.1.5
func NewBlockMessage(baseURL string, i models.Incident) *slack.WebhookMessage
func SendSlackNotification ¶ added in v0.1.5
SendSlackNotification will post to an 'Incoming Webook' url setup in Slack Apps. It accepts some text and the slack channel is saved within Slack.
func SetCurrentUser ¶
SetCurrentUser attempts to find a user based on the current_user_id in the session. If one is found it is set on the context.
func SettingsEdit ¶ added in v0.1.5
SettingsEdit default implementation.
func SettingsIndex ¶ added in v0.1.5
SettingsIndex default implementation.
func UsersCreate ¶
UsersCreate registers a new user with the application.
Types ¶
type IncidentsResource ¶
IncidentsResource is the resource for the Incident model
func (IncidentsResource) Create ¶
func (v IncidentsResource) Create(c buffalo.Context) error
Create adds a Incident to the DB. This function is mapped to the path POST /incidents
func (IncidentsResource) Destroy ¶
func (v IncidentsResource) Destroy(c buffalo.Context) error
Destroy deletes a Incident from the DB. This function is mapped to the path DELETE /incidents/{incident_id}
func (IncidentsResource) Edit ¶
func (v IncidentsResource) Edit(c buffalo.Context) error
Edit renders a edit form for a Incident. This function is mapped to the path GET /incidents/{incident_id}/edit
func (IncidentsResource) List ¶
func (v IncidentsResource) List(c buffalo.Context) error
List gets all Incidents. This function is mapped to the path GET /incidents
func (IncidentsResource) New ¶
func (v IncidentsResource) New(c buffalo.Context) error
New renders the form for creating a new Incident. This function is mapped to the path GET /incidents/new
type Slack ¶ added in v0.1.5
type Slack struct { Request SlackRequest Job worker.Job }
type SlackPayload ¶ added in v0.1.5
type SlackPayload map[string]interface{}
type SlackRequest ¶ added in v0.1.5
type SlackRequest struct {
Text string `json:"text"`
}
type UserResource ¶
UserResource is the resource for the User model
func (UserResource) Destroy ¶
func (v UserResource) Destroy(c buffalo.Context) error
Destroy deletes a User from the DB. This function is mapped to the path DELETE /users/accounts/{user_id}
func (UserResource) Edit ¶
func (v UserResource) Edit(c buffalo.Context) error
Edit renders a edit form for a User. This function is mapped to the path GET /users/accounts/{user_id}/edit
func (UserResource) List ¶
func (v UserResource) List(c buffalo.Context) error
List gets all Users. This function is mapped to the path GET /users/accounts