Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

アンケート対象者&管理者のグループ管理 #1290

Draft
wants to merge 7 commits into
base: fix/openapi-run
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions controller/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func convertResSharedTo(resSharedTo string) openapi.ResShareType {
func createUsersAndGroups(users []string, groups uuid.UUIDs) openapi.UsersAndGroups {
res := openapi.UsersAndGroups{
Users: users,
Groups: groups.Strings(),
Groups: groups,
}
return res
}
Expand Down Expand Up @@ -157,21 +157,14 @@ func convertQuestions(questions []model.Questions) ([]openapi.Question, error) {
return res, nil
}

// func convertRespondents(respondents []model.Respondents) []string {
// res := []string{}
// for _, respondent := range respondents {
// res = append(res, respondent.UserTraqid)
// }
// return res
// }

func questionnaire2QuestionnaireDetail(questionnaires model.Questionnaires, adminUsers []string, adminGroups []uuid.UUID, targetUsers []string, targetGroups []uuid.UUID, respondents []string) (openapi.QuestionnaireDetail, error) {
func questionnaire2QuestionnaireDetail(questionnaires model.Questionnaires, admins []string, adminUsers []string, adminGroups []uuid.UUID, targets []string, targetUsers []string, targetGroups []uuid.UUID, respondents []string) (openapi.QuestionnaireDetail, error) {
questions, err := convertQuestions(questionnaires.Questions)
if err != nil {
return openapi.QuestionnaireDetail{}, err
}
res := openapi.QuestionnaireDetail{
Admins: createUsersAndGroups(adminUsers, adminGroups),
Admin: createUsersAndGroups(adminUsers, adminGroups),
Admins: admins,
CreatedAt: questionnaires.CreatedAt,
Description: questionnaires.Description,
IsDuplicateAnswerAllowed: questionnaires.IsDuplicateAnswerAllowed,
Expand All @@ -183,7 +176,8 @@ func questionnaire2QuestionnaireDetail(questionnaires model.Questionnaires, admi
Respondents: respondents,
ResponseDueDateTime: &questionnaires.ResTimeLimit.Time,
ResponseViewableBy: convertResSharedTo(questionnaires.ResSharedTo),
Targets: createUsersAndGroups(targetUsers, targetGroups),
Target: createUsersAndGroups(targetUsers, targetGroups),
Targets: targets,
Title: questionnaires.Title,
}
return res, nil
Expand Down Expand Up @@ -238,7 +232,7 @@ func respondentDetail2Response(ctx echo.Context, respondentDetail model.Responde
case "MultipleChoice":
if r.Body.Valid {
answer := []int{}
questionnaire, _, _, _, _, _, err := model.NewQuestionnaire().GetQuestionnaireInfo(ctx.Request().Context(), r.QuestionID)
questionnaire, _, _, _, _, _, _, _, err := model.NewQuestionnaire().GetQuestionnaireInfo(ctx.Request().Context(), r.QuestionID)
if err != nil {
ctx.Logger().Errorf("failed to get questionnaire info: %+v", err)
return openapi.Response{}, err
Expand All @@ -262,7 +256,7 @@ func respondentDetail2Response(ctx echo.Context, respondentDetail model.Responde
}
case "Checkbox":
if r.Body.Valid {
questionnaire, _, _, _, _, _, err := model.NewQuestionnaire().GetQuestionnaireInfo(ctx.Request().Context(), r.QuestionID)
questionnaire, _, _, _, _, _, _, _, err := model.NewQuestionnaire().GetQuestionnaireInfo(ctx.Request().Context(), r.QuestionID)
if err != nil {
ctx.Logger().Errorf("failed to get questionnaire info: %+v", err)
return openapi.Response{}, err
Expand Down
2 changes: 1 addition & 1 deletion controller/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (m Middleware) QuestionnaireReadAuthenticate(next echo.HandlerFunc) echo.Ha
}

// 公開されたらOK
questionnaire, _, _, _, _, _, err := m.IQuestionnaire.GetQuestionnaireInfo(c.Request().Context(), questionnaireID)
questionnaire, _, _, _, _, _, _, _, err := m.IQuestionnaire.GetQuestionnaireInfo(c.Request().Context(), questionnaireID)
if errors.Is(err, model.ErrRecordNotFound) {
c.Logger().Infof("questionnaire not found: %+v", err)
return echo.NewHTTPError(http.StatusNotFound, fmt.Errorf("questionnaire not found:%d", questionnaireID))
Expand Down
177 changes: 108 additions & 69 deletions controller/questionnaire.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,53 @@
model.IQuestionnaire
model.ITarget
model.ITargetGroup
model.ITargetUser
model.IAdministrator
model.IAdministratorGroup
model.IAdministratorUser
model.IQuestion
model.IOption
model.IScaleLabel
model.IValidation
model.ITransaction
model.IRespondent
traq.IWebhook
Response
*Response
}

func NewQuestionnaire(
questionnaire model.IQuestionnaire,
target model.ITarget,
targetGroup model.ITargetGroup,
targetUser model.ITargetUser,
administrator model.IAdministrator,
administratorGroup model.IAdministratorGroup,
administratorUser model.IAdministratorUser,
question model.IQuestion,
option model.IOption,
scaleLabel model.IScaleLabel,
validation model.IValidation,
transaction model.ITransaction,
respodent model.IRespondent,
webhook traq.IWebhook,
response *Response,
) *Questionnaire {
return &Questionnaire{
IQuestionnaire: questionnaire,
ITarget: target,
IAdministrator: administrator,
IQuestion: question,
IOption: option,
IScaleLabel: scaleLabel,
IValidation: validation,
ITransaction: transaction,
IWebhook: webhook,
IQuestionnaire: questionnaire,
ITarget: target,
ITargetGroup: targetGroup,
ITargetUser: targetUser,
IAdministrator: administrator,
IAdministratorGroup: administratorGroup,
IAdministratorUser: administratorUser,
IQuestion: question,
IOption: option,
IScaleLabel: scaleLabel,
IValidation: validation,
ITransaction: transaction,
IRespondent: respodent,
IWebhook: webhook,
Response: response,
}
}

Expand Down Expand Up @@ -93,7 +108,7 @@
hasMyResponse := false
respondendDateTimeByMe := null.Time{}

myRespondents, err := q.GetRespondentInfos(ctx.Request().Context(), userID, questionnaire.ID)

Check failure on line 111 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / Lint

q.GetRespondentInfos undefined (type Questionnaire has no field or method GetRespondentInfos) (typecheck)
if err != nil {
return res, err
}
Expand Down Expand Up @@ -132,47 +147,57 @@
questionnaireID := 0

err := q.ITransaction.Do(c.Request().Context(), nil, func(ctx context.Context) error {
questionnaireID, err := q.InsertQuestionnaire(ctx, params.Title, params.Description, responseDueDateTime, convertResponseViewableBy(params.ResponseViewableBy), params.IsPublished, params.IsAnonymous, params.IsDuplicateAnswerAllowed)

Check failure on line 150 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / Lint

q.InsertQuestionnaire undefined (type Questionnaire has no field or method InsertQuestionnaire) (typecheck)
if err != nil {
c.Logger().Errorf("failed to insert questionnaire: %+v", err)
return err
}
allTargetUsers, err := rollOutUsersAndGroups(params.Targets.Users, params.Targets.Groups)
allTargetUsers, err := rollOutUsersAndGroups(params.Target.Users, params.Target.Groups)
if err != nil {
c.Logger().Errorf("failed to roll out users and groups: %+v", err)
return err
}
targetGroupNames, err := uuid2GroupNames(params.Targets.Groups)
targetGroupNames, err := uuid2GroupNames(params.Target.Groups)
if err != nil {
c.Logger().Errorf("failed to get group names: %+v", err)
return err
}
err = q.InsertTargets(ctx, questionnaireID, allTargetUsers)

Check failure on line 165 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / Lint

q.InsertTargets undefined (type Questionnaire has no field or method InsertTargets) (typecheck)
if err != nil {
c.Logger().Errorf("failed to insert targets: %+v", err)
return err
}
err = q.InsertTargetGroups(ctx, questionnaireID, params.Targets.Groups)
err = q.InsertTargetUsers(ctx, questionnaireID, params.Target.Users)

Check failure on line 170 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / Lint

q.InsertTargetUsers undefined (type Questionnaire has no field or method InsertTargetUsers) (typecheck)

Check failure on line 170 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L170

q.InsertTargetUsers undefined (type Questionnaire has no field or method InsertTargetUsers) (typecheck)
Raw output
controller/questionnaire.go:170:11: q.InsertTargetUsers undefined (type Questionnaire has no field or method InsertTargetUsers) (typecheck)
		err = q.InsertTargetUsers(ctx, questionnaireID, params.Target.Users)
		        ^
if err != nil {
c.Logger().Errorf("failed to insert target groups: %+v", err)
return err
}
allAdminUsers, err := rollOutUsersAndGroups(params.Admins.Users, params.Admins.Groups)
err = q.InsertTargetGroups(ctx, questionnaireID, params.Target.Groups)

Check failure on line 175 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / Lint

q.InsertTargetGroups undefined (type Questionnaire has no field or method InsertTargetGroups) (typecheck)

Check failure on line 175 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L175

q.InsertTargetGroups undefined (type Questionnaire has no field or method InsertTargetGroups) (typecheck)
Raw output
controller/questionnaire.go:175:11: q.InsertTargetGroups undefined (type Questionnaire has no field or method InsertTargetGroups) (typecheck)
		err = q.InsertTargetGroups(ctx, questionnaireID, params.Target.Groups)
		        ^
if err != nil {
c.Logger().Errorf("failed to insert target groups: %+v", err)
return err
}
allAdminUsers, err := rollOutUsersAndGroups(params.Admin.Users, params.Admin.Groups)
if err != nil {
c.Logger().Errorf("failed to roll out administrators: %+v", err)
return err
}
adminGroupNames, err := uuid2GroupNames(params.Admins.Groups)
adminGroupNames, err := uuid2GroupNames(params.Admin.Groups)
if err != nil {
c.Logger().Errorf("failed to get group names: %+v", err)
return err
}
err = q.InsertAdministrators(ctx, questionnaireID, allAdminUsers)

Check failure on line 190 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / Lint

q.InsertAdministrators undefined (type Questionnaire has no field or method InsertAdministrators) (typecheck)
if err != nil {
c.Logger().Errorf("failed to insert administrators: %+v", err)
return err
}
err = q.InsertAdministratorGroups(ctx, questionnaireID, params.Admins.Groups)
err = q.InsertAdministratorUsers(ctx, questionnaireID, params.Admin.Users)

Check failure on line 195 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / Lint

q.InsertAdministratorUsers undefined (type Questionnaire has no field or method InsertAdministratorUsers) (typecheck)

Check failure on line 195 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L195

q.InsertAdministratorUsers undefined (type Questionnaire has no field or method InsertAdministratorUsers) (typecheck)
Raw output
controller/questionnaire.go:195:11: q.InsertAdministratorUsers undefined (type Questionnaire has no field or method InsertAdministratorUsers) (typecheck)
		err = q.InsertAdministratorUsers(ctx, questionnaireID, params.Admin.Users)
		        ^
if err != nil {
c.Logger().Errorf("failed to insert administrator users: %+v", err)
return err
}
err = q.InsertAdministratorGroups(ctx, questionnaireID, params.Admin.Groups)

Check failure on line 200 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / Lint

q.InsertAdministratorGroups undefined (type Questionnaire has no field or method InsertAdministratorGroups) (typecheck)

Check failure on line 200 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L200

q.InsertAdministratorGroups undefined (type Questionnaire has no field or method InsertAdministratorGroups) (typecheck)
Raw output
controller/questionnaire.go:200:11: q.InsertAdministratorGroups undefined (type Questionnaire has no field or method InsertAdministratorGroups) (typecheck)
		err = q.InsertAdministratorGroups(ctx, questionnaireID, params.Admin.Groups)
		        ^
if err != nil {
c.Logger().Errorf("failed to insert administrator groups: %+v", err)
return err
Expand All @@ -190,7 +215,7 @@
return err
}
questionType := questionParsed["question_type"].(string)
_, err = q.InsertQuestion(ctx, questionnaireID, 1, questoinNum+1, questionType, question.Body, question.IsRequired)

Check failure on line 218 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / Lint

q.InsertQuestion undefined (type Questionnaire has no field or method InsertQuestion) (typecheck)
if err != nil {
c.Logger().Errorf("failed to insert question: %+v", err)
return err
Expand Down Expand Up @@ -327,25 +352,25 @@
}
}

questionnaireInfo, targets, targetGroups, admins, adminGroups, respondents, err := q.GetQuestionnaireInfo(c.Request().Context(), questionnaireID)
questionnaireInfo, targets, targetUsers, targetGroups, admins, adminUsers, adminGroups, respondents, err := q.GetQuestionnaireInfo(c.Request().Context(), questionnaireID)

Check failure on line 355 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / Lint

q.GetQuestionnaireInfo undefined (type Questionnaire has no field or method GetQuestionnaireInfo) (typecheck)

Check failure on line 355 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L355

q.GetQuestionnaireInfo undefined (type Questionnaire has no field or method GetQuestionnaireInfo) (typecheck)
Raw output
controller/questionnaire.go:355:112: q.GetQuestionnaireInfo undefined (type Questionnaire has no field or method GetQuestionnaireInfo) (typecheck)
	questionnaireInfo, targets, targetUsers, targetGroups, admins, adminUsers, adminGroups, respondents, err := q.GetQuestionnaireInfo(c.Request().Context(), questionnaireID)
	                                                                                                              ^
if err != nil {
c.Logger().Errorf("failed to get questionnaire info: %+v", err)
return openapi.QuestionnaireDetail{}, echo.NewHTTPError(http.StatusInternalServerError, "failed to get questionnaire info")
}

questionnaireDetail, err := questionnaire2QuestionnaireDetail(*questionnaireInfo, admins, adminGroups, targets, targetGroups, respondents)
questionnaireDetail, err := questionnaire2QuestionnaireDetail(*questionnaireInfo, admins, adminUsers, adminGroups, targets, targetUsers, targetGroups, respondents)
if err != nil {
c.Logger().Errorf("failed to convert questionnaire to questionnaire detail: %+v", err)
return openapi.QuestionnaireDetail{}, echo.NewHTTPError(http.StatusInternalServerError, "failed to convert questionnaire to questionnaire detail")
}
return questionnaireDetail, nil
}
func (q Questionnaire) GetQuestionnaire(ctx echo.Context, questionnaireID int) (openapi.QuestionnaireDetail, error) {
questionnaireInfo, targets, targetGroups, admins, adminGroups, respondents, err := q.GetQuestionnaireInfo(ctx.Request().Context(), questionnaireID)
questionnaireInfo, targets, targetUsers, targetGroups, admins, adminUsers, adminGroups, respondents, err := q.GetQuestionnaireInfo(ctx.Request().Context(), questionnaireID)

Check failure on line 369 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L369

q.GetQuestionnaireInfo undefined (type Questionnaire has no field or method GetQuestionnaireInfo) (typecheck)
Raw output
controller/questionnaire.go:369:112: q.GetQuestionnaireInfo undefined (type Questionnaire has no field or method GetQuestionnaireInfo) (typecheck)
	questionnaireInfo, targets, targetUsers, targetGroups, admins, adminUsers, adminGroups, respondents, err := q.GetQuestionnaireInfo(ctx.Request().Context(), questionnaireID)
	                                                                                                              ^
if err != nil {
return openapi.QuestionnaireDetail{}, err
}
questionnaireDetail, err := questionnaire2QuestionnaireDetail(*questionnaireInfo, admins, adminGroups, targets, targetGroups, respondents)
questionnaireDetail, err := questionnaire2QuestionnaireDetail(*questionnaireInfo, admins, adminUsers, adminGroups, targets, targetUsers, targetGroups, respondents)
if err != nil {
ctx.Logger().Errorf("failed to convert questionnaire to questionnaire detail: %+v", err)
return openapi.QuestionnaireDetail{}, echo.NewHTTPError(http.StatusInternalServerError, "failed to convert questionnaire to questionnaire detail")
Expand Down Expand Up @@ -376,55 +401,69 @@
c.Logger().Errorf("failed to update questionnaire: %+v", err)
return err
}
err = q.DeleteTargets(ctx, questionnaireID)
if err != nil {
c.Logger().Errorf("failed to delete targets: %+v", err)
return err
}
err = q.DeleteTargetGroups(ctx, questionnaireID)
if err != nil {
c.Logger().Errorf("failed to delete target groups: %+v", err)
return err
}
allTargetUsers, err := rollOutUsersAndGroups(params.Targets.Users, params.Targets.Groups)
if err != nil {
c.Logger().Errorf("failed to roll out users and groups: %+v", err)
return err
}
err = q.InsertTargets(ctx, questionnaireID, allTargetUsers)
if err != nil {
c.Logger().Errorf("failed to insert targets: %+v", err)
return err
}
err = q.InsertTargetGroups(ctx, questionnaireID, params.Targets.Groups)
if err != nil {
c.Logger().Errorf("failed to insert target groups: %+v", err)
return err
}
err = q.DeleteAdministrators(ctx, questionnaireID)
if err != nil {
c.Logger().Errorf("failed to delete administrators: %+v", err)
return err
}
err = q.DeleteAdministratorGroups(ctx, questionnaireID)
if err != nil {
c.Logger().Errorf("failed to delete administrator groups: %+v", err)
return err
}
allAdminUsers, err := rollOutUsersAndGroups(params.Admins.Users, params.Admins.Groups)
if err != nil {
c.Logger().Errorf("failed to roll out administrators: %+v", err)
return err
}
err = q.InsertAdministrators(ctx, questionnaireID, allAdminUsers)
if err != nil {
c.Logger().Errorf("failed to insert administrators: %+v", err)
return err
if params.Target != nil {
err = q.DeleteTargets(ctx, questionnaireID)

Check failure on line 405 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L405

q.DeleteTargets undefined (type Questionnaire has no field or method DeleteTargets) (typecheck)
Raw output
controller/questionnaire.go:405:12: q.DeleteTargets undefined (type Questionnaire has no field or method DeleteTargets) (typecheck)
			err = q.DeleteTargets(ctx, questionnaireID)
			        ^
if err != nil {
c.Logger().Errorf("failed to delete targets: %+v", err)
return err
}
err = q.DeleteTargetGroups(ctx, questionnaireID)

Check failure on line 410 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L410

q.DeleteTargetGroups undefined (type Questionnaire has no field or method DeleteTargetGroups) (typecheck)
Raw output
controller/questionnaire.go:410:12: q.DeleteTargetGroups undefined (type Questionnaire has no field or method DeleteTargetGroups) (typecheck)
			err = q.DeleteTargetGroups(ctx, questionnaireID)
			        ^
if err != nil {
c.Logger().Errorf("failed to delete target groups: %+v", err)
return err
}
allTargetUsers, err := rollOutUsersAndGroups((*params.Target).Users, params.Target.Groups)
if err != nil {
c.Logger().Errorf("failed to roll out users and groups: %+v", err)
return err
}
err = q.InsertTargets(ctx, questionnaireID, allTargetUsers)

Check failure on line 420 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L420

q.InsertTargets undefined (type Questionnaire has no field or method InsertTargets) (typecheck)
Raw output
controller/questionnaire.go:420:12: q.InsertTargets undefined (type Questionnaire has no field or method InsertTargets) (typecheck)
			err = q.InsertTargets(ctx, questionnaireID, allTargetUsers)
			        ^
if err != nil {
c.Logger().Errorf("failed to insert targets: %+v", err)
return err
}
err = q.InsertTargetUsers(ctx, questionnaireID, params.Target.Users)

Check failure on line 425 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L425

q.InsertTargetUsers undefined (type Questionnaire has no field or method InsertTargetUsers) (typecheck)
Raw output
controller/questionnaire.go:425:12: q.InsertTargetUsers undefined (type Questionnaire has no field or method InsertTargetUsers) (typecheck)
			err = q.InsertTargetUsers(ctx, questionnaireID, params.Target.Users)
			        ^
if err != nil {
c.Logger().Errorf("failed to insert target users: %+v", err)
return err
}
err = q.InsertTargetGroups(ctx, questionnaireID, params.Target.Groups)

Check failure on line 430 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L430

q.InsertTargetGroups undefined (type Questionnaire has no field or method InsertTargetGroups) (typecheck)
Raw output
controller/questionnaire.go:430:12: q.InsertTargetGroups undefined (type Questionnaire has no field or method InsertTargetGroups) (typecheck)
			err = q.InsertTargetGroups(ctx, questionnaireID, params.Target.Groups)
			        ^
if err != nil {
c.Logger().Errorf("failed to insert target groups: %+v", err)
return err
}
}
err = q.InsertAdministratorGroups(ctx, questionnaireID, params.Admins.Groups)
if err != nil {
c.Logger().Errorf("failed to insert administrator groups: %+v", err)
return err
if params.Admin != nil {
err = q.DeleteAdministrators(ctx, questionnaireID)

Check failure on line 437 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L437

q.DeleteAdministrators undefined (type Questionnaire has no field or method DeleteAdministrators) (typecheck)
Raw output
controller/questionnaire.go:437:12: q.DeleteAdministrators undefined (type Questionnaire has no field or method DeleteAdministrators) (typecheck)
			err = q.DeleteAdministrators(ctx, questionnaireID)
			        ^
if err != nil {
c.Logger().Errorf("failed to delete administrators: %+v", err)
return err
}
err = q.DeleteAdministratorGroups(ctx, questionnaireID)

Check failure on line 442 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L442

q.DeleteAdministratorGroups undefined (type Questionnaire has no field or method DeleteAdministratorGroups) (typecheck)
Raw output
controller/questionnaire.go:442:12: q.DeleteAdministratorGroups undefined (type Questionnaire has no field or method DeleteAdministratorGroups) (typecheck)
			err = q.DeleteAdministratorGroups(ctx, questionnaireID)
			        ^
if err != nil {
c.Logger().Errorf("failed to delete administrator groups: %+v", err)
return err
}
allAdminUsers, err := rollOutUsersAndGroups(params.Admin.Users, params.Admin.Groups)
if err != nil {
c.Logger().Errorf("failed to roll out administrators: %+v", err)
return err
}
err = q.InsertAdministrators(ctx, questionnaireID, allAdminUsers)

Check failure on line 452 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L452

q.InsertAdministrators undefined (type Questionnaire has no field or method InsertAdministrators) (typecheck)
Raw output
controller/questionnaire.go:452:12: q.InsertAdministrators undefined (type Questionnaire has no field or method InsertAdministrators) (typecheck)
			err = q.InsertAdministrators(ctx, questionnaireID, allAdminUsers)
			        ^
if err != nil {
c.Logger().Errorf("failed to insert administrators: %+v", err)
return err
}
err = q.InsertAdministratorUsers(ctx, questionnaireID, params.Admin.Users)

Check failure on line 457 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L457

q.InsertAdministratorUsers undefined (type Questionnaire has no field or method InsertAdministratorUsers) (typecheck)
Raw output
controller/questionnaire.go:457:12: q.InsertAdministratorUsers undefined (type Questionnaire has no field or method InsertAdministratorUsers) (typecheck)
			err = q.InsertAdministratorUsers(ctx, questionnaireID, params.Admin.Users)
			        ^
if err != nil {
c.Logger().Errorf("failed to insert administrator users: %+v", err)
return err
}
err = q.InsertAdministratorGroups(ctx, questionnaireID, params.Admin.Groups)

Check failure on line 462 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L462

q.InsertAdministratorGroups undefined (type Questionnaire has no field or method InsertAdministratorGroups) (typecheck)
Raw output
controller/questionnaire.go:462:12: q.InsertAdministratorGroups undefined (type Questionnaire has no field or method InsertAdministratorGroups) (typecheck)
			err = q.InsertAdministratorGroups(ctx, questionnaireID, params.Admin.Groups)
			        ^
if err != nil {
c.Logger().Errorf("failed to insert administrator groups: %+v", err)
return err
}
}
for questoinNum, question := range params.Questions {
b, err := question.MarshalJSON()
Expand Down Expand Up @@ -648,7 +687,7 @@
return nil
}

questionnaire, _, _, _, _, _, err := q.GetQuestionnaireInfo(c.Request().Context(), questionnaireID)
questionnaire, _, _, _, _, _, _, _, err := q.GetQuestionnaireInfo(c.Request().Context(), questionnaireID)

Check failure on line 690 in controller/questionnaire.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] controller/questionnaire.go#L690

q.GetQuestionnaireInfo undefined (type Questionnaire has no field or method GetQuestionnaireInfo) (typecheck)
Raw output
controller/questionnaire.go:690:48: q.GetQuestionnaireInfo undefined (type Questionnaire has no field or method GetQuestionnaireInfo) (typecheck)
		questionnaire, _, _, _, _, _, _, _, err := q.GetQuestionnaireInfo(c.Request().Context(), questionnaireID)
		                                             ^
if err != nil {
if errors.Is(err, model.ErrRecordNotFound) {
c.Logger().Info("questionnaire not found")
Expand Down
2 changes: 1 addition & 1 deletion controller/reminder.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (jq *JobQueue) CheckRemindStatus(questionnaireID int) (bool, error) {
func reminderAction(questionnaireID int, leftTimeText string) error {
ctx := context.Background()
q := model.Questionnaire{}
questionnaire, _, _, administrators, _, respondants, err := q.GetQuestionnaireInfo(ctx, questionnaireID)
questionnaire, _, _, _, administrators, _, _, respondants, err := q.GetQuestionnaireInfo(ctx, questionnaireID)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion controller/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (r Response) GetMyResponses(ctx echo.Context, params openapi.GetMyResponses
return openapi.ResponsesWithQuestionnaireInfo{}, echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get respondent detail: %w", err))
}

questionnaire, _, _, _, _, _, err := r.IQuestionnaire.GetQuestionnaireInfo(ctx.Request().Context(), responseDetail.QuestionnaireID)
questionnaire, _, _, _, _, _, _, _, err := r.IQuestionnaire.GetQuestionnaireInfo(ctx.Request().Context(), responseDetail.QuestionnaireID)
if err != nil {
ctx.Logger().Errorf("failed to get questionnaire info: %+v", err)
return openapi.ResponsesWithQuestionnaireInfo{}, echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get questionnaire info: %w", err))
Expand Down
Loading
Loading