You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/10/20 06:51:34 UTC

[GitHub] [apisix-dashboard] nic-chen opened a new pull request #564: feat: refactor `manager api`

nic-chen opened a new pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [ ] Bug fix
   - [x] New feature provided
   - [x] Improve performance
   
   ___
   ### New feature or improvement
    refactor `manager api` to remove the dependency on MySQL
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] moonming commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508319160



##########
File path: api/build-tools/json.lua
##########
@@ -0,0 +1,400 @@
+--
+-- json.lua
+--
+-- Copyright (c) 2020 rxi

Review comment:
       fixed, I add this to LICENSE file




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] moonming commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508346174



##########
File path: api/internal/core/storage/storage_mock.go
##########
@@ -0,0 +1,116 @@
+// Code generated by mockery v1.0.0. DO NOT EDIT.

Review comment:
       There should not be any automatically generated code in the code base




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] moonming commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508346498



##########
File path: api/internal/core/store/validate_mock.go
##########
@@ -0,0 +1,24 @@
+// Code generated by mockery v1.0.0. DO NOT EDIT.

Review comment:
       ditto




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] moonming commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508350981



##########
File path: api/internal/core/store/selector_test.go
##########
@@ -0,0 +1,285 @@
+/*

Review comment:
       Is this test case file copy from other repo?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] moonming commented on pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
moonming commented on pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#issuecomment-712651441


   ```
   ?   	github.com/apisix/manager-api	[no test files]
   ?   	github.com/apisix/manager-api/conf	[no test files]
   ?   	github.com/apisix/manager-api/filter	[no test files]
   ?   	github.com/apisix/manager-api/internal	[no test files]
   ok  	github.com/apisix/manager-api/internal/core/entity	0.004s
   ?   	github.com/apisix/manager-api/internal/core/storage	[no test files]
   ok  	github.com/apisix/manager-api/internal/core/store	1.015s
   ?   	github.com/apisix/manager-api/internal/handler	[no test files]
   ok  	github.com/apisix/manager-api/internal/handler/authentication	0.013s
   ok  	github.com/apisix/manager-api/internal/handler/consumer	0.334s
   ?   	github.com/apisix/manager-api/internal/handler/healthz	[no test files]
   ok  	github.com/apisix/manager-api/internal/handler/plugin	0.010s
   ok  	github.com/apisix/manager-api/internal/handler/route	0.724s
   ok  	github.com/apisix/manager-api/internal/handler/service	0.227s
   ok  	github.com/apisix/manager-api/internal/handler/ssl	0.160s
   ok  	github.com/apisix/manager-api/internal/handler/upstream	0.223s
   ok  	github.com/apisix/manager-api/internal/utils	0.005s
   ?   	github.com/apisix/manager-api/internal/utils/consts	[no test files]
   ?   	github.com/apisix/manager-api/log	[no test files]
   ```
   why so many files no test cases cover?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
nic-chen commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508358111



##########
File path: api/internal/core/store/selector.go
##########
@@ -0,0 +1,144 @@
+/*

Review comment:
       some code from:
   https://github.com/kubernetes/dashboard/tree/master/src/app/backend/resource/dataselect
   not whole file.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] moonming commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508346174



##########
File path: api/internal/core/storage/storage_mock.go
##########
@@ -0,0 +1,116 @@
+// Code generated by mockery v1.0.0. DO NOT EDIT.

Review comment:
       There should not be any automatically generated code in the code repository




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] moonming commented on pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
moonming commented on pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#issuecomment-712703880


   > github.com/davecgh/go-spew/spew,https://github.com/davecgh/go-spew/blob/master/spew/LICENSE,ISC
   > github.com/hashicorp/hcl,https://github.com/hashicorp/hcl/blob/master/LICENSE,MPL-2.0
   
   ISC is ok.  MPL-2.0 maybe is a issue. Can we remove this dependent?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
nic-chen commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508290471



##########
File path: api/filter/authentication.go
##########
@@ -17,49 +17,55 @@
 package filter
 
 import (
-	"github.com/apisix/manager-api/conf"
-	"github.com/apisix/manager-api/errno"
-	"github.com/dgrijalva/jwt-go"
-	"github.com/gin-gonic/gin"
 	"net/http"
 	"strings"
+
+	"github.com/dgrijalva/jwt-go"
+	"github.com/gin-gonic/gin"
+
+	"github.com/apisix/manager-api/conf"
 )
 
 func Authentication() gin.HandlerFunc {
 	return func(c *gin.Context) {
-		if c.Request.URL.Path != "/apisix/admin/user/login" && strings.HasPrefix(c.Request.URL.Path,"/apisix") {
+		if c.Request.URL.Path != "/apisix/admin/user/login" && strings.HasPrefix(c.Request.URL.Path, "/apisix") {
 			tokenStr := c.GetHeader("Authorization")
 
 			// verify token
 			token, err := jwt.ParseWithClaims(tokenStr, &jwt.StandardClaims{}, func(token *jwt.Token) (interface{}, error) {
 				return []byte(conf.AuthenticationConfig.Session.Secret), nil
 			})
 
-			if err != nil {
-				c.AbortWithStatusJSON(http.StatusUnauthorized, errno.FromMessage(errno.ForbiddenError).Response())
+			errResp := gin.H{
+				"code":    010013,

Review comment:
       will do this next version




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] moonming commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508349535



##########
File path: api/internal/core/store/query.go
##########
@@ -0,0 +1,151 @@
+/*

Review comment:
       where is this file come from? please giave the github repo




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] moonming commented on pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
moonming commented on pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#issuecomment-712654912


   @nic-chen do you check licenses for all go dependencies?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
nic-chen commented on pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#issuecomment-712728600


   > > github.com/davecgh/go-spew/spew,https://github.com/davecgh/go-spew/blob/master/spew/LICENSE,ISC
   > > github.com/hashicorp/hcl,https://github.com/hashicorp/hcl/blob/master/LICENSE,MPL-2.0
   > 
   > ISC is ok. MPL-2.0 maybe is a issue. Can we remove this dependent?
   
   removed.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
nic-chen commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508357948



##########
File path: api/internal/core/store/query.go
##########
@@ -0,0 +1,151 @@
+/*

Review comment:
       some code from:
   https://github.com/kubernetes/dashboard/tree/master/src/app/backend/resource/dataselect
   not whole file.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] moonming commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508350413



##########
File path: api/internal/core/store/selector.go
##########
@@ -0,0 +1,144 @@
+/*

Review comment:
       where is this file come from? please give the github repo
   

##########
File path: api/internal/core/store/query.go
##########
@@ -0,0 +1,151 @@
+/*

Review comment:
       where is this file come from? please give the github repo




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan merged pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
juzhiyuan merged pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
nic-chen commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508358358



##########
File path: api/internal/core/store/selector_test.go
##########
@@ -0,0 +1,285 @@
+/*

Review comment:
       some code from:
   https://github.com/kubernetes/dashboard/tree/master/src/app/backend/resource/dataselect
   not whole file.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
nic-chen commented on pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#issuecomment-712681096


   > ```
   > ?   	github.com/apisix/manager-api	[no test files]
   > ?   	github.com/apisix/manager-api/conf	[no test files]
   > ?   	github.com/apisix/manager-api/filter	[no test files]
   > ?   	github.com/apisix/manager-api/internal	[no test files]
   > ok  	github.com/apisix/manager-api/internal/core/entity	0.004s
   > ?   	github.com/apisix/manager-api/internal/core/storage	[no test files]
   > ok  	github.com/apisix/manager-api/internal/core/store	1.015s
   > ?   	github.com/apisix/manager-api/internal/handler	[no test files]
   > ok  	github.com/apisix/manager-api/internal/handler/authentication	0.013s
   > ok  	github.com/apisix/manager-api/internal/handler/consumer	0.334s
   > ?   	github.com/apisix/manager-api/internal/handler/healthz	[no test files]
   > ok  	github.com/apisix/manager-api/internal/handler/plugin	0.010s
   > ok  	github.com/apisix/manager-api/internal/handler/route	0.724s
   > ok  	github.com/apisix/manager-api/internal/handler/service	0.227s
   > ok  	github.com/apisix/manager-api/internal/handler/ssl	0.160s
   > ok  	github.com/apisix/manager-api/internal/handler/upstream	0.223s
   > ok  	github.com/apisix/manager-api/internal/utils	0.005s
   > ?   	github.com/apisix/manager-api/internal/utils/consts	[no test files]
   > ?   	github.com/apisix/manager-api/log	[no test files]
   > ```
   > 
   > why so many files no test cases cover?
   
   
   
   
   
   ```
   github.com/apisix/manager-api	                         --> just a main.go
   github.com/apisix/manager-api/conf	                     --> config
   github.com/apisix/manager-api/filter	                 --> 
   github.com/apisix/manager-api/internal	                 --> no files
   github.com/apisix/manager-api/internal/core/storage	     -->  
   github.com/apisix/manager-api/internal/handler	         --> no files
   github.com/apisix/manager-api/internal/handler/healthz	 -->
   github.com/apisix/manager-api/internal/utils/consts	     --> const defined
   github.com/apisix/manager-api/log	                     --> 
   ```
   @moonming 
   The main code is in the subdirectory of `handler` and the `store` directory. I think the missing part could be added later.
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
nic-chen commented on pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#issuecomment-712673411


   > @nic-chen do you check licenses for all go dependencies?
   
   here is the result:
   
   ```
   gopkg.in/yaml.v2,Unknown,Apache-2.0
   github.com/coreos/go-systemd/journal,https://github.com/coreos/go-systemd/blob/master/journal/LICENSE,Apache-2.0
   github.com/gorilla/securecookie,https://github.com/gorilla/securecookie/blob/master/LICENSE,BSD-3-Clause
   github.com/go-playground/validator/v10,https://github.com/go-playground/validator/blob/master/v10/LICENSE,MIT
   github.com/leodido/go-urn,https://github.com/leodido/go-urn/blob/master/LICENSE,MIT
   github.com/sony/sonyflake,https://github.com/sony/sonyflake/blob/master/LICENSE,MIT
   go.uber.org/atomic,Unknown,MIT
   github.com/sirupsen/logrus,https://github.com/sirupsen/logrus/blob/master/LICENSE,MIT
   github.com/shiningrush/droplet,https://github.com/shiningrush/droplet/blob/master/LICENSE,MIT
   github.com/coreos/pkg/capnslog,https://github.com/coreos/pkg/blob/master/capnslog/LICENSE,Apache-2.0
   github.com/coreos/go-semver/semver,https://github.com/coreos/go-semver/blob/master/semver/LICENSE,Apache-2.0
   github.com/api7/go-jsonpatch,https://github.com/api7/go-jsonpatch/blob/master/LICENSE,MIT
   golang.org/x/sys,Unknown,BSD-3-Clause
   github.com/coreos/etcd,https://github.com/coreos/etcd/blob/master/LICENSE,Apache-2.0
   go.uber.org/zap,Unknown,MIT
   github.com/gin-contrib/pprof,https://github.com/gin-contrib/pprof/blob/master/LICENSE,MIT
   github.com/spf13/cast,https://github.com/spf13/cast/blob/master/LICENSE,MIT
   github.com/tidwall/match,https://github.com/tidwall/match/blob/master/LICENSE,MIT
   github.com/gin-gonic/gin,https://github.com/gin-gonic/gin/blob/master/LICENSE,MIT
   github.com/golang/protobuf,https://github.com/golang/protobuf/blob/master/LICENSE,BSD-3-Clause
   github.com/satori/go.uuid,https://github.com/satori/go.uuid/blob/master/LICENSE,MIT
   go.etcd.io/etcd/clientv3,Unknown,Apache-2.0
   google.golang.org/genproto/googleapis,Unknown,Apache-2.0
   github.com/spf13/jwalterweatherman,https://github.com/spf13/jwalterweatherman/blob/master/LICENSE,MIT
   gopkg.in/ini.v1,Unknown,Apache-2.0
   google.golang.org/grpc,Unknown,Apache-2.0
   github.com/tidwall/gjson,https://github.com/tidwall/gjson/blob/master/LICENSE,MIT
   github.com/dgrijalva/jwt-go,https://github.com/dgrijalva/jwt-go/blob/master/LICENSE,MIT
   github.com/gin-contrib/sse,https://github.com/gin-contrib/sse/blob/master/LICENSE,MIT
   google.golang.org/protobuf,Unknown,BSD-3-Clause
   github.com/mattn/go-isatty,https://github.com/mattn/go-isatty/blob/master/LICENSE,MIT
   github.com/mitchellh/mapstructure,https://github.com/mitchellh/mapstructure/blob/master/LICENSE,MIT
   github.com/pmezard/go-difflib/difflib,https://github.com/pmezard/go-difflib/blob/master/difflib/LICENSE,BSD-3-Clause
   github.com/stretchr/objx,https://github.com/stretchr/objx/blob/master/LICENSE,MIT
   github.com/subosito/gotenv,https://github.com/subosito/gotenv/blob/master/LICENSE,MIT
   github.com/apisix/manager-api,Unknown,Apache-2.0
   github.com/shiningrush/droplet/wrapper/gin,https://github.com/shiningrush/droplet/blob/master/wrapper/gin/LICENSE,MIT
   github.com/gogo/protobuf,https://github.com/gogo/protobuf/blob/master/LICENSE,BSD-3-Clause
   go.uber.org/multierr,Unknown,MIT
   github.com/fsnotify/fsnotify,https://github.com/fsnotify/fsnotify/blob/master/LICENSE,BSD-3-Clause
   github.com/magiconair/properties,https://github.com/magiconair/properties/blob/master/LICENSE,BSD-2-Clause
   github.com/google/uuid,https://github.com/google/uuid/blob/master/LICENSE,BSD-3-Clause
   github.com/spf13/pflag,https://github.com/spf13/pflag/blob/master/LICENSE,BSD-3-Clause
   github.com/tidwall/pretty,https://github.com/tidwall/pretty/blob/master/LICENSE,MIT
   github.com/go-playground/universal-translator,https://github.com/go-playground/universal-translator/blob/master/LICENSE,MIT
   golang.org/x/text,Unknown,BSD-3-Clause
   github.com/gin-contrib/sessions,https://github.com/gin-contrib/sessions/blob/master/LICENSE,MIT
   github.com/go-playground/locales,https://github.com/go-playground/locales/blob/master/LICENSE,MIT
   github.com/ugorji/go/codec,https://github.com/ugorji/go/blob/master/codec/LICENSE,MIT
   github.com/stretchr/testify,https://github.com/stretchr/testify/blob/master/LICENSE,MIT
   github.com/gorilla/sessions,https://github.com/gorilla/sessions/blob/master/LICENSE,BSD-3-Clause
   github.com/spf13/afero,https://github.com/spf13/afero/blob/master/LICENSE.txt,Apache-2.0
   gopkg.in/yaml.v3,Unknown,MIT
   golang.org/x/net,Unknown,BSD-3-Clause
   github.com/gorilla/context,https://github.com/gorilla/context/blob/master/LICENSE,BSD-3-Clause
   github.com/pelletier/go-toml,https://github.com/pelletier/go-toml/blob/master/LICENSE,MIT
   github.com/xeipuuv/gojsonschema,Unknown,Apache-2.0
   github.com/xeipuuv/gojsonreference,Unknown,Apache-2.0
   github.com/xeipuuv/gojsonpointer,Unknown,Apache-2.0
   github.com/spf13/viper,https://github.com/spf13/viper/blob/master/LICENSE,MIT
   
   
   github.com/davecgh/go-spew/spew,https://github.com/davecgh/go-spew/blob/master/spew/LICENSE,ISC
   github.com/hashicorp/hcl,https://github.com/hashicorp/hcl/blob/master/LICENSE,MPL-2.0
   
   ```
   
   The last two are not directly dependent. I don't know whether this will be a problem
   
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] moonming commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508348027



##########
File path: api/internal/core/entity/query.go
##########
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more

Review comment:
       fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #564: feat: refactor `manager api`

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508257873



##########
File path: .github/workflows/api_ci.yml
##########
@@ -4,9 +4,11 @@ on:
   push:
     branches:
       - master
+      - refactor

Review comment:
       We don't need this branch anymore

##########
File path: api/filter/authentication.go
##########
@@ -17,49 +17,55 @@
 package filter
 
 import (
-	"github.com/apisix/manager-api/conf"
-	"github.com/apisix/manager-api/errno"
-	"github.com/dgrijalva/jwt-go"
-	"github.com/gin-gonic/gin"
 	"net/http"
 	"strings"
+
+	"github.com/dgrijalva/jwt-go"
+	"github.com/gin-gonic/gin"
+
+	"github.com/apisix/manager-api/conf"
 )
 
 func Authentication() gin.HandlerFunc {
 	return func(c *gin.Context) {
-		if c.Request.URL.Path != "/apisix/admin/user/login" && strings.HasPrefix(c.Request.URL.Path,"/apisix") {
+		if c.Request.URL.Path != "/apisix/admin/user/login" && strings.HasPrefix(c.Request.URL.Path, "/apisix") {
 			tokenStr := c.GetHeader("Authorization")
 
 			// verify token
 			token, err := jwt.ParseWithClaims(tokenStr, &jwt.StandardClaims{}, func(token *jwt.Token) (interface{}, error) {
 				return []byte(conf.AuthenticationConfig.Session.Secret), nil
 			})
 
-			if err != nil {
-				c.AbortWithStatusJSON(http.StatusUnauthorized, errno.FromMessage(errno.ForbiddenError).Response())
+			errResp := gin.H{
+				"code":    010013,

Review comment:
       Do we have a complete mapper?

##########
File path: api/internal/core/storage/storage_mock.go
##########
@@ -0,0 +1,116 @@
+// Code generated by mockery v1.0.0. DO NOT EDIT.

Review comment:
       License?

##########
File path: api/internal/core/store/selector_test.go
##########
@@ -0,0 +1,285 @@
+/*

Review comment:
       ??????

##########
File path: api/internal/core/entity/query.go
##########
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more

Review comment:
       Double licenses?

##########
File path: api/build-tools/json.lua
##########
@@ -0,0 +1,400 @@
+--
+-- json.lua
+--
+-- Copyright (c) 2020 rxi

Review comment:
       Does this file's license is compatible with Apache License 2.0?

##########
File path: api/internal/core/store/validate_mock.go
##########
@@ -0,0 +1,24 @@
+// Code generated by mockery v1.0.0. DO NOT EDIT.

Review comment:
       License

##########
File path: api/internal/core/store/selector.go
##########
@@ -0,0 +1,144 @@
+/*

Review comment:
       ???

##########
File path: api/internal/core/store/query.go
##########
@@ -0,0 +1,151 @@
+/*

Review comment:
       ???




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org