actions

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2020 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Overview

Package actions contains all controllers and application business logic

Index

Constants

View Source
const MaxStringLen = 500

Variables

View Source
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".

Functions

func App

func App() *buffalo.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

func AuthCreate(c buffalo.Context) error

AuthCreate attempts to log the user in with an existing account.

func AuthDestroy

func AuthDestroy(c buffalo.Context) error

AuthDestroy clears the session and logs a user out

func AuthLanding

func AuthLanding(c buffalo.Context) error

AuthLanding shows a landing page to login

func AuthNew

func AuthNew(c buffalo.Context) error

AuthNew loads the signin page

func Authorize

func Authorize(next buffalo.Handler) buffalo.Handler

Authorize require a user be logged in before accessing a route

func HomeHandler

func HomeHandler(c buffalo.Context) error

HomeHandler is a default handler to serve up a home page.

func InstructionsIndex

func InstructionsIndex(c buffalo.Context) error

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

func SendSlackNotification(baseURL string, webhookURL string, incident models.Incident) error

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

func SetCurrentUser(next buffalo.Handler) buffalo.Handler

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

func SettingsEdit(c buffalo.Context) error

SettingsEdit default implementation.

func SettingsIndex added in v0.1.5

func SettingsIndex(c buffalo.Context) error

SettingsIndex default implementation.

func UsersCreate

func UsersCreate(c buffalo.Context) error

UsersCreate registers a new user with the application.

func UsersNew

func UsersNew(c buffalo.Context) error

UsersNew renders the users form

Types

type IncidentsResource

type IncidentsResource struct {
	buffalo.Resource
}

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

Edit renders a edit form for a Incident. This function is mapped to the path GET /incidents/{incident_id}/edit

func (IncidentsResource) List

List gets all Incidents. This function is mapped to the path GET /incidents

func (IncidentsResource) New

New renders the form for creating a new Incident. This function is mapped to the path GET /incidents/new

func (IncidentsResource) Show

Show gets the data for one Incident. This function is mapped to the path GET /incidents/{incident_id}

func (IncidentsResource) Update

func (v IncidentsResource) Update(c buffalo.Context) error

Update changes a Incident in the DB. This function is mapped to the path PUT /incidents/{incident_id}

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

type UserResource struct {
	buffalo.Resource
}

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

func (UserResource) Show

func (v UserResource) Show(c buffalo.Context) error

Show gets the data for one User. This function is mapped to the path GET /users/accounts/{user_id}

func (UserResource) Update

func (v UserResource) Update(c buffalo.Context) error

Update changes a User in the DB. This function is mapped to the path PUT /users/accounts/{user_id}

Jump to

Keyboard shortcuts

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