package relations import ( "git.sxidc.com/go-framework/baize/convenient/domain/auth/role" "git.sxidc.com/go-framework/baize/convenient/domain/auth/user" "git.sxidc.com/go-framework/baize/convenient/relation/many2many" "git.sxidc.com/go-framework/baize/framework/binding" ) // SimpleUserAndRole Bind参数 type SimpleUserAndRole struct { // schema Schema string // 鉴权中间件 AuthMiddleware binding.Middleware } func (simple *SimpleUserAndRole) Bind(binder *binding.Binder) { many2many.BindSimple(binder, &many2many.Simple[user.Info, role.Info]{ Left: &user.Entity{}, Right: &role.Entity{}, Schema: simple.Schema, LeftUpdateJsonBody: &user.UpdateRolesOfUserJsonBody{}, LeftQueryQueryParams: &user.GetRolesOfUserQueryParams{}, RightUpdateJsonBody: &role.UpdateUsersOfRoleJsonBody{}, RightQueryQueryParams: &role.GetUsersOfRoleQueryParams{}, }, many2many.WithGlobalMiddlewares(simple.AuthMiddleware)) }