Skip to content

Commit

Permalink
Merge pull request #273 from ArtisanCloud/dev/northseadl
Browse files Browse the repository at this point in the history
fix /plugin -> /api/v1/plugin
  • Loading branch information
northseadl authored Oct 25, 2023
2 parents b6ec99a + 4b94a78 commit cd305f9
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 197 deletions.
21 changes: 0 additions & 21 deletions internal/handler/listpluginfrontendrouteshandler.go

This file was deleted.

28 changes: 0 additions & 28 deletions internal/handler/listpluginhandler.go

This file was deleted.

28 changes: 0 additions & 28 deletions internal/handler/registerpluginhandler.go

This file was deleted.

42 changes: 0 additions & 42 deletions internal/logic/listpluginfrontendrouteslogic.go

This file was deleted.

30 changes: 0 additions & 30 deletions internal/logic/listpluginlogic.go

This file was deleted.

18 changes: 15 additions & 3 deletions internal/logic/plugin/listpluginfrontendrouteslogic.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,19 @@ func NewListPluginFrontendRoutesLogic(ctx context.Context, svcCtx *svc.ServiceCo
}

func (l *ListPluginFrontendRoutesLogic) ListPluginFrontendRoutes() (resp *types.ListPluginFrontendRoutesReply, err error) {
// todo: add your logic here and delete this line

return
routes := l.svcCtx.Plugin.ListFrontendRoutes()
var routesList []types.PluginWebRoutes
for _, route := range routes {
routesList = append(routesList, types.PluginWebRoutes{
Name: route.Name,
Path: route.Path,
Meta: types.PluginWebRouteMeta{
Locale: route.Meta.Locale,
Icon: route.Meta.Icon,
},
})
}
return &types.ListPluginFrontendRoutesReply{
Routes: routesList,
}, nil
}
19 changes: 17 additions & 2 deletions internal/logic/plugin/registerpluginlogic.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package plugin

import (
"PowerX/pkg/pluginx"
"context"

"PowerX/internal/svc"
Expand All @@ -24,7 +25,21 @@ func NewRegisterPluginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Re
}

func (l *RegisterPluginLogic) RegisterPlugin(req *types.RegisterPluginRequest) (resp *types.RegisterPluginReply, err error) {
// todo: add your logic here and delete this line
var routes []pluginx.BackendRoute
for _, route := range req.Routes {
routes = append(routes, pluginx.BackendRoute{
Method: route.Method,
Path: route.Path,
})
}
l.Infof("plugin register request: %v", req)
etc, err := l.svcCtx.Plugin.Register(req.Name, req.Addr, routes)
if err != nil {
return nil, err
}
l.Infof("plugin %s registered", req.Name)

return
return &types.RegisterPluginReply{
Etc: etc,
}, nil
}
43 changes: 0 additions & 43 deletions internal/logic/registerpluginlogic.go

This file was deleted.

0 comments on commit cd305f9

Please sign in to comment.