Back to godoc.org

Package actions

v0.0.0-...-1af33b5
Latest Go to latest

The highest tagged major version is .

Published: Sep 10, 2019 | License: Apache-2.0 | Module: github.com/kindlyops/havengrc/havenapi

Index

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 ISS = envy.Get("HAVEN_JWT_ISS", "")

ISS needs to match your deployment. The JWT issuer field is filled out by keycloak based on the hostname that the authentication request comes in on.

var KEY = envy.Get("HAVEN_JWK_PATH", "")

KEY gets the haven jwk path

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.

func CommentGetHandler

func CommentGetHandler(c buffalo.Context) error

CommentGetHandler accepts a comment get request

func CommentPostHandler

func CommentPostHandler(c buffalo.Context) error

CommentPostHandler accepts a comment post

func CreateSlide

func CreateSlide(surveyID string, email string) error

CreateSlide triggers a worker job to create a report with R

func DashboardGetHandler

func DashboardGetHandler(c buffalo.Context) error

DashboardGetHandler returns all goodies for the dashboard the path GET /api/dashboard

func DownloadHandler

func DownloadHandler(c buffalo.Context) error

DownloadHandler downloads a report

func GetFiles

func GetFiles(c buffalo.Context) error

GetFiles returns all files available for the user the path GET /api/files/{fileType[zip,pptx]}

func GetIpsativeData

func GetIpsativeData(c buffalo.Context) error

GetIpsativeData returns ipsative data the path GET /api/ipsative_data/{surveyID}

func GetIpsativeSurveys

func GetIpsativeSurveys(c buffalo.Context) error

GetIpsativeSurveys returns all ipsative surveys the path GET /api/ipsative_surveys

func GetLikertQuestions

func GetLikertQuestions(c buffalo.Context) error

GetLikertQuestions returns all likert questions the path GET /api/likert_questions

func GetLikertSurveys

func GetLikertSurveys(c buffalo.Context) error

GetLikertSurveys returns all likert surveys the path GET /api/likert_surveys

func GetState

func GetState(c buffalo.Context) error

GetState gets the data for one user. This function is mapped to the path GET /api/state

func HealthzHandler

func HealthzHandler(c buffalo.Context) error

HealthzHandler checks for a working DB connection

func JwtMiddleware

func JwtMiddleware(next buffalo.Handler) buffalo.Handler

JwtMiddleware validates JWT and set context compatible with PostgREST

func RegistrationHandler

func RegistrationHandler(c buffalo.Context) error

RegistrationHandler accepts json

func SaveSurveyResults

func SaveSurveyResults(results []SurveyResult, surveyID uuid.UUID, c buffalo.Context) (string, error)

SaveSurveyResults creates a survey_response and saves all responses

func SurveysHandler

func SurveysHandler(c buffalo.Context) error

SurveysHandler accepts json

func UpdateState

func UpdateState(c buffalo.Context) error

UpdateState updates the state for a user. This function is mapped to the path POST /api/state

func UploadHandler

func UploadHandler(c buffalo.Context) error

UploadHandler accepts a file upload

type DashboardData

type DashboardData struct {
	Slide              models.FileInfo       `json:"slide"`
	Zip                models.FileInfo       `json:"zip"`
	LastSurveyResponse models.SurveyResponse `json:"last_survey_response"`
}

DashboardData is a struct of what data we want on the dashboard

type IpsativeResponse

type IpsativeResponse struct {
	UUID             uuid.UUID `json:"uuid" db:"uuid"`
	AnswerID         string    `json:"answer_id" db:"answer_id"`
	Category         string    `json:"category" db:"-"`
	GroupNumber      int       `json:"group_number" db:"group_number"`
	PointsAssigned   int       `json:"points_assigned" db:"points_assigned"`
	CreatedAt        time.Time `json:"created_at" db:"created_at"`
	UserID           uuid.UUID `json:"user_id" db:"user_id"`
	SurveyResponseID uuid.UUID `json:"survey_response_id" db:"survey_response_id"`
	UserEmail        string    `json:"user_email" db:"user_email"`
}

IpsativeResponse is a data type for the entered response

type RegistrationStruct

type RegistrationStruct struct {
	Email    string          `json:"email"`
	Results  []ResultsStruct `json:"survey_results"`
	SurveyID uuid.UUID       `json:"survey_id"`
}

RegistrationStruct is a struct for the funnel

type ResultsStruct

type ResultsStruct struct {
	ID     string `json:"answer_id"`
	Group  int    `json:"group_number"`
	Points int    `json:"points_assigned"`
}

ResultsStruct is a struct for the funnel

type SurveyResult

type SurveyResult struct {
	AnswerID       string `json:"answer_id"`
	Category       string `json:"category"`
	GroupNumber    int    `json:"group_number"`
	PointsAssigned int    `json:"points_assigned"`
}

SurveyResult is a data type for the survey

type Token

type Token struct {
	ResourceAccess struct {
		Client struct {
			Roles []string `json:"roles,omitempty"`
		} `json:"havendev,omitempty"`
	} `json:"resource_access,omitempty"`
}

Token is for un marshalling {"resource_access":{"havendev":{"roles":["member"]}}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier