Removing ActionS

This commit is contained in:
nickolasdaniel
2021-03-31 11:44:07 +03:00
committed by Dan Christian Bogos
parent a2bde1ad6e
commit ce915c77a6
77 changed files with 141 additions and 8212 deletions

View File

@@ -728,27 +728,6 @@ func (sqls *SQLStorage) SetTPDispatcherHosts(tpDPPs []*utils.TPDispatcherHost) e
return nil
}
func (sqls *SQLStorage) SetTPActionProfiles(tpAps []*utils.TPActionProfile) error {
if len(tpAps) == 0 {
return nil
}
tx := sqls.db.Begin()
for _, tpAp := range tpAps {
// Remove previous
if err := tx.Where(&ActionProfileMdl{Tpid: tpAp.TPid, Tenant: tpAp.Tenant, ID: tpAp.ID}).Delete(ActionProfileMdl{}).Error; err != nil {
tx.Rollback()
return err
}
for _, mst := range APItoModelTPActionProfile(tpAp) {
if err := tx.Create(&mst).Error; err != nil {
tx.Rollback()
return err
}
}
}
tx.Commit()
return nil
}
func (sqls *SQLStorage) SetSMCost(smc *SMCost) error {
if smc.CostDetails == nil {
return nil
@@ -1572,26 +1551,6 @@ func (sqls *SQLStorage) GetTPDispatcherHosts(tpid, tenant, id string) ([]*utils.
return arls, nil
}
func (sqls *SQLStorage) GetTPActionProfiles(tpid, tenant, id string) ([]*utils.TPActionProfile, error) {
var dpps ActionProfileMdls
q := sqls.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(&dpps).Error; err != nil {
return nil, err
}
arls := dpps.AsTPActionProfile()
if len(arls) == 0 {
return arls, utils.ErrNotFound
}
return arls, nil
}
// GetVersions returns slice of all versions or a specific version if tag is specified
func (sqls *SQLStorage) GetVersions(itm string) (vrs Versions, err error) {
q := sqls.db.Model(&TBLVersion{})