mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 02:26:26 +05:00
ApierV1.GetReverseDestination
This commit is contained in:
@@ -65,8 +65,7 @@ type AttrRemoveDestination struct {
|
||||
Prefixes []string
|
||||
}
|
||||
|
||||
func (self *ApierV1) RemoveDestination(attr AttrRemoveDestination, reply *string) error {
|
||||
var err error
|
||||
func (self *ApierV1) RemoveDestination(attr AttrRemoveDestination, reply *string) (err error) {
|
||||
for _, dstID := range attr.DestinationIDs {
|
||||
if len(attr.Prefixes) == 0 {
|
||||
if err = self.RatingDb.RemoveDestination(dstID, utils.NonTransactional); err != nil {
|
||||
@@ -75,7 +74,6 @@ func (self *ApierV1) RemoveDestination(attr AttrRemoveDestination, reply *string
|
||||
} else {
|
||||
*reply = utils.OK
|
||||
}
|
||||
} else {
|
||||
// TODO list
|
||||
// get destination
|
||||
// remove prefixes
|
||||
@@ -86,6 +84,18 @@ func (self *ApierV1) RemoveDestination(attr AttrRemoveDestination, reply *string
|
||||
return err
|
||||
}
|
||||
|
||||
func (v1 *ApierV1) GetReverseDestination(prefix string, reply *[]string) (err error) {
|
||||
if prefix == "" {
|
||||
return utils.NewErrMandatoryIeMissing("prefix")
|
||||
}
|
||||
var revLst []string
|
||||
if revLst, err = v1.RatingDb.GetReverseDestination(prefix, false, utils.NonTransactional); err != nil {
|
||||
return
|
||||
}
|
||||
*reply = revLst
|
||||
return
|
||||
}
|
||||
|
||||
func (apier *ApierV1) GetSharedGroup(sgId string, reply *engine.SharedGroup) error {
|
||||
if sg, err := apier.RatingDb.GetSharedGroup(sgId, false, utils.NonTransactional); err != nil && err != utils.ErrNotFound { // Not found is not an error here
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user