handlers

package
v0.0.0-...-c16ca65 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SurveyHandler

type SurveyHandler struct {
	// contains filtered or unexported fields
}

func CreateSurveyHandler

func CreateSurveyHandler(ss *stores.SurveyStore) *SurveyHandler

func (*SurveyHandler) AddAssignments

func (sh *SurveyHandler) AddAssignments(c echo.Context) error

method for manually making assignments to users. Typically assignments should be made using the AssignSurveyElement method but this allows for admins to override the normal assignment algorithm. Returns an empty HTTP CREATED (201) result on success.

PRIVATE API restricted to the ADMIN or SURVEY_OWNER roles

func (*SurveyHandler) AssignSurveyElement

func (sh *SurveyHandler) AssignSurveyElement(c echo.Context) error

Assigns a survey element to a survey member. It works in the following manner: If a user has an existing assignment that has not been saved, then that survey is returned. If the user does not have an existing assignment, then surveys will be assigned in ascending order based on the survey order field. Each survey will be assigned to a single user with the exception of control surveys. Control surveys will be assigned to all users. When there are no more surveys to assign (all surveys are completed and the user has completed their control surveys), then the function will return an empty survey (e.g. id values of 0).

PRIVATE API restricted to the ADMIN, SURVEY_OWNER, and SURVEY_MEMBER roles

func (*SurveyHandler) CreateNewSurvey

func (sh *SurveyHandler) CreateNewSurvey(c echo.Context) error

Creates a new survey and returns the generated identifier in a JSON document

e.g. {"surveyId":"1111-1111-111111"}

PRIVATE API restricted to the ADMIN role

func (*SurveyHandler) GetSurveyElements

func (sh *SurveyHandler) GetSurveyElements(c echo.Context) error

Gets an array of survey elements for a given survey. Returns a JSON array.

PRIVATE API restricted to the ADMIN or SURVEY_OWNER roles

func (*SurveyHandler) GetSurveyMembers

func (sh *SurveyHandler) GetSurveyMembers(c echo.Context) error

Gets an array of survey members for a given survey. Returns a JSON array.

PRIVATE API restricted to the ADMIN or SURVEY_OWNER roles

func (*SurveyHandler) GetSurveyReport

func (sh *SurveyHandler) GetSurveyReport(c echo.Context) error

Returns a CSV dump of the survey results for a given survey

PRIVATE API restructed to the ADMIN or SURVEY_OWNER role

func (*SurveyHandler) GetSurveysForUser

func (sh *SurveyHandler) GetSurveysForUser(c echo.Context) error

List the surveys that the requesting user (via the JWT Claim sub identifier) is a member of in a JSON array

PUBLIC API

func (*SurveyHandler) InsertSurveyElements

func (sh *SurveyHandler) InsertSurveyElements(c echo.Context) error

Inserts an array of survey elements. Returns an empty HTTP CREATED (201) result on success.

PRIVATE API restricted to the ADMIN or SURVEY_OWNER roles

func (*SurveyHandler) RemoveMemberFromSurvey

func (sh *SurveyHandler) RemoveMemberFromSurvey(c echo.Context) error

Removes a survey member record from a specific survey. Returns an empty HTTP OK result on success.

PRIVATE API restricted to the ADMIN or SURVEY_OWNER roles

func (*SurveyHandler) RemoveSurveyMember

func (sh *SurveyHandler) RemoveSurveyMember(c echo.Context) error

Removes a survey member record. Returns an empty HTTP OK result on success.

PRIVATE API restricted to the ADMIN or SURVEY_OWNER roles

func (*SurveyHandler) SaveSurveyAssignment

func (sh *SurveyHandler) SaveSurveyAssignment(c echo.Context) error

func (*SurveyHandler) SearchUsers

func (sh *SurveyHandler) SearchUsers(c echo.Context) error

Search the user list. This method takes three query parameters:

q: the query term that will match against the user name

r: the number of rows to return

p: the page number to return

PUBLIC API

func (*SurveyHandler) UpdateSurvey

func (sh *SurveyHandler) UpdateSurvey(c echo.Context) error

Updates a survey and returns an empty HTTP OK result on success.

PRIVATE API restricted to the ADMIN or SURVEY_OWNER roles

func (*SurveyHandler) UpsertSurveyMember

func (sh *SurveyHandler) UpsertSurveyMember(c echo.Context) error

Updates/Inserts a survey member record. Returns an empty HTTP CREATED (201) result on success.

PRIVATE API restricted to the ADMIN or SURVEY_OWNER roles

func (*SurveyHandler) ValidSurveyName

func (sh *SurveyHandler) ValidSurveyName(c echo.Context) error

Validate that the survey name is available. Returns true if name is unused

q: the query term that will match against the survey name

PUBLIC API

func (*SurveyHandler) Version

func (sh *SurveyHandler) Version(c echo.Context) error

Returns the API version as a text PUBLIC API

Jump to

Keyboard shortcuts

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