Skip to content

Commit

Permalink
Merge pull request #270 from ArtisanCloud/dev/michaelhu
Browse files Browse the repository at this point in the history
refact(mp): remove middleware for shop,media,datadictionary etc api a…
  • Loading branch information
Matrix-X authored Oct 16, 2023
2 parents 7f504ed + 744e741 commit d91f000
Show file tree
Hide file tree
Showing 15 changed files with 311 additions and 100 deletions.
2 changes: 1 addition & 1 deletion api/mp/dictionary.api
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import "../admin/dictionary.api"
@server(
group: mp/dictionary
prefix: /api/v1/mp/dictionary
middleware: MPCustomerJWTAuth
// middleware: MPCustomerJWTAuth
)

service PowerX {
Expand Down
2 changes: 1 addition & 1 deletion api/mp/market/media.api
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import "../../admin/crm/market/media.api"
@server(
group: mp/crm/market/media
prefix: /api/v1/mp/market
middleware: MPCustomerJWTAuth
// middleware: MPCustomerJWTAuth
)

service PowerX {
Expand Down
2 changes: 1 addition & 1 deletion api/mp/market/store.api
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import "../../admin/crm/market/store.api"
@server(
group: mp/crm/market/store
prefix: /api/v1/mp/market
middleware: MPCustomerJWTAuth
// middleware: MPCustomerJWTAuth
)


Expand Down
2 changes: 1 addition & 1 deletion api/mp/product/product.api
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import "../../admin/crm/product/product.api"
@server(
group: mp/crm/product
prefix: /api/v1/mp/product
middleware: MPCustomerJWTAuth
// middleware: MPCustomerJWTAuth
)


Expand Down
2 changes: 1 addition & 1 deletion api/mp/product/productcategory.api
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import "../../admin/crm/product/productstatistics.api"
@server(
group: mp/crm/product
prefix: /api/v1/mp/product
middleware: MPCustomerJWTAuth
// middleware: MPCustomerJWTAuth
)

service PowerX {
Expand Down
2 changes: 1 addition & 1 deletion api/mp/product/productstatistics.api
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ info(
@server(
group: mp/crm/product/productstatistics
prefix: /api/v1/mp/product
middleware: MPCustomerJWTAuth
// middleware: MPCustomerJWTAuth
)

service PowerX {
Expand Down
21 changes: 21 additions & 0 deletions internal/handler/plugin/listpluginfrontendrouteshandler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package plugin

import (
"net/http"

"PowerX/internal/logic/plugin"
"PowerX/internal/svc"
"github.com/zeromicro/go-zero/rest/httpx"
)

func ListPluginFrontendRoutesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := plugin.NewListPluginFrontendRoutesLogic(r.Context(), svcCtx)
resp, err := l.ListPluginFrontendRoutes()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
28 changes: 28 additions & 0 deletions internal/handler/plugin/listpluginhandler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package plugin

import (
"net/http"

"PowerX/internal/logic/plugin"
"PowerX/internal/svc"
"PowerX/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)

func ListPluginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListPluginRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}

l := plugin.NewListPluginLogic(r.Context(), svcCtx)
resp, err := l.ListPlugin(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
28 changes: 28 additions & 0 deletions internal/handler/plugin/registerpluginhandler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package plugin

import (
"net/http"

"PowerX/internal/logic/plugin"
"PowerX/internal/svc"
"PowerX/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)

func RegisterPluginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RegisterPluginRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}

l := plugin.NewRegisterPluginLogic(r.Context(), svcCtx)
resp, err := l.RegisterPlugin(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
174 changes: 80 additions & 94 deletions internal/handler/routes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d91f000

Please sign in to comment.