增加添加部门接口
This commit is contained in:
@@ -11,22 +11,22 @@ import (
|
||||
"fusenapi/server/ldap-admin/internal/types"
|
||||
)
|
||||
|
||||
func CreateLdapOrganizationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
func CreateLdapOrginationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var req types.CreateLdapOrganizationReq
|
||||
var req types.CreateLdapOrginationReq
|
||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 创建一个业务逻辑层实例
|
||||
l := logic.NewCreateLdapOrganizationLogic(r.Context(), svcCtx)
|
||||
l := logic.NewCreateLdapOrginationLogic(r.Context(), svcCtx)
|
||||
|
||||
rl := reflect.ValueOf(l)
|
||||
basic.BeforeLogic(w, r, rl)
|
||||
|
||||
resp := l.CreateLdapOrganization(&req, userinfo)
|
||||
resp := l.CreateLdapOrgination(&req, userinfo)
|
||||
|
||||
if !basic.AfterLogic(w, r, rl, resp) {
|
||||
basic.NormalAfterLogic(w, r, resp)
|
||||
@@ -11,22 +11,22 @@ import (
|
||||
"fusenapi/server/ldap-admin/internal/types"
|
||||
)
|
||||
|
||||
func DeleteLdapOrganizationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
func DeleteLdapOrginationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var req types.DeleteLdapOrganizationReq
|
||||
var req types.DeleteLdapOrginationReq
|
||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 创建一个业务逻辑层实例
|
||||
l := logic.NewDeleteLdapOrganizationLogic(r.Context(), svcCtx)
|
||||
l := logic.NewDeleteLdapOrginationLogic(r.Context(), svcCtx)
|
||||
|
||||
rl := reflect.ValueOf(l)
|
||||
basic.BeforeLogic(w, r, rl)
|
||||
|
||||
resp := l.DeleteLdapOrganization(&req, userinfo)
|
||||
resp := l.DeleteLdapOrgination(&req, userinfo)
|
||||
|
||||
if !basic.AfterLogic(w, r, rl, resp) {
|
||||
basic.NormalAfterLogic(w, r, resp)
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"fusenapi/server/ldap-admin/internal/types"
|
||||
)
|
||||
|
||||
func GetOrganizationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
func GetorginationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var req types.Request
|
||||
@@ -21,12 +21,12 @@ func GetOrganizationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
|
||||
// 创建一个业务逻辑层实例
|
||||
l := logic.NewGetOrganizationsLogic(r.Context(), svcCtx)
|
||||
l := logic.NewGetorginationsLogic(r.Context(), svcCtx)
|
||||
|
||||
rl := reflect.ValueOf(l)
|
||||
basic.BeforeLogic(w, r, rl)
|
||||
|
||||
resp := l.GetOrganizations(&req, userinfo)
|
||||
resp := l.Getorginations(&req, userinfo)
|
||||
|
||||
if !basic.AfterLogic(w, r, rl, resp) {
|
||||
basic.NormalAfterLogic(w, r, resp)
|
||||
@@ -44,23 +44,23 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/api/ldap-admin/get_organizations",
|
||||
Handler: GetOrganizationsHandler(serverCtx),
|
||||
Path: "/api/ldap-admin/get_ldap_orginations",
|
||||
Handler: GetorginationsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/api/ldap-admin/create_ldap_orgination",
|
||||
Handler: CreateLdapOrganizationHandler(serverCtx),
|
||||
Handler: CreateLdapOrginationHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/api/ldap-admin/delete_ldap_orgination",
|
||||
Handler: DeleteLdapOrganizationHandler(serverCtx),
|
||||
Handler: DeleteLdapOrginationHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/api/ldap-admin/update_ldap_orgination",
|
||||
Handler: UpdateLdapOrganizationHandler(serverCtx),
|
||||
Handler: UpdateLdapOrginationHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
@@ -11,22 +11,22 @@ import (
|
||||
"fusenapi/server/ldap-admin/internal/types"
|
||||
)
|
||||
|
||||
func UpdateLdapOrganizationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
func UpdateLdapOrginationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var req types.UpdateLdapOrganizationReq
|
||||
var req types.UpdateLdapOrginationReq
|
||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 创建一个业务逻辑层实例
|
||||
l := logic.NewUpdateLdapOrganizationLogic(r.Context(), svcCtx)
|
||||
l := logic.NewUpdateLdapOrginationLogic(r.Context(), svcCtx)
|
||||
|
||||
rl := reflect.ValueOf(l)
|
||||
basic.BeforeLogic(w, r, rl)
|
||||
|
||||
resp := l.UpdateLdapOrganization(&req, userinfo)
|
||||
resp := l.UpdateLdapOrgination(&req, userinfo)
|
||||
|
||||
if !basic.AfterLogic(w, r, rl, resp) {
|
||||
basic.NormalAfterLogic(w, r, resp)
|
||||
Reference in New Issue
Block a user