nic-chen commented on a change in pull request #486:
URL: https://github.com/apache/apisix-dashboard/pull/486#discussion_r491411145
##########
File path: api/internal/handler/consumer/consumer.go
##########
@@ -0,0 +1,135 @@
+package consumer
+
+import (
+ "reflect"
+ "strings"
+
+ "github.com/gin-gonic/gin"
+ "github.com/shiningrush/droplet"
+ "github.com/shiningrush/droplet/data"
+ "github.com/shiningrush/droplet/wrapper"
+ wgin "github.com/shiningrush/droplet/wrapper/gin"
+
+ "github.com/apisix/manager-api/internal/core/entity"
+ "github.com/apisix/manager-api/internal/core/store"
+ "github.com/apisix/manager-api/internal/handler"
+ "github.com/apisix/manager-api/internal/utils"
+)
+
+type Handler struct {
+ consumerStore *store.GenericStore
+}
+
+func NewHandler() (handler.RouteRegister, error) {
+ s, err := store.NewGenericStore(store.GenericStoreOption{
+ BasePath: "/apisix/consumers",
+ ObjType: reflect.TypeOf(entity.Consumer{}),
+ KeyFunc: func(obj interface{}) string {
+ r := obj.(*entity.Consumer)
+ return r.Username
Review comment:
@ShiningRush
username is used as key for consumer not ID.
see:
https://github.com/apache/apisix/blob/master/apisix/admin/consumers.lua#L77
----------------------------------------------------------------
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:
[email protected]