Update tp filter to consider tenant

This commit is contained in:
TeoV
2019-01-09 05:36:49 -05:00
committed by Dan Christian Bogos
parent 297eb915a7
commit c9ce2f6bc5
12 changed files with 41 additions and 46 deletions

View File

@@ -1531,12 +1531,15 @@ func (self *SQLStorage) GetTPThresholds(tpid, tenant, id string) ([]*utils.TPThr
return aths, nil
}
func (self *SQLStorage) GetTPFilters(tpid, id string) ([]*utils.TPFilterProfile, error) {
func (self *SQLStorage) GetTPFilters(tpid, tenant, id string) ([]*utils.TPFilterProfile, error) {
var ths TpFilterS
q := self.db.Where("tpid = ?", tpid)
if len(id) != 0 {
q = q.Where("id = ?", id)
}
if len(tenant) != 0 {
q = q.Where("tenant = ?", tenant)
}
if err := q.Find(&ths).Error; err != nil {
return nil, err
}