service

package
v0.0.0-...-68b623b Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	QuestionIdEmptyError           = errors.New("QUESTION_ID_EMPTY")
	QuestionDescriptionEmptyError  = errors.New("QUESTION_DESCRIPTION_EMPTY")
	AtleastTwoOptionsRequiredError = errors.New("ATLEAST_TWO_OPTIONS_REQUIRED")
	OptionDescriptionEmptyError    = errors.New("OPTION_DESCRIPTION_EMPTY")
	OptionScoreNegativeError       = errors.New("OPTION_SCORE_MUST_BE_POSITIVE")
	QuestionNotFoundError          = errors.New("QUESTION_NOT_FOUND")
)
View Source
var (
	SurveyQuestionIdEmpty    = errors.New("SURVEY_QUESTION_ID_EMPTY")
	SurveyOptionIdEmpty      = errors.New("SURVEY_OPTION_ID_EMPTY")
	SurveyQuestionIdNotFound = errors.New("SURVEY_QUESTION_ID_NOT_FOUND")
	SurveyOptionIdNotFound   = errors.New("SURVEY_OPTION_ID_NOT_FOUND")
	SurveyMissingAnswers     = errors.New("SURVEY_MISSING_ANSWERS")
	SurveyNotFound           = errors.New("SURVEY_NOT_FOUND")
	SurveyResultExpired      = errors.New("SURVEY_RESULT_EXPIRED")
)
View Source
var (
	TraitIdEmptyError          = errors.New("TRAIT_ID_EMPTY")
	TraitTypeEmptyError        = errors.New("TRAIT_TYPE_EMPTY")
	TraitNotFoundError         = errors.New("TRAIT_NOT_FOUND")
	TraitMinScoreNegativeError = errors.New("TRAIT_MIN_SCORE_MUST_BE_POSITIVE")
)

Functions

func NewQuestionService

func NewQuestionService(repository repository.QuestionRepository) *questionService

func NewSurveyService

func NewSurveyService(repository repository.SurveyRepository, questionService QuestionService, traitService TraitService) *surveyService

func NewTraitService

func NewTraitService(repository repository.TraitRepository) *traitService

Types

type QuestionService

type QuestionService interface {
	GetAll() []domain.Question
	Add(question domain.Question) (domain.Question, error)
	Edit(question domain.Question) (domain.Question, error)
	Get(id string) (domain.Question, error)
	Delete(id string)
}

type SurveyService

type SurveyService interface {
	GetResults(id string) (domain.SurveyResponse, error)
	Finish(survey domain.Survey) (domain.SurveyResponse, error)
}

type TraitService

type TraitService interface {
	GetAll() []domain.Trait
	Add(trait domain.Trait) (domain.Trait, error)
	Edit(trait domain.Trait) (domain.Trait, error)
	Get(id string) (domain.Trait, error)
	Delete(id string)
}

Jump to

Keyboard shortcuts

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