Skip to content

Commit

Permalink
fix GetQuestionnaireInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitoyama committed Dec 9, 2024
1 parent 55a0dc5 commit f5708e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions controller/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package controller
import (
"strconv"

"github.com/google/uuid"
"github.com/labstack/echo/v4"
"github.com/traPtitech/anke-to/model"
"github.com/traPtitech/anke-to/openapi"
Expand Down Expand Up @@ -64,10 +65,10 @@ func convertResSharedTo(resSharedTo string) openapi.ResShareType {

}

func createUsersAndGroups(users []string, groups []string) openapi.UsersAndGroups {
func createUsersAndGroups(users []string, groups uuid.UUIDs) openapi.UsersAndGroups {
res := openapi.UsersAndGroups{
Users: users,
Groups: groups,
Groups: groups.Strings(),
}
return res
}
Expand Down Expand Up @@ -147,14 +148,14 @@ func convertRespondents(respondents []model.Respondents) []string {
return res
}

func questionnaire2QuestionnaireDetail(questionnaires model.Questionnaires, adminUsers []string, adminGroups []string, targetUsers []string, targetGroups []string, respondents []string) openapi.QuestionnaireDetail {
func questionnaire2QuestionnaireDetail(questionnaires model.Questionnaires, adminUsers []string, adminGroups []uuid.UUID, targetUsers []string, targetGroups []uuid.UUID, respondents []string) openapi.QuestionnaireDetail {
res := openapi.QuestionnaireDetail{
Admins: createUsersAndGroups(adminUsers, adminGroups),
CreatedAt: questionnaires.CreatedAt,
Description: questionnaires.Description,
// IsAllowingMultipleResponses: questionnaires.IsAllowingMultipleResponses,
IsAnonymous: questionnaires.IsAnonymous,
IsPublished: questionnaires.IsPublished,
IsAnonymous: questionnaires.IsAnonymous,
IsPublished: questionnaires.IsPublished,
ModifiedAt: questionnaires.ModifiedAt,
QuestionnaireId: questionnaires.ID,
Questions: convertQuestions(questionnaires.Questions),
Expand Down
3 changes: 2 additions & 1 deletion model/questionnaires.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package model
import (
"context"

"github.com/google/uuid"
"gopkg.in/guregu/null.v4"
)

Expand All @@ -15,7 +16,7 @@ type IQuestionnaire interface {
DeleteQuestionnaire(ctx context.Context, questionnaireID int) error
GetQuestionnaires(ctx context.Context, userID string, sort string, search string, pageNum int, onlyTargetingMe bool, onlyAdministratedByMe bool) ([]QuestionnaireInfo, int, error)
GetAdminQuestionnaires(ctx context.Context, userID string) ([]Questionnaires, error)
GetQuestionnaireInfo(ctx context.Context, questionnaireID int) (*Questionnaires, []string, []string, []string, []string, []string, error)
GetQuestionnaireInfo(ctx context.Context, questionnaireID int) (*Questionnaires, []string, []uuid.UUID, []string, []uuid.UUID, []string, error)
GetTargettedQuestionnaires(ctx context.Context, userID string, answered string, sort string) ([]TargettedQuestionnaire, error)
GetQuestionnaireLimit(ctx context.Context, questionnaireID int) (null.Time, error)
GetQuestionnaireLimitByResponseID(ctx context.Context, responseID int) (null.Time, error)
Expand Down

0 comments on commit f5708e1

Please sign in to comment.