You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
814 B
Go

package role_admin
import (
"context"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core"
"github.com/jinzhu/copier"
"git.noahlan.cn/n-admin/n-admin-server/api/internal/svc"
"git.noahlan.cn/n-admin/n-admin-server/api/internal/types"
"net/http"
)
type CreateRoleAdminLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
r *http.Request
}
func NewCreateRoleAdminLogic(r *http.Request, ctx context.Context, svcCtx *svc.ServiceContext) *CreateRoleAdminLogic {
return &CreateRoleAdminLogic{
r: r,
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *CreateRoleAdminLogic) CreateRoleAdmin(req *types.RoleInfo) error {
var rpcReq core.RoleInfo
_ = copier.Copy(&rpcReq, req)
_, err := l.svcCtx.CoreRpc.CreateRole(l.ctx, &rpcReq)
if err != nil {
return err
}
return nil
}