diff --git a/apier/v1/accounts.go b/apier/v1/accounts.go index 41aff4a8c..c5a5e1e16 100644 --- a/apier/v1/accounts.go +++ b/apier/v1/accounts.go @@ -226,8 +226,12 @@ type AttrGetAccounts struct { SearchTerm string } -func (self *ApierV1) GetAccounts(attr AttrGetAccounts, reply *[]string) error { - accountKeys, err := self.AccountDb.GetKeysForPrefix(engine.ACCOUNT_PREFIX) +func (self *ApierV1) GetAccounts(attrs AttrGetAccounts, reply *[]string) error { + prefix := engine.ACCOUNT_PREFIX + if attrs.SearchTerm != "" { + prefix += "*" + attrs.SearchTerm + } + accountKeys, err := self.AccountDb.GetKeysForPrefix(prefix) if err != nil { return err } diff --git a/apier/v1/scheduler.go b/apier/v1/scheduler.go index 6b8af2e42..5de23a446 100644 --- a/apier/v1/scheduler.go +++ b/apier/v1/scheduler.go @@ -20,6 +20,7 @@ package v1 import ( "errors" + "strings" "time" "github.com/cgrates/cgrates/utils" @@ -124,6 +125,11 @@ func (self *ApierV1) GetScheduledActions(attrs AttrsGetScheduledActions, reply * scheduledActions = scheduledActions[min : min+max] for _, qActions := range scheduledActions { sas := &ScheduledActions{ActionsId: qActions.ActionsId, ActionPlanId: qActions.Id, ActionPlanUuid: qActions.Uuid} + if paginator.SearchTerm != "" && + !(strings.Contains(sas.ActionPlanId, paginator.SearchTerm) || + strings.Contains(sas.ActionsId, paginator.SearchTerm)) { + continue + } sas.NextRunTime = qActions.GetNextStartTime(time.Now()) if !attrs.TimeStart.IsZero() && sas.NextRunTime.Before(attrs.TimeStart) { continue // Filter here only requests in the filtered interval diff --git a/engine/storage_interface.go b/engine/storage_interface.go index 973f6726c..cd2b68853 100644 --- a/engine/storage_interface.go +++ b/engine/storage_interface.go @@ -68,9 +68,7 @@ type Storage interface { GetKeysForPrefix(string) ([]string, error) } -/* -Interface for storage providers. -*/ +// Interface for storage providers. type RatingStorage interface { Storage CacheRating([]string, []string, []string, []string, []string) error