|
|
@@ -197,6 +197,31 @@ func (simple *Simple) bind(binder *binding.Binder) {
|
|
|
return nil, nil
|
|
|
},
|
|
|
})
|
|
|
+
|
|
|
+ binding.PostBind(binder, &binding.SimpleBindItem[any]{
|
|
|
+ Path: "/queryRule/disable",
|
|
|
+ SendResponseFunc: response.SendMsgResponse,
|
|
|
+ RequestParams: &EnableQueryRuleJsonBody{},
|
|
|
+ ServiceFunc: func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (any, error) {
|
|
|
+ dbExecutor := i.DBExecutor()
|
|
|
+
|
|
|
+ e, err := domain.ToConcrete[*Entity](objects[0])
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ err = database.Update(dbExecutor, &sql.UpdateExecuteParams{
|
|
|
+ TableName: domain.TableName(simple.Schema, e),
|
|
|
+ TableRow: sql.NewTableRow().Add(ColumnEnabled, false),
|
|
|
+ Conditions: sql.NewConditions().Equal(entity.ColumnID, e.ID),
|
|
|
+ })
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil, nil
|
|
|
+ },
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
func Bind(app *application.App, simple *Simple) {
|