diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f4e032de..6f224826 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,7 +78,8 @@ jobs: ${{ runner.os }}-gomod- - run: go install github.com/golang/mock/mockgen@v1.5.0 - run: go generate ./... - - run: go test ./model ./router -v -coverprofile=coverage.txt -race -vet=off + - run: go test ./model -v -coverprofile=coverage.txt -race -vet=off # for temporary use as controller test is not ready + # - run: go test ./controller ./model -v -coverprofile=coverage.txt -race -vet=off env: MARIADB_USERNAME: root MARIADB_PASSWORD: password diff --git a/controller/adapter.go b/controller/adapter.go index b385a31a..c5183c6b 100644 --- a/controller/adapter.go +++ b/controller/adapter.go @@ -85,12 +85,11 @@ func convertQuestions(questions []model.Questions) []openapi.Question { res := []openapi.Question{} for _, question := range questions { q := openapi.Question{ - CreatedAt: question.CreatedAt, - // Description: question.Description, + CreatedAt: question.CreatedAt, + Body: question.Body, IsRequired: question.IsRequired, - QuestionId: question.ID, + QuestionId: &question.ID, QuestionnaireId: question.QuestionnaireID, - Title: question.Body, } switch question.Type { case "Text": diff --git a/handler/middleware.go b/controller/middleware.go similarity index 82% rename from handler/middleware.go rename to controller/middleware.go index b7e0167f..7f10d008 100644 --- a/handler/middleware.go +++ b/controller/middleware.go @@ -1,4 +1,4 @@ -package handler +package controller import ( "errors" @@ -21,8 +21,18 @@ type Middleware struct { } // NewMiddleware Middlewareのコンストラクタ -func NewMiddleware() *Middleware { - return &Middleware{} +func NewMiddleware( + administrator model.IAdministrator, + respondent model.IRespondent, + question model.IQuestion, + questionnaire model.IQuestionnaire, +) *Middleware { + return &Middleware{ + IAdministrator: administrator, + IRespondent: respondent, + IQuestion: question, + IQuestionnaire: questionnaire, + } } const ( @@ -41,7 +51,7 @@ const ( var adminUserIDs = []string{"ryoha", "xxarupakaxx", "kaitoyama", "cp20", "itzmeowww"} // SetUserIDMiddleware X-Showcase-UserからユーザーIDを取得しセットする -func (*Middleware) SetUserIDMiddleware(next echo.HandlerFunc) echo.HandlerFunc { +func (m Middleware) SetUserIDMiddleware(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { userID := c.Request().Header.Get("X-Showcase-User") if userID == "" { @@ -55,9 +65,9 @@ func (*Middleware) SetUserIDMiddleware(next echo.HandlerFunc) echo.HandlerFunc { } // TraPMemberAuthenticate traP部員かの認証 -func (*Middleware) TraPMemberAuthenticate(next echo.HandlerFunc) echo.HandlerFunc { +func (m Middleware) TraPMemberAuthenticate(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { - userID, err := getUserID(c) + userID, err := m.GetUserID(c) if err != nil { c.Logger().Errorf("failed to get userID: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get userID: %w", err)) @@ -74,11 +84,11 @@ func (*Middleware) TraPMemberAuthenticate(next echo.HandlerFunc) echo.HandlerFun } // TrapRateLimitMiddlewareFunc traP IDベースのリクエスト制限 -func (*Middleware) TrapRateLimitMiddlewareFunc() echo.MiddlewareFunc { +func (m Middleware) TrapRateLimitMiddlewareFunc() echo.MiddlewareFunc { config := middleware.RateLimiterConfig{ Store: middleware.NewRateLimiterMemoryStore(5), IdentifierExtractor: func(c echo.Context) (string, error) { - userID, err := getUserID(c) + userID, err := m.GetUserID(c) if err != nil { c.Logger().Errorf("failed to get userID: %+v", err) return "", echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get userID: %w", err)) @@ -92,10 +102,10 @@ func (*Middleware) TrapRateLimitMiddlewareFunc() echo.MiddlewareFunc { } // QuestionnaireReadAuthenticate アンケートの閲覧権限があるかの認証 -func (m *Middleware) QuestionnaireReadAuthenticate(next echo.HandlerFunc) echo.HandlerFunc { +func (m Middleware) QuestionnaireReadAuthenticate(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { - userID, err := getUserID(c) + userID, err := m.GetUserID(c) if err != nil { c.Logger().Errorf("failed to get userID: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get userID: %w", err)) @@ -116,7 +126,7 @@ func (m *Middleware) QuestionnaireReadAuthenticate(next echo.HandlerFunc) echo.H return next(c) } } - isAdmin, err := m.CheckQuestionnaireAdmin(c.Request().Context(), userID, questionnaireID) + isAdmin, err := m.IAdministrator.CheckQuestionnaireAdmin(c.Request().Context(), userID, questionnaireID) if err != nil { c.Logger().Errorf("failed to check questionnaire admin: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to check if you are administrator: %w", err)) @@ -127,7 +137,7 @@ func (m *Middleware) QuestionnaireReadAuthenticate(next echo.HandlerFunc) echo.H } // 公開されたらOK - questionnaire, _, _, _, _, _, err := m.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)) @@ -147,10 +157,10 @@ func (m *Middleware) QuestionnaireReadAuthenticate(next echo.HandlerFunc) echo.H } // QuestionnaireAdministratorAuthenticate アンケートの管理者かどうかの認証 -func (m *Middleware) QuestionnaireAdministratorAuthenticate(next echo.HandlerFunc) echo.HandlerFunc { +func (m Middleware) QuestionnaireAdministratorAuthenticate(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { - userID, err := getUserID(c) + userID, err := m.GetUserID(c) if err != nil { c.Logger().Errorf("failed to get userID: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get userID: %w", err)) @@ -170,7 +180,7 @@ func (m *Middleware) QuestionnaireAdministratorAuthenticate(next echo.HandlerFun return next(c) } } - isAdmin, err := m.CheckQuestionnaireAdmin(c.Request().Context(), userID, questionnaireID) + isAdmin, err := m.IAdministrator.CheckQuestionnaireAdmin(c.Request().Context(), userID, questionnaireID) if err != nil { c.Logger().Errorf("failed to check questionnaire admin: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to check if you are administrator: %w", err)) @@ -186,10 +196,10 @@ func (m *Middleware) QuestionnaireAdministratorAuthenticate(next echo.HandlerFun } // ResponseReadAuthenticate 回答閲覧権限があるかの認証 -func (m *Middleware) ResponseReadAuthenticate(next echo.HandlerFunc) echo.HandlerFunc { +func (m Middleware) ResponseReadAuthenticate(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { - userID, err := getUserID(c) + userID, err := m.GetUserID(c) if err != nil { c.Logger().Errorf("failed to get userID: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get userID: %w", err)) @@ -203,7 +213,7 @@ func (m *Middleware) ResponseReadAuthenticate(next echo.HandlerFunc) echo.Handle } // 回答者ならOK - respondent, err := m.GetRespondent(c.Request().Context(), responseID) + respondent, err := m.IRespondent.GetRespondent(c.Request().Context(), responseID) if errors.Is(err, model.ErrRecordNotFound) { c.Logger().Infof("response not found: %+v", err) return echo.NewHTTPError(http.StatusNotFound, fmt.Errorf("response not found:%d", responseID)) @@ -229,7 +239,7 @@ func (m *Middleware) ResponseReadAuthenticate(next echo.HandlerFunc) echo.Handle } // アンケートごとの回答閲覧権限チェック - responseReadPrivilegeInfo, err := m.GetResponseReadPrivilegeInfoByResponseID(c.Request().Context(), userID, responseID) + responseReadPrivilegeInfo, err := m.IQuestionnaire.GetResponseReadPrivilegeInfoByResponseID(c.Request().Context(), userID, responseID) if errors.Is(err, model.ErrRecordNotFound) { c.Logger().Infof("response not found: %+v", err) return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("invalid responseID: %d", responseID)) @@ -252,10 +262,10 @@ func (m *Middleware) ResponseReadAuthenticate(next echo.HandlerFunc) echo.Handle } // RespondentAuthenticate 回答者かどうかの認証 -func (m *Middleware) RespondentAuthenticate(next echo.HandlerFunc) echo.HandlerFunc { +func (m Middleware) RespondentAuthenticate(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { - userID, err := getUserID(c) + userID, err := m.GetUserID(c) if err != nil { c.Logger().Errorf("failed to get userID: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get userID: %w", err)) @@ -268,7 +278,7 @@ func (m *Middleware) RespondentAuthenticate(next echo.HandlerFunc) echo.HandlerF return echo.NewHTTPError(http.StatusBadRequest, fmt.Errorf("invalid responseID:%s(error: %w)", strResponseID, err)) } - respondent, err := m.GetRespondent(c.Request().Context(), responseID) + respondent, err := m.IRespondent.GetRespondent(c.Request().Context(), responseID) if errors.Is(err, model.ErrRecordNotFound) { c.Logger().Infof("response not found: %+v", err) return echo.NewHTTPError(http.StatusNotFound, fmt.Errorf("response not found:%d", responseID)) @@ -291,21 +301,8 @@ func (m *Middleware) RespondentAuthenticate(next echo.HandlerFunc) echo.HandlerF } } -func checkResponseReadPrivilege(responseReadPrivilegeInfo *model.ResponseReadPrivilegeInfo) (bool, error) { - switch responseReadPrivilegeInfo.ResSharedTo { - case "administrators": - return responseReadPrivilegeInfo.IsAdministrator, nil - case "respondents": - return responseReadPrivilegeInfo.IsAdministrator || responseReadPrivilegeInfo.IsRespondent, nil - case "public": - return true, nil - } - - return false, errors.New("invalid resSharedTo") -} - -// getValidator Validatorを設定する -func getValidator(c echo.Context) (*validator.Validate, error) { +// GetValidator Validatorを設定する +func (m Middleware) GetValidator(c echo.Context) (*validator.Validate, error) { rowValidate := c.Get(validatorKey) validate, ok := rowValidate.(*validator.Validate) if !ok { @@ -315,8 +312,8 @@ func getValidator(c echo.Context) (*validator.Validate, error) { return validate, nil } -// getUserID ユーザーIDを取得する -func getUserID(c echo.Context) (string, error) { +// GetUserID ユーザーIDを取得する +func (m Middleware) GetUserID(c echo.Context) (string, error) { rowUserID := c.Get(userIDKey) userID, ok := rowUserID.(string) if !ok { @@ -325,3 +322,16 @@ func getUserID(c echo.Context) (string, error) { return userID, nil } + +func checkResponseReadPrivilege(responseReadPrivilegeInfo *model.ResponseReadPrivilegeInfo) (bool, error) { + switch responseReadPrivilegeInfo.ResSharedTo { + case "administrators": + return responseReadPrivilegeInfo.IsAdministrator, nil + case "respondents": + return responseReadPrivilegeInfo.IsAdministrator || responseReadPrivilegeInfo.IsRespondent, nil + case "public": + return true, nil + } + + return false, errors.New("invalid resSharedTo") +} diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 7bbea625..85ee7bdc 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 servers: - url: "https://anke-to.trap.jp/api" description: production - - url: "http://localhost:8080/api" + - url: "http://localhost:1323" description: local info: title: anke-to API diff --git a/handler/handler.go b/handler/handler.go index aa6ddd82..d8fa23dc 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -5,13 +5,16 @@ import "github.com/traPtitech/anke-to/controller" type Handler struct { Questionnaire *controller.Questionnaire Response *controller.Response + Middleware *controller.Middleware } func NewHandler(questionnaire *controller.Questionnaire, response *controller.Response, + middleware *controller.Middleware, ) *Handler { return &Handler{ Questionnaire: questionnaire, Response: response, + Middleware: middleware, } } diff --git a/handler/questionnaire.go b/handler/questionnaire.go index 1719d207..c1fcf241 100644 --- a/handler/questionnaire.go +++ b/handler/questionnaire.go @@ -13,7 +13,7 @@ import ( // (GET /questionnaires) func (h Handler) GetQuestionnaires(ctx echo.Context, params openapi.GetQuestionnairesParams) error { res := openapi.QuestionnaireList{} - userID, err := getUserID(ctx) + userID, err := h.Middleware.GetUserID(ctx) if err != nil { ctx.Logger().Errorf("failed to get userID: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get userID: %w", err)) @@ -35,7 +35,7 @@ func (h Handler) PostQuestionnaire(ctx echo.Context) error { ctx.Logger().Errorf("failed to bind request body: %+v", err) return echo.NewHTTPError(http.StatusBadRequest, fmt.Errorf("failed to bind request body: %w", err)) } - validate, err := getValidator(ctx) + validate, err := h.Middleware.GetValidator(ctx) if err != nil { ctx.Logger().Errorf("failed to get validator: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get validator: %w", err)) @@ -48,7 +48,7 @@ func (h Handler) PostQuestionnaire(ctx echo.Context) error { } res := openapi.QuestionnaireDetail{} - userID, err := getUserID(ctx) + userID, err := h.Middleware.GetUserID(ctx) if err != nil { ctx.Logger().Errorf("failed to get userID: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get userID: %w", err)) @@ -136,7 +136,7 @@ func (h Handler) EditQuestionnaireMyRemindStatus(ctx echo.Context, questionnaire // (GET /questionnaires/{questionnaireID}/responses) func (h Handler) GetQuestionnaireResponses(ctx echo.Context, questionnaireID openapi.QuestionnaireIDInPath, params openapi.GetQuestionnaireResponsesParams) error { - userID, err := getUserID(ctx) + userID, err := h.Middleware.GetUserID(ctx) if err != nil { ctx.Logger().Errorf("failed to get userID: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get userID: %w", err)) @@ -153,7 +153,7 @@ func (h Handler) GetQuestionnaireResponses(ctx echo.Context, questionnaireID ope // (POST /questionnaires/{questionnaireID}/responses) func (h Handler) PostQuestionnaireResponse(ctx echo.Context, questionnaireID openapi.QuestionnaireIDInPath) error { res := openapi.Response{} - userID, err := getUserID(ctx) + userID, err := h.Middleware.GetUserID(ctx) if err != nil { ctx.Logger().Errorf("failed to get userID: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get userID: %w", err)) @@ -164,7 +164,7 @@ func (h Handler) PostQuestionnaireResponse(ctx echo.Context, questionnaireID ope ctx.Logger().Errorf("failed to bind request body: %+v", err) return echo.NewHTTPError(http.StatusBadRequest, fmt.Errorf("failed to bind request body: %w", err)) } - validate, err := getValidator(ctx) + validate, err := h.Middleware.GetValidator(ctx) if err != nil { ctx.Logger().Errorf("failed to get validator: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get validator: %w", err)) diff --git a/handler/response.go b/handler/response.go index 5bf97c57..46862837 100644 --- a/handler/response.go +++ b/handler/response.go @@ -11,7 +11,7 @@ import ( // (GET /responses/myResponses) func (h Handler) GetMyResponses(ctx echo.Context, params openapi.GetMyResponsesParams) error { res := openapi.ResponsesWithQuestionnaireInfo{} - userID, err := getUserID(ctx) + userID, err := h.Middleware.GetUserID(ctx) if err != nil { ctx.Logger().Errorf("failed to get userID: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get userID: %w", err)) @@ -27,7 +27,7 @@ func (h Handler) GetMyResponses(ctx echo.Context, params openapi.GetMyResponsesP // (DELETE /responses/{responseID}) func (h Handler) DeleteResponse(ctx echo.Context, responseID openapi.ResponseIDInPath) error { - userID, err := getUserID(ctx) + userID, err := h.Middleware.GetUserID(ctx) if err != nil { ctx.Logger().Errorf("failed to get userID: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get userID: %w", err)) @@ -62,7 +62,7 @@ func (h Handler) EditResponse(ctx echo.Context, responseID openapi.ResponseIDInP return echo.NewHTTPError(http.StatusBadRequest, fmt.Errorf("failed to bind Responses: %w", err)) } - validate, err := getValidator(ctx) + validate, err := h.Middleware.GetValidator(ctx) if err != nil { ctx.Logger().Errorf("failed to get validator: %+v", err) return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to get validator: %w", err)) diff --git a/main.go b/main.go index 2aad8ef1..a039a181 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,6 @@ import ( "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" - oapiMiddleware "github.com/oapi-codegen/echo-middleware" "github.com/traPtitech/anke-to/controller" "github.com/traPtitech/anke-to/model" "github.com/traPtitech/anke-to/openapi" @@ -60,30 +59,24 @@ func main() { controller.Wg.Add(1) go func() { e := echo.New() - swagger, err := openapi.GetSwagger() - if err != nil { - panic(err) - } api := InjectAPIServer() - e.Use(oapiMiddleware.OapiRequestValidator(swagger)) - e.Use(api.SetUserIDMiddleware) + e.Use(api.Middleware.SetUserIDMiddleware) e.Use(middleware.Logger()) e.Use(middleware.Recover()) mws := NewMiddlewareSwitcher() - mws.AddGroupConfig("", api.TraPMemberAuthenticate) + mws.AddGroupConfig("", api.Middleware.TraPMemberAuthenticate) - mws.AddRouteConfig("/questionnaires", http.MethodGet, api.TrapRateLimitMiddlewareFunc()) - mws.AddRouteConfig("/questionnaires/:questionnaireID", http.MethodGet, api.QuestionnaireReadAuthenticate) - mws.AddRouteConfig("/questionnaires/:questionnaireID", http.MethodPatch, api.QuestionnaireAdministratorAuthenticate) - mws.AddRouteConfig("/questionnaires/:questionnaireID", http.MethodDelete, api.QuestionnaireAdministratorAuthenticate) + mws.AddRouteConfig("/questionnaires", http.MethodGet, api.Middleware.TrapRateLimitMiddlewareFunc()) + mws.AddRouteConfig("/questionnaires/:questionnaireID", http.MethodGet, api.Middleware.QuestionnaireReadAuthenticate) + mws.AddRouteConfig("/questionnaires/:questionnaireID", http.MethodPatch, api.Middleware.QuestionnaireAdministratorAuthenticate) + mws.AddRouteConfig("/questionnaires/:questionnaireID", http.MethodDelete, api.Middleware.QuestionnaireAdministratorAuthenticate) - mws.AddRouteConfig("/responses/:responseID", http.MethodGet, api.ResponseReadAuthenticate) - mws.AddRouteConfig("/responses/:responseID", http.MethodPatch, api.RespondentAuthenticate) - mws.AddRouteConfig("/responses/:responseID", http.MethodDelete, api.RespondentAuthenticate) + mws.AddRouteConfig("/responses/:responseID", http.MethodGet, api.Middleware.ResponseReadAuthenticate) + mws.AddRouteConfig("/responses/:responseID", http.MethodPatch, api.Middleware.RespondentAuthenticate) + mws.AddRouteConfig("/responses/:responseID", http.MethodDelete, api.Middleware.RespondentAuthenticate) - handlerApi := InjectHandler() - openapi.RegisterHandlers(e, handlerApi) + openapi.RegisterHandlers(e, api) e.Use(mws.ApplyMiddlewares) e.Logger.Fatal(e.Start(port)) diff --git a/openapi/spec.go b/openapi/spec.go index 88e3e723..134c584f 100644 --- a/openapi/spec.go +++ b/openapi/spec.go @@ -17,74 +17,76 @@ import ( // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+xc628TyZb/V6ze/QDaDjaBK931t0BGV5GGu0Bg9wOJrI5dSXqu3W2624AXRUq1eQRi", - "SMQjTAhDCJOBAEPCDCyb4fm/bKUd+9P+C6uqflV3V78cG2ZGKyEUd9epOnXOr845depUX+SKcqUqS0DS", - "VC5/kasKilABGlDIL1kq14dKFVESVU0RNFA6Uj8GRqQTNaDU8fsSUIuKWNVEWeLyXPvqc2PuCoLN3c21", - "3cUr7dnLCL5A8DmCPyL4BMFL5O9LSNcR3CT/PhsLS8ane5l9mlID+/lMKKE+b1HpurH4AumQPF9G8DcE", - "n9idTAplFexHszpqXEWNu0h/hhovUGMOwS3yCs3qYxLHcyJm9iyZA89JQgVwefZMOZ5Ti9OgIuC5avUq", - "bjghy2UgSNzMDE+IjtVPArUqS2q8XDaNlYe7L+8wZ+5rs/P+J2N9qa+zdRlPMs1TgjIFNFGaSqJ/pH9G", - "jQ9I/xU1GoSjEGWyBJGUtp+ioSYbJ5uqMBUukJ2Pd1HjPpnO9u7KJoLzmX2tB8+Nzfu7n55hXT96Yyxi", - "rg7SzfaHcIaHYrEjShqYAgph52wNqHhwSRAVMDI8Ih0XtOkgY0h/jBqvkf4LHrQxNzLsiqOKCZwxff1x", - "PKeAszVRASUujxUWw45iL41QTky4hzPg9tDt2KOyooVraPsJgq87j65k9u18fNCaW2zd+6m1rCPYbC29", - "QvAegpcyY5xam6iImgZKBUEb4/iMr6mxsG62G/A3xGDW1zHyGi8Q3Gx9fxUPNcZpolYGjAad5RtmgwGn", - "RWvlTWvpFZOtilwSJ0VnMF9LlytPu0wYvFRZ0Tzw+mcFTHJ57p+yrofImm/V7ElKuKew7LHEVSAoxelQ", - "WfuFsf5g983jMGZIVyy0q5oiSlPmeHvXbFEBQgK9epv9abVKaXPGpiFxwN8UuVYlf4kaqKhBaZMG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26DZnWOMKkQTOCVyf0NaCe8", - "nPGey9IhzsRtkqWvq4U5frq55zZdAgL6KmqC5iG3ehNSht4Kx07MU2cwmMvZILSyD9TqzH6nmks02QW1", - "4OEiAboXGa2XPxrb2wi+sLVqHiN9smqlZvUgFsydi53KpVAww3OHTf6j0de4bDz6BcFN4+Nj48MCgs3d", - "u6/ImdV1sy/c0V9YHfl50W+Fs7+C9NvkJ56H2eOhYI+jJ77FjGyuttearWW9s3QbweYhFU/u7WXMNFy1", - "D8T1ne33CL5ovfyx/WShvbaxu/AJwaZxc9VYeURmT7KlU2qg+oc4raqsMtalc5UxODPzemXkKjsuq95l", - "Zt36BapmJ2F6AqTArb8Zr+fRlBqYCQD5YH+AbBXWRUE5XJh+cNvPzTqR1SDh7wnigUn4IB6Bvxne7yqy", - "F3231WdMXspAA0m4Mq5d7yyvR8JzmHTmB2g6N8C+oh9mNhPjwebej4dQ/Qat4Mgw1uqlNVJ98zSNSuGm", - "PXyzK2XybB8fHMZCYVceu8+a+ip2IczF7VXrh3OHExWluUejlr774eiivZCgFafTQWf9WmvlTSR0vimJ", - "fcRO791ZKGziPFpKG2NJ7ovYmDR89NZtZCt1s9JxVBO0WvgWpMtixq6M1zEvS380U+avHf2T2DSvutsb", - "L43N+/22bN2jrgu710fY9dkKMhG3F3PYL+P3NWDZZ/vpkWrCyM64vGFVdJlFSywr6a3kd4tATzrFDVi+", - "z961lq4aL+/hHb1ZAW1vUZIYWjff3iOwx+dTWF+qSpiGCX59rq82napL/FMYcAdrPbLY0RkRZ7RgIiQ4", - "C+cezu7LO8bCVrvxkXDhuc/QgTeNm++pDws27W2YuftPnGWhvgT4ezbwngKdL5uw8Y4bBny/gmOSM077", - "fuZk9rRqDg8OxhTyw6ZbuQ9XkQ69xftxK9AvO9jcY07IQQCJ4uP8kPPZTU9NsfOZztRHBMfq3fsPphvY", - "qzVPdZwbciocLM5Jb/sdmUal2pkIYXw9laGWBGhxqo/9QLnofmQyMmXoRibeTGFImrBroxr4amb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309H43jUHluSlBzpap7eu4Pw+caq3vE", + "7Dnj4iiJa9OVQh35syxunK4cabsGPDdetaKNDryMZ5ZBTnmfihkb2EA6KWBRBed55E56SCpYJSzYlps9", + "JyX0zdDuhbf5iDS9pjEMTEOzHwdySFbeyJv6sTJD3v1BpD7MQVgsenxM9D5k5+C/Fhprj5C+yKdacM5Y", + "eovgbvPpHOESh8mpI2OWRMa4o3zKtybJHjPQnspljHFHU80Xr7Dv1/VAv1JVlsAYZy01K2ltyd+bEuGt", + "xnjOrmCtZ4yCDLpupnPH2H5bGmkbehYD0rKJwv1ZRbg4UuCoCsoYqSLeUyPZ0wCW5so3LB8V3UaWXjkw", + "IAbJUwUVuziEpopVGOIniFUUQhPFLAihSRIVg9CECQtBPGO6RSD04+OCCkYsIAWNvKReNp9HZCethiEm", + "zjNY2NFpYCzqkLjDoUZNDEcPFQL2mEP1qIbG6wtacK9xe62pPyHHGGae5Caq1ZC+i/TfENxpXb9jzC4T", + "2xw2W395A2VA2m66Q+XgB1OXCm/iQpqCU4CVrhTTJGHEXkRBTrpfwNIRXwkhNSYFp9KF0pUkrFvrl8lG", + "l4pVDsuOU7QdCN5sT3lwfwvBHVVWNBy/be20Ntao8MnnQft8v83Ikbdq130ulveUoQerBnjuSh8ep++S", + "oEhCCVuD89yoPcCQNjR6guPpB8PfkickVB5y/7Qeu5vGId9v0oCWyn+I2lTgLGpEA6X4GnNjAT7iJM06", + "5oofLWICVulRGzOvJq7dZh1BOr0x5ZN4iHApM8YOB6otTjQDPZI1gYv0j+7uw49e6kCfp+9p9AS5Tq7D", + "hJ/z89CotWLugGA0RTid8t+p4PLlgQwrxjcPjePq0I3z/Yry7XwDwcuk87xd/+6Gu2LzlfzE2yTl7SGD", + "C4RcO8pXFFGrjuKerICjXC6KecGuzpgoypfN5xVtSlbE/yRvTsgFEHh4TilyWW5K08pqNp2+eExThPKx", + "78tpoSymLw2mZdx4IG2TmPfx5LKd4hUKWI5FPFwK/xKlyZQCVLmi5AGexmVF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yyVdFtb7niGFr3", + "/KBLYI/OD7G+vBUzrRT8ml5PbTpVZ/mnMOAO1rpksdtneJzRgomd4Cyce0UHL+8b87vN2kfChed+Rgve", + "Ne6+pz6UWLe3lWY2I3bWiPqy4e/ZwHsKjr5sAso7bhjw/QqOSDY57XuZYzrUqvlmYCDiYgKsuzcR4DrS", + "ofcyQuwo34HwIXNcDgJIFB/lh5zPiHpqpJ3PjiY+8jhZ7dx/MN3AYa15ouPpkFPuYLFRctvvyLTd0QET", + "IYyvwTLUEgMtTjW1HyhX3Y9mtk2BupGJN/MZkvbs2KgGvgKaMNkZ4NOjjLjGxRG3bWXYxmUwhpzwJqWx", + "9dw0F/b1QyrjE9tKuRhwrA+5bVsPWJ8we8ZMbsSxZwxptjVsrhI7RmlIlrdNgMwySb2H4Rd0sEkjS0oL", + "rHiyHXhbS/9oPn3WOXgjkNj9eNSDnJDkgYudeMmAboOn+zFhsoAwntlk7fS/pNmk0qZhyPtD2MwvZyrp", + "uiYCT09F03mz1MiuJ7qAsagC5ZKNZS87ZUUuVPLkh7/kx6rWoYuLGFW6RTkvFD202XSaPJySVS3bPzgw", + "aNYumvO4yvx4OOnX91FvbvrC9P8FAAD//3cDWF2BYAAA", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/wire.go b/wire.go index c3e060c6..6ffd397b 100644 --- a/wire.go +++ b/wire.go @@ -26,11 +26,12 @@ var ( webhookBind = wire.Bind(new(traq.IWebhook), new(*traq.Webhook)) ) -func InjectHandler() *handler.Handler { +func InjectAPIServer() *handler.Handler { wire.Build( handler.NewHandler, controller.NewResponse, controller.NewQuestionnaire, + controller.NewMiddleware, model.NewAdministrator, model.NewOption, model.NewQuestionnaire, @@ -54,39 +55,5 @@ func InjectHandler() *handler.Handler { transactionBind, webhookBind, ) - - return nil -} - -func InjectAPIServer() *handler.Middleware { - wire.Build( - // handler.NewHandler, - handler.NewMiddleware, - // controller.NewResponse, - // controller.NewQuestionnaire, - // model.NewAdministrator, - // model.NewOption, - // model.NewQuestionnaire, - // model.NewQuestion, - // model.NewRespondent, - // model.NewResponse, - // model.NewScaleLabel, - // model.NewTarget, - // model.NewValidation, - // model.NewTransaction, - // traq.NewWebhook, - // administratorBind, - // optionBind, - // questionnaireBind, - // questionBind, - // respondentBind, - // responseBind, - // scaleLabelBind, - // targetBind, - // validationBind, - // transactionBind, - // webhookBind, - ) - - return nil + return &handler.Handler{} } diff --git a/wire_gen.go b/wire_gen.go index b25ae41a..7a311489 100644 --- a/wire_gen.go +++ b/wire_gen.go @@ -20,7 +20,7 @@ import ( // Injectors from wire.go: -func InjectHandler() *handler.Handler { +func InjectAPIServer() *handler.Handler { questionnaire := model.NewQuestionnaire() target := model.NewTarget() administrator := model.NewAdministrator() @@ -34,15 +34,11 @@ func InjectHandler() *handler.Handler { respondent := model.NewRespondent() response := model.NewResponse() controllerResponse := controller.NewResponse(questionnaire, respondent, response, target, question, validation, scaleLabel) - handlerHandler := handler.NewHandler(controllerQuestionnaire, controllerResponse) + middleware := controller.NewMiddleware(administrator, respondent, question, questionnaire) + handlerHandler := handler.NewHandler(controllerQuestionnaire, controllerResponse, middleware) return handlerHandler } -func InjectAPIServer() *handler.Middleware { - middleware := handler.NewMiddleware() - return middleware -} - // wire.go: var (