aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/api
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-08 19:59:40 +0900
committernsfisis <nsfisis@gmail.com>2024-08-08 19:59:40 +0900
commit205cb5e21b960852a06fa28baaa03dbbd6aa835f (patch)
tree24275a385bbd2f670a33ea234381146c7fc46130 /backend/api
parent59d423234056dabd51ca02f663243fe6b2128837 (diff)
downloadphperkaigi-2025-albatross-205cb5e21b960852a06fa28baaa03dbbd6aa835f.tar.gz
phperkaigi-2025-albatross-205cb5e21b960852a06fa28baaa03dbbd6aa835f.tar.zst
phperkaigi-2025-albatross-205cb5e21b960852a06fa28baaa03dbbd6aa835f.zip
feat(backend/worker): enable `stylecheck` in `golangci-lint`
Diffstat (limited to 'backend/api')
-rw-r--r--backend/api/handler_wrapper.go4
-rw-r--r--backend/api/handlers.go10
-rw-r--r--backend/api/workaround.go2
3 files changed, 8 insertions, 8 deletions
diff --git a/backend/api/handler_wrapper.go b/backend/api/handler_wrapper.go
index fdee581..748af66 100644
--- a/backend/api/handler_wrapper.go
+++ b/backend/api/handler_wrapper.go
@@ -14,12 +14,12 @@ import (
var _ StrictServerInterface = (*ApiHandlerWrapper)(nil)
type ApiHandlerWrapper struct {
- innerHandler ApiHandler
+ innerHandler APIHandler
}
func NewHandler(queries *db.Queries, hubs GameHubsInterface) *ApiHandlerWrapper {
return &ApiHandlerWrapper{
- innerHandler: ApiHandler{
+ innerHandler: APIHandler{
q: queries,
hubs: hubs,
},
diff --git a/backend/api/handlers.go b/backend/api/handlers.go
index 659e5c1..229246f 100644
--- a/backend/api/handlers.go
+++ b/backend/api/handlers.go
@@ -12,7 +12,7 @@ import (
"github.com/nsfisis/iosdc-japan-2024-albatross/backend/db"
)
-type ApiHandler struct {
+type APIHandler struct {
q *db.Queries
hubs GameHubsInterface
}
@@ -21,7 +21,7 @@ type GameHubsInterface interface {
StartGame(gameID int) error
}
-func (h *ApiHandler) PostLogin(ctx context.Context, request PostLoginRequestObject) (PostLoginResponseObject, error) {
+func (h *APIHandler) PostLogin(ctx context.Context, request PostLoginRequestObject) (PostLoginResponseObject, error) {
username := request.Body.Username
password := request.Body.Password
userID, err := auth.Login(ctx, h.q, username, password)
@@ -52,7 +52,7 @@ func (h *ApiHandler) PostLogin(ctx context.Context, request PostLoginRequestObje
}, nil
}
-func (h *ApiHandler) GetToken(ctx context.Context, request GetTokenRequestObject, user *auth.JWTClaims) (GetTokenResponseObject, error) {
+func (h *APIHandler) GetToken(ctx context.Context, request GetTokenRequestObject, user *auth.JWTClaims) (GetTokenResponseObject, error) {
newToken, err := auth.NewShortLivedJWT(user)
if err != nil {
return nil, echo.NewHTTPError(http.StatusInternalServerError, err.Error())
@@ -62,7 +62,7 @@ func (h *ApiHandler) GetToken(ctx context.Context, request GetTokenRequestObject
}, nil
}
-func (h *ApiHandler) GetGames(ctx context.Context, request GetGamesRequestObject, user *auth.JWTClaims) (GetGamesResponseObject, error) {
+func (h *APIHandler) GetGames(ctx context.Context, request GetGamesRequestObject, user *auth.JWTClaims) (GetGamesResponseObject, error) {
gameRows, err := h.q.ListGamesForPlayer(ctx, int32(user.UserID))
if err != nil {
return nil, echo.NewHTTPError(http.StatusInternalServerError, err.Error())
@@ -100,7 +100,7 @@ func (h *ApiHandler) GetGames(ctx context.Context, request GetGamesRequestObject
}, nil
}
-func (h *ApiHandler) GetGame(ctx context.Context, request GetGameRequestObject, user *auth.JWTClaims) (GetGameResponseObject, error) {
+func (h *APIHandler) GetGame(ctx context.Context, request GetGameRequestObject, user *auth.JWTClaims) (GetGameResponseObject, error) {
// TODO: check user permission
gameID := request.GameID
row, err := h.q.GetGameByID(ctx, int32(gameID))
diff --git a/backend/api/workaround.go b/backend/api/workaround.go
index a3c47d7..5b5fe59 100644
--- a/backend/api/workaround.go
+++ b/backend/api/workaround.go
@@ -12,7 +12,7 @@ func GetSwaggerWithPrefix(prefix string) (*openapi3.T, error) {
return nil, err
}
- var prefixedPaths openapi3.Paths = openapi3.Paths{}
+ prefixedPaths := openapi3.Paths{}
for key, value := range spec.Paths.Map() {
prefixedPaths.Set(prefix+key, value)
}