mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 22:58:44 +05:00
Renamed DispatcherS CSV file to DispatcherProfiles.csv
This commit is contained in:
committed by
Dan Christian Bogos
parent
4fe5edae39
commit
022ad003d6
@@ -681,18 +681,18 @@ func (self *SQLStorage) SetTPChargers(tpCPPs []*utils.TPChargerProfile) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SQLStorage) SetTPDispatchers(tpDPPs []*utils.TPDispatcherProfile) error {
|
||||
func (self *SQLStorage) SetTPDispatcherProfiles(tpDPPs []*utils.TPDispatcherProfile) error {
|
||||
if len(tpDPPs) == 0 {
|
||||
return nil
|
||||
}
|
||||
tx := self.db.Begin()
|
||||
for _, dpp := range tpDPPs {
|
||||
// Remove previous
|
||||
if err := tx.Where(&TPDispatcher{Tpid: dpp.TPid, ID: dpp.ID}).Delete(TPDispatcher{}).Error; err != nil {
|
||||
if err := tx.Where(&TPDispatcherProfile{Tpid: dpp.TPid, ID: dpp.ID}).Delete(TPDispatcherProfile{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
for _, mst := range APItoModelTPDispatcher(dpp) {
|
||||
for _, mst := range APItoModelTPDispatcherProfile(dpp) {
|
||||
if err := tx.Save(&mst).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@@ -1534,8 +1534,8 @@ func (self *SQLStorage) GetTPChargers(tpid, tenant, id string) ([]*utils.TPCharg
|
||||
return arls, nil
|
||||
}
|
||||
|
||||
func (self *SQLStorage) GetTPDispatchers(tpid, tenant, id string) ([]*utils.TPDispatcherProfile, error) {
|
||||
var dpps TPDispatchers
|
||||
func (self *SQLStorage) GetTPDispatcherProfiles(tpid, tenant, id string) ([]*utils.TPDispatcherProfile, error) {
|
||||
var dpps TPDispatcherProfiles
|
||||
q := self.db.Where("tpid = ?", tpid)
|
||||
if len(id) != 0 {
|
||||
q = q.Where("id = ?", id)
|
||||
@@ -1546,7 +1546,7 @@ func (self *SQLStorage) GetTPDispatchers(tpid, tenant, id string) ([]*utils.TPDi
|
||||
if err := q.Find(&dpps).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
arls := dpps.AsTPDispatchers()
|
||||
arls := dpps.AsTPDispatcherProfiles()
|
||||
if len(arls) == 0 {
|
||||
return arls, utils.ErrNotFound
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user