aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/api/handler_wrapper.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-04 20:48:50 +0900
committernsfisis <nsfisis@gmail.com>2024-08-04 20:48:50 +0900
commitf4bae7f755ca25b2547dc98b2db2fdb255948bc5 (patch)
tree4690c2aabafaedb50f86ece4900c9616d9518947 /backend/api/handler_wrapper.go
parent3963dedada8fdc43b18dfec1313c184d2f4fdc47 (diff)
downloadiosdc-japan-2024-albatross-f4bae7f755ca25b2547dc98b2db2fdb255948bc5.tar.gz
iosdc-japan-2024-albatross-f4bae7f755ca25b2547dc98b2db2fdb255948bc5.tar.zst
iosdc-japan-2024-albatross-f4bae7f755ca25b2547dc98b2db2fdb255948bc5.zip
chore: remove admin APIs to communicate between app-server and api-server
Diffstat (limited to 'backend/api/handler_wrapper.go')
-rw-r--r--backend/api/handler_wrapper.go76
1 files changed, 0 insertions, 76 deletions
diff --git a/backend/api/handler_wrapper.go b/backend/api/handler_wrapper.go
index 939e37a..fdee581 100644
--- a/backend/api/handler_wrapper.go
+++ b/backend/api/handler_wrapper.go
@@ -39,82 +39,6 @@ func parseJWTClaimsFromAuthorizationHeader(authorization string) (*auth.JWTClaim
return claims, nil
}
-func (h *ApiHandlerWrapper) AdminGetGame(ctx context.Context, request AdminGetGameRequestObject) (AdminGetGameResponseObject, error) {
- user, err := parseJWTClaimsFromAuthorizationHeader(request.Params.Authorization)
- if err != nil {
- return AdminGetGame401JSONResponse{
- UnauthorizedJSONResponse: UnauthorizedJSONResponse{
- Message: "Unauthorized",
- },
- }, nil
- }
- if !user.IsAdmin {
- return AdminGetGame403JSONResponse{
- ForbiddenJSONResponse: ForbiddenJSONResponse{
- Message: "Forbidden",
- },
- }, nil
- }
- return h.innerHandler.AdminGetGame(ctx, request, user)
-}
-
-func (h *ApiHandlerWrapper) AdminGetGames(ctx context.Context, request AdminGetGamesRequestObject) (AdminGetGamesResponseObject, error) {
- user, err := parseJWTClaimsFromAuthorizationHeader(request.Params.Authorization)
- if err != nil {
- return AdminGetGames401JSONResponse{
- UnauthorizedJSONResponse: UnauthorizedJSONResponse{
- Message: "Unauthorized",
- },
- }, nil
- }
- if !user.IsAdmin {
- return AdminGetGames403JSONResponse{
- ForbiddenJSONResponse: ForbiddenJSONResponse{
- Message: "Forbidden",
- },
- }, nil
- }
- return h.innerHandler.AdminGetGames(ctx, request, user)
-}
-
-func (h *ApiHandlerWrapper) AdminGetUsers(ctx context.Context, request AdminGetUsersRequestObject) (AdminGetUsersResponseObject, error) {
- user, err := parseJWTClaimsFromAuthorizationHeader(request.Params.Authorization)
- if err != nil {
- return AdminGetUsers401JSONResponse{
- UnauthorizedJSONResponse: UnauthorizedJSONResponse{
- Message: "Unauthorized",
- },
- }, nil
- }
- if !user.IsAdmin {
- return AdminGetUsers403JSONResponse{
- ForbiddenJSONResponse: ForbiddenJSONResponse{
- Message: "Forbidden",
- },
- }, nil
- }
- return h.innerHandler.AdminGetUsers(ctx, request, user)
-}
-
-func (h *ApiHandlerWrapper) AdminPutGame(ctx context.Context, request AdminPutGameRequestObject) (AdminPutGameResponseObject, error) {
- user, err := parseJWTClaimsFromAuthorizationHeader(request.Params.Authorization)
- if err != nil {
- return AdminPutGame401JSONResponse{
- UnauthorizedJSONResponse: UnauthorizedJSONResponse{
- Message: "Unauthorized",
- },
- }, nil
- }
- if !user.IsAdmin {
- return AdminPutGame403JSONResponse{
- ForbiddenJSONResponse: ForbiddenJSONResponse{
- Message: "Forbidden",
- },
- }, nil
- }
- return h.innerHandler.AdminPutGame(ctx, request, user)
-}
-
func (h *ApiHandlerWrapper) GetGame(ctx context.Context, request GetGameRequestObject) (GetGameResponseObject, error) {
user, err := parseJWTClaimsFromAuthorizationHeader(request.Params.Authorization)
if err != nil {