service

package
v0.0.0-...-a36e7e9 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IQuestionService

type IQuestionService interface {
	GetQuestion(c context.Context, id uint) (response *dto.Question, err error)
	GetQuestions(c context.Context, req dto.GetQuestionsRequest) (response []*dto.Question, err error)
	UpdateQuestion(c context.Context, id uint, req dto.QuestionUpdateRequest) (question *dto.Question, err error)
	DeleteQuestion(c context.Context, id uint) error
}

type IReportService

type IReportService interface {
	GetTotalParticipationPercentage(ctx context.Context, surveyId uint) (uint, error)
	GetCorrectAnswerPercentage(ctx context.Context, surveyId uint) ([]dto.CorrectAnswerPercentageToShow, error)
	SuddenlyFinishedParticipationPercentage(ctx context.Context, surveyId uint) (float64, error)
	GetChoicesByPercentage(ctx context.Context, surveyId uint) ([]dto.QuestionReport, error)
	GetMultipleParticipationCount(ctx context.Context, surveyId uint) ([]dto.ParticipationReport, error)
	GetAverageResponseTime(ctx context.Context, surveyId uint) (float64, error)
	GetResponseDispersionByHour(ctx context.Context, surveyId uint) ([]dto.HourDispersionDTO, error)
	GetSurveyReport(ctx context.Context, surveyId uint) (*dto.ReportResponse, error)
	GetAllSurveys(ctx context.Context) ([]models.Survey, error)
	GetAccessibleSurveys(ctx context.Context, userID uint, permission string) ([]models.Survey, error)
}

type ISurveyService

type ISurveyService interface {
	CreateSurvey(c context.Context, req dto.SurveyCreateRequest) (*dto.SurveyResponse, error)
	UpdateSurvey(c context.Context, id uint, req dto.SurveyUpdateRequest) (*dto.SurveyResponse, error)
	GetSurvey(c context.Context, id uint) (*dto.SurveyResponse, error)
	GetVote(c context.Context, id uint) (*dto.GetVoteResponse, error)
	GetSurveys(c context.Context, req dto.SurveysGetRequest) ([]*dto.SurveyResponse, error)
	DeleteSurvey(c context.Context, id uint) error
	CanUserParticipateToSurvey(c context.Context, userId uint, surveyId uint) (bool, error)
	Participate(c context.Context, userId uint, surveyId uint) (*dto.UserSurveyParticipationResponse, error)
	EndParticipation(c context.Context, participationId uint) error
	CommitParticipation(c context.Context, participationId uint) error
	CanUserVoteOnSurvey(c context.Context, userId uint, surveyId uint) (bool, error)
	CommitVote(c context.Context, vote models.Vote) error
	DeleteVote(c context.Context, id uint) error
	GetSurveyQuestionsInOrder(c context.Context, surveyId uint) (questionsAnswerMap dto.QuestionsAnswerMap, err error)
	GetVotes(surveyID, viewerID, respondentID uint) ([]map[string]interface{}, error)
	GetVisibleVoteUsers(surveyID, viewerID uint) ([]map[string]interface{}, error)
	GetSurveyVotes(c context.Context, surveyId uint) ([]dto.GetVoteResponse, error)

	CreateOption(c context.Context, userId uint, surveyId uint, req dto.SurveyOptionCreateRequest) (*dto.SurveyOptionResponse, error)
	UpdateOption(c context.Context, id uint, req dto.SurveyOptionCreateRequest) (*dto.SurveyOptionResponse, error)
	DeleteOption(c context.Context, id uint) error
	GetOptions(c context.Context, req dto.SurveyOptionsGetRequest) (response []*dto.SurveyOptionResponse, err error)

	UploadMedia(fileHeader *multipart.FileHeader) (string, error)
}

type QuestionService

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

func NewQuestionService

func NewQuestionService(conf *config.Config, repo repository.ISurveyRepository, logger logging.Logger) *QuestionService

func (*QuestionService) DeleteQuestion

func (q *QuestionService) DeleteQuestion(c context.Context, id uint) error

func (*QuestionService) GetQuestion

func (q *QuestionService) GetQuestion(c context.Context, id uint) (response *dto.Question, err error)

func (*QuestionService) GetQuestions

func (q *QuestionService) GetQuestions(c context.Context, req dto.GetQuestionsRequest) (response []*dto.Question, err error)

func (*QuestionService) UpdateQuestion

func (q *QuestionService) UpdateQuestion(c context.Context, id uint, req dto.QuestionUpdateRequest) (question *dto.Question, err error)

type ReportService

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

func NewReportService

func NewReportService(conf *config.Config, repo repository.IReportRepository, logger logging.Logger) *ReportService

func (*ReportService) GetAccessibleSurveys

func (s *ReportService) GetAccessibleSurveys(ctx context.Context, userID uint, permission string) ([]models.Survey, error)

func (*ReportService) GetAllSurveys

func (s *ReportService) GetAllSurveys(ctx context.Context) ([]models.Survey, error)

func (*ReportService) GetAverageResponseTime

func (s *ReportService) GetAverageResponseTime(ctx context.Context, surveyId uint) (float64, error)

func (*ReportService) GetChoicesByPercentage

func (s *ReportService) GetChoicesByPercentage(ctx context.Context, surveyId uint) ([]dto.QuestionReport, error)

func (*ReportService) GetCorrectAnswerPercentage

func (s *ReportService) GetCorrectAnswerPercentage(ctx context.Context, surveyId uint) ([]dto.CorrectAnswerPercentageToShow, error)

func (*ReportService) GetMultipleParticipationCount

func (s *ReportService) GetMultipleParticipationCount(ctx context.Context, surveyId uint) ([]dto.ParticipationReport, error)

func (*ReportService) GetResponseDispersionByHour

func (s *ReportService) GetResponseDispersionByHour(ctx context.Context, surveyId uint) ([]dto.HourDispersionDTO, error)

func (*ReportService) GetSurveyReport

func (s *ReportService) GetSurveyReport(ctx context.Context, surveyId uint) (*dto.ReportResponse, error)

func (*ReportService) GetTotalParticipationPercentage

func (s *ReportService) GetTotalParticipationPercentage(ctx context.Context, surveyId uint) (uint, error)

func (*ReportService) SuddenlyFinishedParticipationPercentage

func (s *ReportService) SuddenlyFinishedParticipationPercentage(ctx context.Context, surveyId uint) (float64, error)

type SurveyService

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

func NewSurveyService

func NewSurveyService(conf *config.Config, repo repository.ISurveyRepository, logger logging.Logger, notificationService notification.INotificationService) *SurveyService

func (*SurveyService) CanUserParticipateToSurvey

func (s *SurveyService) CanUserParticipateToSurvey(c context.Context, userId uint, surveyId uint) (bool, error)

func (*SurveyService) CanUserVoteOnSurvey

func (s *SurveyService) CanUserVoteOnSurvey(c context.Context, userId uint, surveyId uint) (bool, error)

func (*SurveyService) CommitParticipation

func (s *SurveyService) CommitParticipation(c context.Context, participationId uint) error

func (*SurveyService) CommitVote

func (s *SurveyService) CommitVote(c context.Context, vote models.Vote) error

func (*SurveyService) CreateOption

func (s *SurveyService) CreateOption(c context.Context, userId uint, surveyId uint, req dto.SurveyOptionCreateRequest) (response *dto.SurveyOptionResponse, err error)

func (*SurveyService) CreateSurvey

func (*SurveyService) DeleteOption

func (s *SurveyService) DeleteOption(c context.Context, id uint) error

func (*SurveyService) DeleteSurvey

func (s *SurveyService) DeleteSurvey(c context.Context, id uint) error

func (*SurveyService) DeleteVote

func (s *SurveyService) DeleteVote(c context.Context, id uint) error

func (*SurveyService) EndParticipation

func (s *SurveyService) EndParticipation(c context.Context, participationId uint) error

func (*SurveyService) GetOptions

func (s *SurveyService) GetOptions(c context.Context, req dto.SurveyOptionsGetRequest) (response []*dto.SurveyOptionResponse, err error)

func (*SurveyService) GetSurvey

func (s *SurveyService) GetSurvey(c context.Context, id uint) (*dto.SurveyResponse, error)

func (*SurveyService) GetSurveyQuestionsInOrder

func (s *SurveyService) GetSurveyQuestionsInOrder(c context.Context, surveyId uint) (questionsAnswerMap dto.QuestionsAnswerMap, err error)

func (*SurveyService) GetSurveyVotes

func (s *SurveyService) GetSurveyVotes(c context.Context, surveyId uint) (response []dto.GetVoteResponse, err error)

func (*SurveyService) GetSurveys

func (s *SurveyService) GetSurveys(c context.Context, req dto.SurveysGetRequest) (response []*dto.SurveyResponse, err error)

func (*SurveyService) GetVisibleVoteUsers

func (s *SurveyService) GetVisibleVoteUsers(surveyID, viewerID uint) ([]map[string]interface{}, error)

func (*SurveyService) GetVote

func (s *SurveyService) GetVote(c context.Context, id uint) (*dto.GetVoteResponse, error)

func (*SurveyService) GetVotes

func (s *SurveyService) GetVotes(surveyID, viewerID, respondentID uint) ([]map[string]interface{}, error)

func (*SurveyService) Participate

func (s *SurveyService) Participate(c context.Context, userId uint, surveyId uint) (*dto.UserSurveyParticipationResponse, error)

func (*SurveyService) UpdateOption

func (s *SurveyService) UpdateOption(c context.Context, id uint, req dto.SurveyOptionCreateRequest) (response *dto.SurveyOptionResponse, err error)

func (*SurveyService) UpdateSurvey

func (s *SurveyService) UpdateSurvey(c context.Context, id uint, req dto.SurveyUpdateRequest) (response *dto.SurveyResponse, err error)

func (*SurveyService) UploadMedia

func (s *SurveyService) UploadMedia(fileHeader *multipart.FileHeader) (string, error)

Jump to

Keyboard shortcuts

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