mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Modified struct names in engines/models.go
This commit is contained in:
committed by
Dan Christian Bogos
parent
dc59d6fdfc
commit
3665961546
@@ -130,7 +130,7 @@ func (apierSv1 *APIerSv1) RemoveTPAccountActions(attrs *AttrGetTPAccountActions,
|
||||
if missing := utils.MissingStructFields(attrs, []string{"TPid", "LoadId", "Tenant", "Account"}); len(missing) != 0 { //Params missing
|
||||
return utils.NewErrMandatoryIeMissing(missing...)
|
||||
}
|
||||
aa := engine.TpAccountAction{Tpid: attrs.TPid}
|
||||
aa := engine.TpAccountActionMdl{Tpid: attrs.TPid}
|
||||
if err := aa.SetAccountActionId(attrs.AccountActionsId); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ func getColumnCount(s interface{}) int {
|
||||
return count
|
||||
}
|
||||
|
||||
type TpDestinations []TpDestination
|
||||
type TpDestinations []TpDestinationMdl
|
||||
|
||||
func (tps TpDestinations) AsMapDestinations() (map[string]*Destination, error) {
|
||||
result := make(map[string]*Destination)
|
||||
@@ -184,14 +184,14 @@ func (tps TpDestinations) AsTPDestinations() (result []*utils.TPDestination) {
|
||||
func APItoModelDestination(d *utils.TPDestination) (result TpDestinations) {
|
||||
if d != nil {
|
||||
for _, p := range d.Prefixes {
|
||||
result = append(result, TpDestination{
|
||||
result = append(result, TpDestinationMdl{
|
||||
Tpid: d.TPid,
|
||||
Tag: d.ID,
|
||||
Prefix: p,
|
||||
})
|
||||
}
|
||||
if len(d.Prefixes) == 0 {
|
||||
result = append(result, TpDestination{
|
||||
result = append(result, TpDestinationMdl{
|
||||
Tpid: d.TPid,
|
||||
Tag: d.ID,
|
||||
})
|
||||
@@ -200,7 +200,7 @@ func APItoModelDestination(d *utils.TPDestination) (result TpDestinations) {
|
||||
return
|
||||
}
|
||||
|
||||
type TpTimings []TpTiming
|
||||
type TpTimings []TpTimingMdl
|
||||
|
||||
func (tps TpTimings) AsMapTPTimings() (map[string]*utils.ApierTPTiming, error) {
|
||||
result := make(map[string]*utils.ApierTPTiming)
|
||||
@@ -239,8 +239,8 @@ func (tps TpTimings) AsTPTimings() (result []*utils.ApierTPTiming) {
|
||||
return result
|
||||
}
|
||||
|
||||
func APItoModelTiming(t *utils.ApierTPTiming) (result TpTiming) {
|
||||
return TpTiming{
|
||||
func APItoModelTiming(t *utils.ApierTPTiming) (result TpTimingMdl) {
|
||||
return TpTimingMdl{
|
||||
Tpid: t.TPid,
|
||||
Tag: t.ID,
|
||||
Years: t.Years,
|
||||
@@ -261,7 +261,7 @@ func APItoModelTimings(ts []*utils.ApierTPTiming) (result TpTimings) {
|
||||
return result
|
||||
}
|
||||
|
||||
type TpRates []TpRate
|
||||
type TpRates []TpRateMdl
|
||||
|
||||
func (tps TpRates) AsMapRates() (map[string]*utils.TPRateRALs, error) {
|
||||
result := make(map[string]*utils.TPRateRALs)
|
||||
@@ -316,7 +316,7 @@ func MapTPRates(s []*utils.TPRateRALs) (map[string]*utils.TPRateRALs, error) {
|
||||
func APItoModelRate(r *utils.TPRateRALs) (result TpRates) {
|
||||
if r != nil {
|
||||
for _, rs := range r.RateSlots {
|
||||
result = append(result, TpRate{
|
||||
result = append(result, TpRateMdl{
|
||||
Tpid: r.TPid,
|
||||
Tag: r.ID,
|
||||
ConnectFee: rs.ConnectFee,
|
||||
@@ -327,7 +327,7 @@ func APItoModelRate(r *utils.TPRateRALs) (result TpRates) {
|
||||
})
|
||||
}
|
||||
if len(r.RateSlots) == 0 {
|
||||
result = append(result, TpRate{
|
||||
result = append(result, TpRateMdl{
|
||||
Tpid: r.TPid,
|
||||
Tag: r.ID,
|
||||
})
|
||||
@@ -345,7 +345,7 @@ func APItoModelRates(rs []*utils.TPRateRALs) (result TpRates) {
|
||||
return result
|
||||
}
|
||||
|
||||
type TpDestinationRates []TpDestinationRate
|
||||
type TpDestinationRates []TpDestinationRateMdl
|
||||
|
||||
func (tps TpDestinationRates) AsMapDestinationRates() (map[string]*utils.TPDestinationRate, error) {
|
||||
result := make(map[string]*utils.TPDestinationRate)
|
||||
@@ -401,7 +401,7 @@ func MapTPDestinationRates(s []*utils.TPDestinationRate) (map[string]*utils.TPDe
|
||||
func APItoModelDestinationRate(d *utils.TPDestinationRate) (result TpDestinationRates) {
|
||||
if d != nil {
|
||||
for _, dr := range d.DestinationRates {
|
||||
result = append(result, TpDestinationRate{
|
||||
result = append(result, TpDestinationRateMdl{
|
||||
Tpid: d.TPid,
|
||||
Tag: d.ID,
|
||||
DestinationsTag: dr.DestinationId,
|
||||
@@ -413,7 +413,7 @@ func APItoModelDestinationRate(d *utils.TPDestinationRate) (result TpDestination
|
||||
})
|
||||
}
|
||||
if len(d.DestinationRates) == 0 {
|
||||
result = append(result, TpDestinationRate{
|
||||
result = append(result, TpDestinationRateMdl{
|
||||
Tpid: d.TPid,
|
||||
Tag: d.ID,
|
||||
})
|
||||
@@ -433,7 +433,7 @@ func APItoModelDestinationRates(drs []*utils.TPDestinationRate) (result TpDestin
|
||||
return result
|
||||
}
|
||||
|
||||
type TpRatingPlans []TpRatingPlan
|
||||
type TpRatingPlans []TpRatingPlanMdl
|
||||
|
||||
func (tps TpRatingPlans) AsMapTPRatingPlans() (map[string]*utils.TPRatingPlan, error) {
|
||||
result := make(map[string]*utils.TPRatingPlan)
|
||||
@@ -517,7 +517,7 @@ func MapTPRatingPlanBindings(s []*utils.TPRatingPlan) map[string][]*utils.TPRati
|
||||
func APItoModelRatingPlan(rp *utils.TPRatingPlan) (result TpRatingPlans) {
|
||||
if rp != nil {
|
||||
for _, rpb := range rp.RatingPlanBindings {
|
||||
result = append(result, TpRatingPlan{
|
||||
result = append(result, TpRatingPlanMdl{
|
||||
Tpid: rp.TPid,
|
||||
Tag: rp.ID,
|
||||
DestratesTag: rpb.DestinationRatesId,
|
||||
@@ -526,7 +526,7 @@ func APItoModelRatingPlan(rp *utils.TPRatingPlan) (result TpRatingPlans) {
|
||||
})
|
||||
}
|
||||
if len(rp.RatingPlanBindings) == 0 {
|
||||
result = append(result, TpRatingPlan{
|
||||
result = append(result, TpRatingPlanMdl{
|
||||
Tpid: rp.TPid,
|
||||
Tag: rp.ID,
|
||||
})
|
||||
@@ -544,7 +544,7 @@ func APItoModelRatingPlans(rps []*utils.TPRatingPlan) (result TpRatingPlans) {
|
||||
return result
|
||||
}
|
||||
|
||||
type TpRatingProfiles []TpRatingProfile
|
||||
type TpRatingProfiles []TpRatingProfileMdl
|
||||
|
||||
func (tps TpRatingProfiles) AsMapTPRatingProfiles() (map[string]*utils.TPRatingProfile, error) {
|
||||
result := make(map[string]*utils.TPRatingProfile)
|
||||
@@ -597,7 +597,7 @@ func MapTPRatingProfiles(s []*utils.TPRatingProfile) (map[string]*utils.TPRating
|
||||
func APItoModelRatingProfile(rp *utils.TPRatingProfile) (result TpRatingProfiles) {
|
||||
if rp != nil {
|
||||
for _, rpa := range rp.RatingPlanActivations {
|
||||
result = append(result, TpRatingProfile{
|
||||
result = append(result, TpRatingProfileMdl{
|
||||
Tpid: rp.TPid,
|
||||
Loadid: rp.LoadId,
|
||||
Tenant: rp.Tenant,
|
||||
@@ -609,7 +609,7 @@ func APItoModelRatingProfile(rp *utils.TPRatingProfile) (result TpRatingProfiles
|
||||
})
|
||||
}
|
||||
if len(rp.RatingPlanActivations) == 0 {
|
||||
result = append(result, TpRatingProfile{
|
||||
result = append(result, TpRatingProfileMdl{
|
||||
Tpid: rp.TPid,
|
||||
Loadid: rp.LoadId,
|
||||
Tenant: rp.Tenant,
|
||||
@@ -630,7 +630,7 @@ func APItoModelRatingProfiles(rps []*utils.TPRatingProfile) (result TpRatingProf
|
||||
return result
|
||||
}
|
||||
|
||||
type TpSharedGroups []TpSharedGroup
|
||||
type TpSharedGroups []TpSharedGroupMdl
|
||||
|
||||
func (tps TpSharedGroups) AsMapTPSharedGroups() (map[string]*utils.TPSharedGroups, error) {
|
||||
result := make(map[string]*utils.TPSharedGroups)
|
||||
@@ -682,7 +682,7 @@ func MapTPSharedGroup(s []*utils.TPSharedGroups) map[string][]*utils.TPSharedGro
|
||||
func APItoModelSharedGroup(sgs *utils.TPSharedGroups) (result TpSharedGroups) {
|
||||
if sgs != nil {
|
||||
for _, sg := range sgs.SharedGroups {
|
||||
result = append(result, TpSharedGroup{
|
||||
result = append(result, TpSharedGroupMdl{
|
||||
Tpid: sgs.TPid,
|
||||
Tag: sgs.ID,
|
||||
Account: sg.Account,
|
||||
@@ -691,7 +691,7 @@ func APItoModelSharedGroup(sgs *utils.TPSharedGroups) (result TpSharedGroups) {
|
||||
})
|
||||
}
|
||||
if len(sgs.SharedGroups) == 0 {
|
||||
result = append(result, TpSharedGroup{
|
||||
result = append(result, TpSharedGroupMdl{
|
||||
Tpid: sgs.TPid,
|
||||
Tag: sgs.ID,
|
||||
})
|
||||
@@ -709,7 +709,7 @@ func APItoModelSharedGroups(sgs []*utils.TPSharedGroups) (result TpSharedGroups)
|
||||
return result
|
||||
}
|
||||
|
||||
type TpActions []TpAction
|
||||
type TpActions []TpActionMdl
|
||||
|
||||
func (tps TpActions) AsMapTPActions() (map[string]*utils.TPActions, error) {
|
||||
result := make(map[string]*utils.TPActions)
|
||||
@@ -774,7 +774,7 @@ func MapTPActions(s []*utils.TPActions) map[string][]*utils.TPAction {
|
||||
func APItoModelAction(as *utils.TPActions) (result TpActions) {
|
||||
if as != nil {
|
||||
for _, a := range as.Actions {
|
||||
result = append(result, TpAction{
|
||||
result = append(result, TpActionMdl{
|
||||
Tpid: as.TPid,
|
||||
Tag: as.ID,
|
||||
Action: a.Identifier,
|
||||
@@ -796,7 +796,7 @@ func APItoModelAction(as *utils.TPActions) (result TpActions) {
|
||||
})
|
||||
}
|
||||
if len(as.Actions) == 0 {
|
||||
result = append(result, TpAction{
|
||||
result = append(result, TpActionMdl{
|
||||
Tpid: as.TPid,
|
||||
Tag: as.ID,
|
||||
})
|
||||
@@ -814,7 +814,7 @@ func APItoModelActions(as []*utils.TPActions) (result TpActions) {
|
||||
return result
|
||||
}
|
||||
|
||||
type TpActionPlans []TpActionPlan
|
||||
type TpActionPlans []TpActionPlanMdl
|
||||
|
||||
func (tps TpActionPlans) AsMapTPActionPlans() (map[string]*utils.TPActionPlan, error) {
|
||||
result := make(map[string]*utils.TPActionPlan)
|
||||
@@ -866,7 +866,7 @@ func MapTPActionTimings(s []*utils.TPActionPlan) map[string][]*utils.TPActionTim
|
||||
func APItoModelActionPlan(a *utils.TPActionPlan) (result TpActionPlans) {
|
||||
if a != nil {
|
||||
for _, ap := range a.ActionPlan {
|
||||
result = append(result, TpActionPlan{
|
||||
result = append(result, TpActionPlanMdl{
|
||||
Tpid: a.TPid,
|
||||
Tag: a.ID,
|
||||
ActionsTag: ap.ActionsId,
|
||||
@@ -875,7 +875,7 @@ func APItoModelActionPlan(a *utils.TPActionPlan) (result TpActionPlans) {
|
||||
})
|
||||
}
|
||||
if len(a.ActionPlan) == 0 {
|
||||
result = append(result, TpActionPlan{
|
||||
result = append(result, TpActionPlanMdl{
|
||||
Tpid: a.TPid,
|
||||
Tag: a.ID,
|
||||
})
|
||||
@@ -893,7 +893,7 @@ func APItoModelActionPlans(aps []*utils.TPActionPlan) (result TpActionPlans) {
|
||||
return result
|
||||
}
|
||||
|
||||
type TpActionTriggers []TpActionTrigger
|
||||
type TpActionTriggers []TpActionTriggerMdl
|
||||
|
||||
func (tps TpActionTriggers) AsMapTPActionTriggers() (map[string]*utils.TPActionTriggers, error) {
|
||||
result := make(map[string]*utils.TPActionTriggers)
|
||||
@@ -963,7 +963,7 @@ func MapTPActionTriggers(s []*utils.TPActionTriggers) map[string][]*utils.TPActi
|
||||
func APItoModelActionTrigger(ats *utils.TPActionTriggers) (result TpActionTriggers) {
|
||||
if ats != nil {
|
||||
for _, at := range ats.ActionTriggers {
|
||||
result = append(result, TpActionTrigger{
|
||||
result = append(result, TpActionTriggerMdl{
|
||||
Tpid: ats.TPid,
|
||||
Tag: ats.ID,
|
||||
UniqueId: at.UniqueID,
|
||||
@@ -989,7 +989,7 @@ func APItoModelActionTrigger(ats *utils.TPActionTriggers) (result TpActionTrigge
|
||||
})
|
||||
}
|
||||
if len(ats.ActionTriggers) == 0 {
|
||||
result = append(result, TpActionTrigger{
|
||||
result = append(result, TpActionTriggerMdl{
|
||||
Tpid: ats.TPid,
|
||||
Tag: ats.ID,
|
||||
})
|
||||
@@ -1007,7 +1007,7 @@ func APItoModelActionTriggers(ts []*utils.TPActionTriggers) (result TpActionTrig
|
||||
return result
|
||||
}
|
||||
|
||||
type TpAccountActions []TpAccountAction
|
||||
type TpAccountActions []TpAccountActionMdl
|
||||
|
||||
func (tps TpAccountActions) AsMapTPAccountActions() (map[string]*utils.TPAccountActions, error) {
|
||||
result := make(map[string]*utils.TPAccountActions)
|
||||
@@ -1050,8 +1050,8 @@ func MapTPAccountActions(s []*utils.TPAccountActions) (map[string]*utils.TPAccou
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func APItoModelAccountAction(aa *utils.TPAccountActions) *TpAccountAction {
|
||||
return &TpAccountAction{
|
||||
func APItoModelAccountAction(aa *utils.TPAccountActions) *TpAccountActionMdl {
|
||||
return &TpAccountActionMdl{
|
||||
Tpid: aa.TPid,
|
||||
Loadid: aa.LoadId,
|
||||
Tenant: aa.Tenant,
|
||||
@@ -1072,7 +1072,7 @@ func APItoModelAccountActions(aas []*utils.TPAccountActions) (result TpAccountAc
|
||||
return result
|
||||
}
|
||||
|
||||
type TpResources []*TpResource
|
||||
type TpResources []*TpResourceMdl
|
||||
|
||||
// CSVHeader return the header for csv fields as a slice of string
|
||||
func (tps TpResources) CSVHeader() (result []string) {
|
||||
@@ -1167,7 +1167,7 @@ func APItoModelResource(rl *utils.TPResourceProfile) (mdls TpResources) {
|
||||
}
|
||||
// In case that TPResourceProfile don't have filter
|
||||
if len(rl.FilterIDs) == 0 {
|
||||
mdl := &TpResource{
|
||||
mdl := &TpResourceMdl{
|
||||
Tpid: rl.TPid,
|
||||
Tenant: rl.Tenant,
|
||||
ID: rl.ID,
|
||||
@@ -1195,7 +1195,7 @@ func APItoModelResource(rl *utils.TPResourceProfile) (mdls TpResources) {
|
||||
mdls = append(mdls, mdl)
|
||||
}
|
||||
for i, fltr := range rl.FilterIDs {
|
||||
mdl := &TpResource{
|
||||
mdl := &TpResourceMdl{
|
||||
Tpid: rl.TPid,
|
||||
Tenant: rl.Tenant,
|
||||
ID: rl.ID,
|
||||
@@ -1297,7 +1297,7 @@ func ResourceProfileToAPI(rp *ResourceProfile) (tpRL *utils.TPResourceProfile) {
|
||||
return
|
||||
}
|
||||
|
||||
type TpStats []*TpStat
|
||||
type TpStats []*TpStatMdl
|
||||
|
||||
// CSVHeader return the header for csv fields as a slice of string
|
||||
func (tps TpStats) CSVHeader() (result []string) {
|
||||
@@ -1415,7 +1415,7 @@ func (models TpStats) AsTPStats() (result []*utils.TPStatProfile) {
|
||||
func APItoModelStats(st *utils.TPStatProfile) (mdls TpStats) {
|
||||
if st != nil && len(st.Metrics) != 0 {
|
||||
for i, metric := range st.Metrics {
|
||||
mdl := &TpStat{
|
||||
mdl := &TpStatMdl{
|
||||
Tpid: st.TPid,
|
||||
Tenant: st.Tenant,
|
||||
ID: st.ID,
|
||||
@@ -1546,7 +1546,7 @@ func StatQueueProfileToAPI(st *StatQueueProfile) (tpST *utils.TPStatProfile) {
|
||||
return
|
||||
}
|
||||
|
||||
type TpThresholds []*TpThreshold
|
||||
type TpThresholds []*TpThresholdMdl
|
||||
|
||||
// CSVHeader return the header for csv fields as a slice of string
|
||||
func (tps TpThresholds) CSVHeader() (result []string) {
|
||||
@@ -1632,7 +1632,7 @@ func APItoModelTPThreshold(th *utils.TPThresholdProfile) (mdls TpThresholds) {
|
||||
min = len(th.ActionIDs)
|
||||
}
|
||||
for i := 0; i < min; i++ {
|
||||
mdl := &TpThreshold{
|
||||
mdl := &TpThresholdMdl{
|
||||
Tpid: th.TPid,
|
||||
Tenant: th.Tenant,
|
||||
ID: th.ID,
|
||||
@@ -1660,7 +1660,7 @@ func APItoModelTPThreshold(th *utils.TPThresholdProfile) (mdls TpThresholds) {
|
||||
|
||||
if len(th.FilterIDs)-min > 0 {
|
||||
for i := min; i < len(th.FilterIDs); i++ {
|
||||
mdl := &TpThreshold{
|
||||
mdl := &TpThresholdMdl{
|
||||
Tpid: th.TPid,
|
||||
Tenant: th.Tenant,
|
||||
ID: th.ID,
|
||||
@@ -1671,7 +1671,7 @@ func APItoModelTPThreshold(th *utils.TPThresholdProfile) (mdls TpThresholds) {
|
||||
}
|
||||
if len(th.ActionIDs)-min > 0 {
|
||||
for i := min; i < len(th.ActionIDs); i++ {
|
||||
mdl := &TpThreshold{
|
||||
mdl := &TpThresholdMdl{
|
||||
Tpid: th.TPid,
|
||||
Tenant: th.Tenant,
|
||||
ID: th.ID,
|
||||
@@ -1766,7 +1766,7 @@ func ThresholdProfileToAPI(th *ThresholdProfile) (tpTH *utils.TPThresholdProfile
|
||||
return
|
||||
}
|
||||
|
||||
type TpFilterS []*TpFilter
|
||||
type TpFilterS []*TpFilterMdl
|
||||
|
||||
// CSVHeader return the header for csv fields as a slice of string
|
||||
func (tps TpFilterS) CSVHeader() (result []string) {
|
||||
@@ -1822,7 +1822,7 @@ func APItoModelTPFilter(th *utils.TPFilterProfile) (mdls TpFilterS) {
|
||||
return
|
||||
}
|
||||
for _, fltr := range th.Filters {
|
||||
mdl := &TpFilter{
|
||||
mdl := &TpFilterMdl{
|
||||
Tpid: th.TPid,
|
||||
Tenant: th.Tenant,
|
||||
ID: th.ID,
|
||||
@@ -1895,7 +1895,7 @@ func FilterToTPFilter(f *Filter) (tpFltr *utils.TPFilterProfile) {
|
||||
return
|
||||
}
|
||||
|
||||
type TPRoutes []*TpRoute
|
||||
type TPRoutes []*TpRouteMdl
|
||||
|
||||
// CSVHeader return the header for csv fields as a slice of string
|
||||
func (tps TPRoutes) CSVHeader() (result []string) {
|
||||
@@ -2026,7 +2026,7 @@ func APItoModelTPRoutes(st *utils.TPRouteProfile) (mdls TPRoutes) {
|
||||
return
|
||||
}
|
||||
for i, supl := range st.Routes {
|
||||
mdl := &TpRoute{
|
||||
mdl := &TpRouteMdl{
|
||||
Tenant: st.Tenant,
|
||||
Tpid: st.TPid,
|
||||
ID: st.ID,
|
||||
@@ -2181,7 +2181,7 @@ func RouteProfileToAPI(rp *RouteProfile) (tpRp *utils.TPRouteProfile) {
|
||||
return
|
||||
}
|
||||
|
||||
type TPAttributes []*TPAttribute
|
||||
type TPAttributes []*TPAttributeMdl
|
||||
|
||||
// CSVHeader return the header for csv fields as a slice of string
|
||||
func (tps TPAttributes) CSVHeader() (result []string) {
|
||||
@@ -2272,7 +2272,7 @@ func APItoModelTPAttribute(th *utils.TPAttributeProfile) (mdls TPAttributes) {
|
||||
return
|
||||
}
|
||||
for i, reqAttribute := range th.Attributes {
|
||||
mdl := &TPAttribute{
|
||||
mdl := &TPAttributeMdl{
|
||||
Tpid: th.TPid,
|
||||
Tenant: th.Tenant,
|
||||
ID: th.ID,
|
||||
@@ -2393,7 +2393,7 @@ func AttributeProfileToAPI(attrPrf *AttributeProfile) (tpAttr *utils.TPAttribute
|
||||
return
|
||||
}
|
||||
|
||||
type TPChargers []*TPCharger
|
||||
type TPChargers []*TPChargerMdl
|
||||
|
||||
// CSVHeader return the header for csv fields as a slice of string
|
||||
func (tps TPChargers) CSVHeader() (result []string) {
|
||||
@@ -2487,7 +2487,7 @@ func APItoModelTPCharger(tpCPP *utils.TPChargerProfile) (mdls TPChargers) {
|
||||
isFilter = false
|
||||
}
|
||||
if min == 0 {
|
||||
mdl := &TPCharger{
|
||||
mdl := &TPChargerMdl{
|
||||
Tenant: tpCPP.Tenant,
|
||||
Tpid: tpCPP.TPid,
|
||||
ID: tpCPP.ID,
|
||||
@@ -2511,7 +2511,7 @@ func APItoModelTPCharger(tpCPP *utils.TPChargerProfile) (mdls TPChargers) {
|
||||
mdls = append(mdls, mdl)
|
||||
} else {
|
||||
for i := 0; i < min; i++ {
|
||||
mdl := &TPCharger{
|
||||
mdl := &TPChargerMdl{
|
||||
Tenant: tpCPP.Tenant,
|
||||
Tpid: tpCPP.TPid,
|
||||
ID: tpCPP.ID,
|
||||
@@ -2535,7 +2535,7 @@ func APItoModelTPCharger(tpCPP *utils.TPChargerProfile) (mdls TPChargers) {
|
||||
}
|
||||
if len(tpCPP.FilterIDs)-min > 0 {
|
||||
for i := min; i < len(tpCPP.FilterIDs); i++ {
|
||||
mdl := &TPCharger{
|
||||
mdl := &TPChargerMdl{
|
||||
Tenant: tpCPP.Tenant,
|
||||
Tpid: tpCPP.TPid,
|
||||
ID: tpCPP.ID,
|
||||
@@ -2546,7 +2546,7 @@ func APItoModelTPCharger(tpCPP *utils.TPChargerProfile) (mdls TPChargers) {
|
||||
}
|
||||
if len(tpCPP.AttributeIDs)-min > 0 {
|
||||
for i := min; i < len(tpCPP.AttributeIDs); i++ {
|
||||
mdl := &TPCharger{
|
||||
mdl := &TPChargerMdl{
|
||||
Tenant: tpCPP.Tenant,
|
||||
Tpid: tpCPP.TPid,
|
||||
ID: tpCPP.ID,
|
||||
@@ -2610,7 +2610,7 @@ func ChargerProfileToAPI(chargerPrf *ChargerProfile) (tpCharger *utils.TPCharger
|
||||
return
|
||||
}
|
||||
|
||||
type TPDispatcherProfiles []*TPDispatcherProfile
|
||||
type TPDispatcherProfiles []*TPDispatcherProfileMdl
|
||||
|
||||
// CSVHeader return the header for csv fields as a slice of string
|
||||
func (tps TPDispatcherProfiles) CSVHeader() (result []string) {
|
||||
@@ -2770,7 +2770,7 @@ func APItoModelTPDispatcherProfile(tpDPP *utils.TPDispatcherProfile) (mdls TPDis
|
||||
strategy := paramsToString(tpDPP.StrategyParams)
|
||||
|
||||
if len(tpDPP.Hosts) == 0 {
|
||||
return append(mdls, &TPDispatcherProfile{
|
||||
return append(mdls, &TPDispatcherProfileMdl{
|
||||
Tpid: tpDPP.TPid,
|
||||
Tenant: tpDPP.Tenant,
|
||||
ID: tpDPP.ID,
|
||||
@@ -2786,7 +2786,7 @@ func APItoModelTPDispatcherProfile(tpDPP *utils.TPDispatcherProfile) (mdls TPDis
|
||||
confilter := strings.Join(tpDPP.Hosts[0].FilterIDs, utils.INFIELD_SEP)
|
||||
conparam := paramsToString(tpDPP.Hosts[0].Params)
|
||||
|
||||
mdls = append(mdls, &TPDispatcherProfile{
|
||||
mdls = append(mdls, &TPDispatcherProfileMdl{
|
||||
Tpid: tpDPP.TPid,
|
||||
Tenant: tpDPP.Tenant,
|
||||
ID: tpDPP.ID,
|
||||
@@ -2806,7 +2806,7 @@ func APItoModelTPDispatcherProfile(tpDPP *utils.TPDispatcherProfile) (mdls TPDis
|
||||
for i := 1; i < len(tpDPP.Hosts); i++ {
|
||||
confilter = strings.Join(tpDPP.Hosts[i].FilterIDs, utils.INFIELD_SEP)
|
||||
conparam = paramsToString(tpDPP.Hosts[i].Params)
|
||||
mdls = append(mdls, &TPDispatcherProfile{
|
||||
mdls = append(mdls, &TPDispatcherProfileMdl{
|
||||
Tpid: tpDPP.TPid,
|
||||
Tenant: tpDPP.Tenant,
|
||||
ID: tpDPP.ID,
|
||||
@@ -2934,7 +2934,7 @@ func DispatcherProfileToAPI(dpp *DispatcherProfile) (tpDPP *utils.TPDispatcherPr
|
||||
}
|
||||
|
||||
// TPHosts
|
||||
type TPDispatcherHosts []*TPDispatcherHost
|
||||
type TPDispatcherHosts []*TPDispatcherHostMdl
|
||||
|
||||
// CSVHeader return the header for csv fields as a slice of string
|
||||
func (tps TPDispatcherHosts) CSVHeader() (result []string) {
|
||||
@@ -2968,11 +2968,11 @@ func (tps TPDispatcherHosts) AsTPDispatcherHosts() (result []*utils.TPDispatcher
|
||||
return
|
||||
}
|
||||
|
||||
func APItoModelTPDispatcherHost(tpDPH *utils.TPDispatcherHost) (mdls *TPDispatcherHost) {
|
||||
func APItoModelTPDispatcherHost(tpDPH *utils.TPDispatcherHost) (mdls *TPDispatcherHostMdl) {
|
||||
if tpDPH == nil {
|
||||
return
|
||||
}
|
||||
return &TPDispatcherHost{
|
||||
return &TPDispatcherHostMdl{
|
||||
Tpid: tpDPH.TPid,
|
||||
Tenant: tpDPH.Tenant,
|
||||
ID: tpDPH.ID,
|
||||
|
||||
@@ -30,15 +30,15 @@ import (
|
||||
)
|
||||
|
||||
func TestModelHelperCsvLoad(t *testing.T) {
|
||||
l, err := csvLoad(TpDestination{}, []string{"TEST_DEST", "+492"})
|
||||
tpd, ok := l.(TpDestination)
|
||||
l, err := csvLoad(TpDestinationMdl{}, []string{"TEST_DEST", "+492"})
|
||||
tpd, ok := l.(TpDestinationMdl)
|
||||
if err != nil || !ok || tpd.Tag != "TEST_DEST" || tpd.Prefix != "+492" {
|
||||
t.Errorf("model load failed: %+v", tpd)
|
||||
}
|
||||
}
|
||||
|
||||
func TestModelHelperCsvDump(t *testing.T) {
|
||||
tpd := TpDestination{
|
||||
tpd := TpDestinationMdl{
|
||||
Tag: "TEST_DEST",
|
||||
Prefix: "+492"}
|
||||
csv, err := CsvDump(tpd)
|
||||
@@ -82,8 +82,8 @@ func TestTpDestinationsAsMapDestinations(t *testing.T) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(eOut), utils.ToJSON(rcv))
|
||||
}
|
||||
in = &TpDestinations{
|
||||
TpDestination{Tpid: "TEST_TPID", Tag: "TEST_DEST1", Prefix: "+491"},
|
||||
TpDestination{Tpid: "TEST_TPID", Tag: "TEST_DEST2", Prefix: "+492"},
|
||||
TpDestinationMdl{Tpid: "TEST_TPID", Tag: "TEST_DEST1", Prefix: "+491"},
|
||||
TpDestinationMdl{Tpid: "TEST_TPID", Tag: "TEST_DEST2", Prefix: "+492"},
|
||||
}
|
||||
eOut = map[string]*Destination{
|
||||
"TEST_DEST1": {
|
||||
@@ -105,9 +105,9 @@ func TestTpDestinationsAsMapDestinations(t *testing.T) {
|
||||
}
|
||||
}
|
||||
in = &TpDestinations{
|
||||
TpDestination{Tpid: "TEST_TPID", Tag: "TEST_DEST1", Prefix: "+491"},
|
||||
TpDestination{Tpid: "TEST_TPID", Tag: "TEST_DEST2", Prefix: "+492"},
|
||||
TpDestination{Tpid: "TEST_ID", Tag: "", Prefix: ""},
|
||||
TpDestinationMdl{Tpid: "TEST_TPID", Tag: "TEST_DEST1", Prefix: "+491"},
|
||||
TpDestinationMdl{Tpid: "TEST_TPID", Tag: "TEST_DEST2", Prefix: "+492"},
|
||||
TpDestinationMdl{Tpid: "TEST_ID", Tag: "", Prefix: ""},
|
||||
}
|
||||
eOut = map[string]*Destination{
|
||||
"TEST_DEST1": {
|
||||
@@ -136,7 +136,7 @@ func TestTpDestinationsAsMapDestinations(t *testing.T) {
|
||||
func TestTpDestinationsAPItoModelDestination(t *testing.T) {
|
||||
d := &utils.TPDestination{}
|
||||
eOut := TpDestinations{
|
||||
TpDestination{},
|
||||
TpDestinationMdl{},
|
||||
}
|
||||
if rcv := APItoModelDestination(d); rcv != nil {
|
||||
if !reflect.DeepEqual(rcv, eOut) {
|
||||
@@ -150,7 +150,7 @@ func TestTpDestinationsAPItoModelDestination(t *testing.T) {
|
||||
Prefixes: []string{"+491"},
|
||||
}
|
||||
eOut = TpDestinations{
|
||||
TpDestination{
|
||||
TpDestinationMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_ID",
|
||||
Prefix: "+491",
|
||||
@@ -164,12 +164,12 @@ func TestTpDestinationsAPItoModelDestination(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTpDestinationsAsTPDestinations(t *testing.T) {
|
||||
tpd1 := TpDestination{Tpid: "TEST_TPID", Tag: "TEST_DEST", Prefix: "+491"}
|
||||
tpd2 := TpDestination{Tpid: "TEST_TPID", Tag: "TEST_DEST", Prefix: "+492"}
|
||||
tpd3 := TpDestination{Tpid: "TEST_TPID", Tag: "TEST_DEST", Prefix: "+493"}
|
||||
tpd1 := TpDestinationMdl{Tpid: "TEST_TPID", Tag: "TEST_DEST", Prefix: "+491"}
|
||||
tpd2 := TpDestinationMdl{Tpid: "TEST_TPID", Tag: "TEST_DEST", Prefix: "+492"}
|
||||
tpd3 := TpDestinationMdl{Tpid: "TEST_TPID", Tag: "TEST_DEST", Prefix: "+493"}
|
||||
eTPDestinations := []*utils.TPDestination{{TPid: "TEST_TPID", ID: "TEST_DEST",
|
||||
Prefixes: []string{"+491", "+492", "+493"}}}
|
||||
if tpDst := TpDestinations([]TpDestination{tpd1, tpd2, tpd3}).AsTPDestinations(); !reflect.DeepEqual(eTPDestinations, tpDst) {
|
||||
if tpDst := TpDestinations([]TpDestinationMdl{tpd1, tpd2, tpd3}).AsTPDestinations(); !reflect.DeepEqual(eTPDestinations, tpDst) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eTPDestinations, tpDst)
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ func TestAPItoModelTimings(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut = TpTimings{
|
||||
TpTiming{
|
||||
TpTimingMdl{
|
||||
Tpid: "TPid1",
|
||||
Months: "1;2;3;4",
|
||||
Tag: "ID1",
|
||||
@@ -396,12 +396,12 @@ func TestAPItoModelTimings(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut = TpTimings{
|
||||
TpTiming{
|
||||
TpTimingMdl{
|
||||
Tpid: "TPid1",
|
||||
Months: "1;2;3;4",
|
||||
Tag: "ID1",
|
||||
},
|
||||
TpTiming{
|
||||
TpTimingMdl{
|
||||
Tpid: "TPid2",
|
||||
Tag: "ID2",
|
||||
Months: "1;2;3;4",
|
||||
@@ -477,13 +477,13 @@ func TestAPItoModelRates(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut = TpRates{
|
||||
TpRate{
|
||||
TpRateMdl{
|
||||
Tpid: "TPid",
|
||||
Tag: "SomeID",
|
||||
ConnectFee: 0.7,
|
||||
Rate: 0.8,
|
||||
},
|
||||
TpRate{
|
||||
TpRateMdl{
|
||||
Tpid: "TPid",
|
||||
Tag: "SomeID",
|
||||
ConnectFee: 0.77,
|
||||
@@ -501,7 +501,7 @@ func TestAPItoModelRates(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut = TpRates{
|
||||
TpRate{
|
||||
TpRateMdl{
|
||||
Tpid: "TPid",
|
||||
Tag: "SomeID",
|
||||
},
|
||||
@@ -552,7 +552,7 @@ func TestTPDestinationRateAsExportSlice(t *testing.T) {
|
||||
DestinationRates: []*utils.DestinationRate{},
|
||||
}
|
||||
eOut := TpDestinationRates{
|
||||
TpDestinationRate{
|
||||
TpDestinationRateMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_DSTRATE",
|
||||
},
|
||||
@@ -587,7 +587,7 @@ func TestAPItoModelDestinationRates(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut := TpDestinationRates{
|
||||
TpDestinationRate{
|
||||
TpDestinationRateMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_DSTRATE",
|
||||
DestinationsTag: "TEST_DEST1",
|
||||
@@ -595,7 +595,7 @@ func TestAPItoModelDestinationRates(t *testing.T) {
|
||||
RoundingMethod: "*up",
|
||||
RoundingDecimals: 4,
|
||||
},
|
||||
TpDestinationRate{
|
||||
TpDestinationRateMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_DSTRATE",
|
||||
DestinationsTag: "TEST_DEST2",
|
||||
@@ -619,7 +619,7 @@ func TestTpDestinationRatesAsTPDestinationRates(t *testing.T) {
|
||||
}
|
||||
|
||||
pts = TpDestinationRates{
|
||||
TpDestinationRate{
|
||||
TpDestinationRateMdl{
|
||||
Id: 66,
|
||||
Tpid: "Tpid",
|
||||
Tag: "Tag",
|
||||
@@ -788,7 +788,7 @@ func TestTPRatingPlanAsExportSlice(t *testing.T) {
|
||||
|
||||
func TestAPItoModelRatingPlan(t *testing.T) {
|
||||
rp := &utils.TPRatingPlan{}
|
||||
eOut := TpRatingPlans{TpRatingPlan{}}
|
||||
eOut := TpRatingPlans{TpRatingPlanMdl{}}
|
||||
if rcv := APItoModelRatingPlan(rp); !reflect.DeepEqual(eOut, rcv) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(eOut), utils.ToJSON(rcv))
|
||||
}
|
||||
@@ -807,14 +807,14 @@ func TestAPItoModelRatingPlan(t *testing.T) {
|
||||
}}
|
||||
|
||||
eOut = TpRatingPlans{
|
||||
TpRatingPlan{
|
||||
TpRatingPlanMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_RPLAN",
|
||||
DestratesTag: "TEST_DSTRATE1",
|
||||
TimingTag: "TEST_TIMING1",
|
||||
Weight: 10.0,
|
||||
},
|
||||
TpRatingPlan{
|
||||
TpRatingPlanMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_RPLAN",
|
||||
DestratesTag: "TEST_DSTRATE2",
|
||||
@@ -830,7 +830,7 @@ func TestAPItoModelRatingPlan(t *testing.T) {
|
||||
ID: "TEST_RPLAN",
|
||||
}
|
||||
eOut = TpRatingPlans{
|
||||
TpRatingPlan{
|
||||
TpRatingPlanMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_RPLAN",
|
||||
},
|
||||
@@ -859,7 +859,7 @@ func TestAPItoModelRatingPlans(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut := TpRatingPlans{
|
||||
TpRatingPlan{
|
||||
TpRatingPlanMdl{
|
||||
Tag: "ID",
|
||||
Tpid: "TPid",
|
||||
DestratesTag: "DestinationRatesId",
|
||||
@@ -934,7 +934,7 @@ func TestAPItoModelRatingProfile(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut := TpRatingProfiles{
|
||||
TpRatingProfile{
|
||||
TpRatingProfileMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Loadid: "TEST_LOADID",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -944,7 +944,7 @@ func TestAPItoModelRatingProfile(t *testing.T) {
|
||||
FallbackSubjects: "subj1;subj2",
|
||||
ActivationTime: "2014-01-14T00:00:00Z",
|
||||
},
|
||||
TpRatingProfile{
|
||||
TpRatingProfileMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Loadid: "TEST_LOADID",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -966,7 +966,7 @@ func TestAPItoModelRatingProfile(t *testing.T) {
|
||||
Subject: "*any",
|
||||
}
|
||||
eOut = TpRatingProfiles{
|
||||
TpRatingProfile{
|
||||
TpRatingProfileMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Loadid: "TEST_LOADID",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -1001,14 +1001,14 @@ func TestAPItoModelRatingProfiles(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut := TpRatingProfiles{
|
||||
TpRatingProfile{
|
||||
TpRatingProfileMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Loadid: "TEST_LOADID",
|
||||
Tenant: "cgrates.org",
|
||||
Category: "call",
|
||||
Subject: "*any",
|
||||
},
|
||||
TpRatingProfile{
|
||||
TpRatingProfileMdl{
|
||||
Tpid: "TEST_TPID2",
|
||||
Loadid: "TEST_LOADID2",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -1129,14 +1129,14 @@ func TestAPItoModelSharedGroups(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut := TpSharedGroups{
|
||||
TpSharedGroup{
|
||||
TpSharedGroupMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "SHARED_GROUP_TEST",
|
||||
Account: "*any",
|
||||
Strategy: "*highest",
|
||||
RatingSubject: "special1",
|
||||
},
|
||||
TpSharedGroup{
|
||||
TpSharedGroupMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "SHARED_GROUP_TEST",
|
||||
Account: "*second",
|
||||
@@ -1154,7 +1154,7 @@ func TestAPItoModelSharedGroups(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut = TpSharedGroups{
|
||||
TpSharedGroup{
|
||||
TpSharedGroupMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "SHARED_GROUP_TEST",
|
||||
},
|
||||
@@ -1193,28 +1193,28 @@ func TestAPItoModelSharedGroups(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut = TpSharedGroups{
|
||||
TpSharedGroup{
|
||||
TpSharedGroupMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "SHARED_GROUP_TEST",
|
||||
Account: "*any",
|
||||
Strategy: "*highest",
|
||||
RatingSubject: "special1",
|
||||
},
|
||||
TpSharedGroup{
|
||||
TpSharedGroupMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "SHARED_GROUP_TEST",
|
||||
Account: "*second",
|
||||
Strategy: "*highest",
|
||||
RatingSubject: "special2",
|
||||
},
|
||||
TpSharedGroup{
|
||||
TpSharedGroupMdl{
|
||||
Tpid: "TEST_TPID2",
|
||||
Tag: "SHARED_GROUP_TEST2",
|
||||
Account: "*any",
|
||||
Strategy: "*highest",
|
||||
RatingSubject: "special1",
|
||||
},
|
||||
TpSharedGroup{
|
||||
TpSharedGroupMdl{
|
||||
Tpid: "TEST_TPID2",
|
||||
Tag: "SHARED_GROUP_TEST2",
|
||||
Account: "second",
|
||||
@@ -1281,14 +1281,14 @@ func TestAPItoModelActionPlan(t *testing.T) {
|
||||
}
|
||||
|
||||
eOut := TpActionPlans{
|
||||
TpActionPlan{
|
||||
TpActionPlanMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "PACKAGE_10",
|
||||
ActionsTag: "TOPUP_RST_10",
|
||||
TimingTag: "ASAP",
|
||||
Weight: 10,
|
||||
},
|
||||
TpActionPlan{
|
||||
TpActionPlanMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "PACKAGE_10",
|
||||
ActionsTag: "TOPUP_RST_5",
|
||||
@@ -1304,7 +1304,7 @@ func TestAPItoModelActionPlan(t *testing.T) {
|
||||
ID: "PACKAGE_10",
|
||||
}
|
||||
eOut = TpActionPlans{
|
||||
TpActionPlan{
|
||||
TpActionPlanMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "PACKAGE_10",
|
||||
},
|
||||
@@ -1336,14 +1336,14 @@ func TestAPItoModelActionPlans(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut := TpActionPlans{
|
||||
TpActionPlan{
|
||||
TpActionPlanMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "PACKAGE_10",
|
||||
ActionsTag: "TOPUP_RST_10",
|
||||
TimingTag: "ASAP",
|
||||
Weight: 10,
|
||||
},
|
||||
TpActionPlan{
|
||||
TpActionPlanMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "PACKAGE_10",
|
||||
ActionsTag: "TOPUP_RST_5",
|
||||
@@ -1361,7 +1361,7 @@ func TestAPItoModelActionPlans(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut = TpActionPlans{
|
||||
TpActionPlan{
|
||||
TpActionPlanMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "PACKAGE_10",
|
||||
},
|
||||
@@ -1489,7 +1489,7 @@ func TestAPItoModelActionTrigger(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut := TpActionTriggers{
|
||||
TpActionTrigger{
|
||||
TpActionTriggerMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "STANDARD_TRIGGERS",
|
||||
UniqueId: "1",
|
||||
@@ -1509,7 +1509,7 @@ func TestAPItoModelActionTrigger(t *testing.T) {
|
||||
ActionsTag: "LOG_WARNING",
|
||||
Weight: 10,
|
||||
},
|
||||
TpActionTrigger{
|
||||
TpActionTriggerMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "STANDARD_TRIGGERS",
|
||||
UniqueId: "2",
|
||||
@@ -1539,7 +1539,7 @@ func TestAPItoModelActionTrigger(t *testing.T) {
|
||||
ID: "STANDARD_TRIGGERS",
|
||||
}
|
||||
eOut = TpActionTriggers{
|
||||
TpActionTrigger{
|
||||
TpActionTriggerMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "STANDARD_TRIGGERS",
|
||||
},
|
||||
@@ -1596,14 +1596,14 @@ func TestAPItoModelActionTriggers(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut := TpActionTriggers{
|
||||
TpActionTrigger{
|
||||
TpActionTriggerMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "STANDARD_TRIGGERS",
|
||||
UniqueId: "1",
|
||||
ThresholdType: "*min_balance",
|
||||
Weight: 0.7,
|
||||
},
|
||||
TpActionTrigger{
|
||||
TpActionTriggerMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "STANDARD_TRIGGERS",
|
||||
UniqueId: "2",
|
||||
@@ -1626,7 +1626,7 @@ func TestAPItoModelAction(t *testing.T) {
|
||||
ID: "TEST_ACTIONS",
|
||||
}
|
||||
eOut := TpActions{
|
||||
TpAction{
|
||||
TpActionMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_ACTIONS",
|
||||
},
|
||||
@@ -1665,7 +1665,7 @@ func TestAPItoModelAction(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut = TpActions{
|
||||
TpAction{
|
||||
TpActionMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_ACTIONS",
|
||||
BalanceType: "*monetary",
|
||||
@@ -1679,7 +1679,7 @@ func TestAPItoModelAction(t *testing.T) {
|
||||
Weight: 10,
|
||||
Action: "*topup_reset",
|
||||
},
|
||||
TpAction{
|
||||
TpActionMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_ACTIONS",
|
||||
Action: "*http_post",
|
||||
@@ -1710,11 +1710,11 @@ func TestAPItoModelActions(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut := TpActions{
|
||||
TpAction{
|
||||
TpActionMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_ACTIONS",
|
||||
},
|
||||
TpAction{
|
||||
TpActionMdl{
|
||||
Tpid: "TEST_TPID2",
|
||||
Tag: "TEST_ACTIONS2",
|
||||
},
|
||||
@@ -1750,7 +1750,7 @@ func TestAPItoModelActions(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut = TpActions{
|
||||
TpAction{
|
||||
TpActionMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_ACTIONS",
|
||||
BalanceType: "*monetary",
|
||||
@@ -1764,7 +1764,7 @@ func TestAPItoModelActions(t *testing.T) {
|
||||
Weight: 10,
|
||||
Action: "*topup_reset",
|
||||
},
|
||||
TpAction{
|
||||
TpActionMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tag: "TEST_ACTIONS",
|
||||
Action: "*http_post",
|
||||
@@ -1780,7 +1780,7 @@ func TestAPItoModelActions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTpResourcesAsTpResources(t *testing.T) {
|
||||
tps := []*TpResource{
|
||||
tps := []*TpResourceMdl{
|
||||
{
|
||||
Tpid: "TEST_TPID",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -1918,7 +1918,7 @@ func TestAPItoModelResource(t *testing.T) {
|
||||
ThresholdIDs: []string{"TRes1"},
|
||||
AllocationMessage: "test",
|
||||
}
|
||||
expModel := &TpResource{
|
||||
expModel := &TpResourceMdl{
|
||||
Tpid: testTPID,
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ResGroup1",
|
||||
@@ -1938,7 +1938,7 @@ func TestAPItoModelResource(t *testing.T) {
|
||||
|
||||
func TestTPStatsAsTPStats(t *testing.T) {
|
||||
tps := TpStats{
|
||||
&TpStat{
|
||||
&TpStatMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Stats1",
|
||||
@@ -1952,7 +1952,7 @@ func TestTPStatsAsTPStats(t *testing.T) {
|
||||
Blocker: true,
|
||||
Weight: 20.0,
|
||||
},
|
||||
&TpStat{
|
||||
&TpStatMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Stats1",
|
||||
@@ -1967,7 +1967,7 @@ func TestTPStatsAsTPStats(t *testing.T) {
|
||||
Blocker: true,
|
||||
Weight: 20.0,
|
||||
},
|
||||
&TpStat{
|
||||
&TpStatMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Tenant: "itsyscom.com",
|
||||
ID: "Stats1",
|
||||
@@ -2139,7 +2139,7 @@ func TestAPItoModelStats(t *testing.T) {
|
||||
}
|
||||
rcv := APItoModelStats(tpS)
|
||||
eRcv := TpStats{
|
||||
&TpStat{
|
||||
&TpStatMdl{
|
||||
Tpid: "TPS1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Stat1",
|
||||
@@ -2154,7 +2154,7 @@ func TestAPItoModelStats(t *testing.T) {
|
||||
Weight: 20.0,
|
||||
ThresholdIDs: "Th1",
|
||||
},
|
||||
&TpStat{
|
||||
&TpStatMdl{
|
||||
Tpid: "TPS1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Stat1",
|
||||
@@ -2169,7 +2169,7 @@ func TestAPItoModelStats(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTPThresholdsAsTPThreshold(t *testing.T) {
|
||||
tps := []*TpThreshold{
|
||||
tps := []*TpThresholdMdl{
|
||||
{
|
||||
Tpid: "TEST_TPID",
|
||||
ID: "Threhold",
|
||||
@@ -2243,7 +2243,7 @@ func TestAPItoModelAccountActions(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut := TpAccountActions{
|
||||
TpAccountAction{
|
||||
TpAccountActionMdl{
|
||||
Tpid: "TEST_TPID",
|
||||
Loadid: "TEST_LOADID",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -2251,7 +2251,7 @@ func TestAPItoModelAccountActions(t *testing.T) {
|
||||
ActionPlanTag: "PACKAGE_10_SHARED_A_5",
|
||||
ActionTriggersTag: "STANDARD_TRIGGERS",
|
||||
},
|
||||
TpAccountAction{
|
||||
TpAccountActionMdl{
|
||||
Tpid: "TEST_TPID2",
|
||||
Loadid: "TEST_LOADID2",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -2537,7 +2537,7 @@ func TestThresholdProfileToAPI(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTPFilterAsTPFilter(t *testing.T) {
|
||||
tps := []*TpFilter{
|
||||
tps := []*TpFilterMdl{
|
||||
{
|
||||
Tpid: "TEST_TPID",
|
||||
ID: "Filter1",
|
||||
@@ -2567,7 +2567,7 @@ func TestTPFilterAsTPFilter(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTPFilterAsTPFilterWithDynValues(t *testing.T) {
|
||||
tps := []*TpFilter{
|
||||
tps := []*TpFilterMdl{
|
||||
{
|
||||
Tpid: "TEST_TPID",
|
||||
ID: "Filter1",
|
||||
@@ -2602,7 +2602,7 @@ func TestTPFilterAsTPFilterWithDynValues(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTPFilterAsTPFilter2(t *testing.T) {
|
||||
tps := []*TpFilter{
|
||||
tps := []*TpFilterMdl{
|
||||
{
|
||||
Tpid: "TEST_TPID",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -2681,13 +2681,13 @@ func TestAPItoModelTPFilter(t *testing.T) {
|
||||
},
|
||||
}
|
||||
eOut := TpFilterS{
|
||||
&TpFilter{
|
||||
&TpFilterMdl{
|
||||
ID: "someID",
|
||||
Type: "*prefix",
|
||||
Element: "Account",
|
||||
Values: "1010",
|
||||
},
|
||||
&TpFilter{
|
||||
&TpFilterMdl{
|
||||
ID: "someID",
|
||||
Type: "*prefix",
|
||||
Element: "Account",
|
||||
@@ -2990,7 +2990,7 @@ func TestAPItoModelTPAttribute(t *testing.T) {
|
||||
Weight: 20,
|
||||
}
|
||||
expected := TPAttributes{
|
||||
&TPAttribute{
|
||||
&TPAttributeMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
@@ -3032,7 +3032,7 @@ func TestCsvDumpForAttributeModels(t *testing.T) {
|
||||
Weight: 20,
|
||||
}
|
||||
expected := TPAttributes{
|
||||
&TPAttribute{
|
||||
&TPAttributeMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
@@ -3043,7 +3043,7 @@ func TestCsvDumpForAttributeModels(t *testing.T) {
|
||||
ActivationInterval: "2014-07-14T14:35:00Z",
|
||||
Weight: 20,
|
||||
},
|
||||
&TPAttribute{
|
||||
&TPAttributeMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
@@ -3069,7 +3069,7 @@ func TestCsvDumpForAttributeModels(t *testing.T) {
|
||||
|
||||
func TestModelAsTPAttribute(t *testing.T) {
|
||||
models := TPAttributes{
|
||||
&TPAttribute{
|
||||
&TPAttributeMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
@@ -3206,7 +3206,7 @@ func TestAPItoModelTPCharger(t *testing.T) {
|
||||
Weight: 20,
|
||||
}
|
||||
expected := TPChargers{
|
||||
&TPCharger{
|
||||
&TPChargerMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Charger1",
|
||||
@@ -3216,7 +3216,7 @@ func TestAPItoModelTPCharger(t *testing.T) {
|
||||
ActivationInterval: "2014-07-14T14:35:00Z",
|
||||
Weight: 20,
|
||||
},
|
||||
&TPCharger{
|
||||
&TPChargerMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Charger1",
|
||||
@@ -3247,7 +3247,7 @@ func TestAPItoModelTPCharger2(t *testing.T) {
|
||||
Weight: 20,
|
||||
}
|
||||
expected := TPChargers{
|
||||
&TPCharger{
|
||||
&TPChargerMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Charger1",
|
||||
@@ -3257,7 +3257,7 @@ func TestAPItoModelTPCharger2(t *testing.T) {
|
||||
ActivationInterval: "2014-07-14T14:35:00Z",
|
||||
Weight: 20,
|
||||
},
|
||||
&TPCharger{
|
||||
&TPChargerMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Charger1",
|
||||
@@ -3287,7 +3287,7 @@ func TestAPItoModelTPCharger3(t *testing.T) {
|
||||
Weight: 20,
|
||||
}
|
||||
expected := TPChargers{
|
||||
&TPCharger{
|
||||
&TPChargerMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Charger1",
|
||||
@@ -3297,7 +3297,7 @@ func TestAPItoModelTPCharger3(t *testing.T) {
|
||||
ActivationInterval: "2014-07-14T14:35:00Z",
|
||||
Weight: 20,
|
||||
},
|
||||
&TPCharger{
|
||||
&TPChargerMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Charger1",
|
||||
@@ -3325,7 +3325,7 @@ func TestAPItoModelTPCharger4(t *testing.T) {
|
||||
Weight: 20,
|
||||
}
|
||||
expected := TPChargers{
|
||||
&TPCharger{
|
||||
&TPChargerMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Charger1",
|
||||
@@ -3356,7 +3356,7 @@ func TestAPItoModelTPCharger5(t *testing.T) {
|
||||
Weight: 20,
|
||||
}
|
||||
expected := TPChargers{
|
||||
&TPCharger{
|
||||
&TPChargerMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Charger1",
|
||||
@@ -3386,7 +3386,7 @@ func TestAPItoModelTPCharger6(t *testing.T) {
|
||||
Weight: 20,
|
||||
}
|
||||
expected := TPChargers{
|
||||
&TPCharger{
|
||||
&TPChargerMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Charger1",
|
||||
@@ -3403,7 +3403,7 @@ func TestAPItoModelTPCharger6(t *testing.T) {
|
||||
|
||||
func TestModelAsTPChargers(t *testing.T) {
|
||||
models := TPChargers{
|
||||
&TPCharger{
|
||||
&TPChargerMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Charger1",
|
||||
@@ -3448,7 +3448,7 @@ func TestModelAsTPChargers(t *testing.T) {
|
||||
|
||||
func TestModelAsTPChargers2(t *testing.T) {
|
||||
models := TPChargers{
|
||||
&TPCharger{
|
||||
&TPChargerMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Charger1",
|
||||
@@ -3638,7 +3638,7 @@ func TestAPItoModelTPDispatcher(t *testing.T) {
|
||||
},
|
||||
}
|
||||
expected := TPDispatcherProfiles{
|
||||
&TPDispatcherProfile{
|
||||
&TPDispatcherProfileMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Dsp",
|
||||
@@ -3652,7 +3652,7 @@ func TestAPItoModelTPDispatcher(t *testing.T) {
|
||||
ConnBlocker: false,
|
||||
ConnParameters: "192.168.54.203",
|
||||
},
|
||||
&TPDispatcherProfile{
|
||||
&TPDispatcherProfileMdl{
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Dsp",
|
||||
@@ -3683,7 +3683,7 @@ func TestTPDispatcherHostsAsTPDispatcherHosts(t *testing.T) {
|
||||
}
|
||||
|
||||
tps = &TPDispatcherHosts{
|
||||
&TPDispatcherHost{
|
||||
&TPDispatcherHostMdl{
|
||||
ID: "ID1",
|
||||
Tenant: "Tenant1",
|
||||
}}
|
||||
@@ -3692,7 +3692,7 @@ func TestTPDispatcherHostsAsTPDispatcherHosts(t *testing.T) {
|
||||
}
|
||||
|
||||
tps = &TPDispatcherHosts{
|
||||
&TPDispatcherHost{
|
||||
&TPDispatcherHostMdl{
|
||||
Address: "Address1",
|
||||
ID: "ID1",
|
||||
Tenant: "Tenant1",
|
||||
@@ -3713,7 +3713,7 @@ func TestTPDispatcherHostsAsTPDispatcherHosts(t *testing.T) {
|
||||
}
|
||||
|
||||
tps = &TPDispatcherHosts{
|
||||
&TPDispatcherHost{
|
||||
&TPDispatcherHostMdl{
|
||||
Address: "Address2",
|
||||
ID: "ID2",
|
||||
Tenant: "Tenant2",
|
||||
@@ -3734,7 +3734,7 @@ func TestTPDispatcherHostsAsTPDispatcherHosts(t *testing.T) {
|
||||
}
|
||||
|
||||
tps = &TPDispatcherHosts{
|
||||
&TPDispatcherHost{
|
||||
&TPDispatcherHostMdl{
|
||||
Address: "Address3",
|
||||
ID: "ID3",
|
||||
Tenant: "Tenant3",
|
||||
@@ -3756,7 +3756,7 @@ func TestTPDispatcherHostsAsTPDispatcherHosts(t *testing.T) {
|
||||
}
|
||||
|
||||
tps = &TPDispatcherHosts{
|
||||
&TPDispatcherHost{
|
||||
&TPDispatcherHostMdl{
|
||||
Address: "Address4",
|
||||
ID: "ID4",
|
||||
Tenant: "Tenant4",
|
||||
@@ -3794,7 +3794,7 @@ func TestAPItoModelTPDispatcherHost(t *testing.T) {
|
||||
Transport: "*json",
|
||||
},
|
||||
}
|
||||
eOut := &TPDispatcherHost{
|
||||
eOut := &TPDispatcherHostMdl{
|
||||
Address: "Address1",
|
||||
Transport: "*json",
|
||||
Tenant: "Tenant",
|
||||
@@ -3883,7 +3883,7 @@ func TestDispatcherHostToAPI(t *testing.T) {
|
||||
|
||||
func TestTPRoutesAsTPRouteProfile(t *testing.T) {
|
||||
mdl := TPRoutes{
|
||||
&TpRoute{
|
||||
&TpRouteMdl{
|
||||
PK: 1,
|
||||
Tpid: "TP",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -3904,7 +3904,7 @@ func TestTPRoutesAsTPRouteProfile(t *testing.T) {
|
||||
Weight: 10.0,
|
||||
CreatedAt: time.Time{},
|
||||
},
|
||||
&TpRoute{
|
||||
&TpRouteMdl{
|
||||
PK: 2,
|
||||
Tpid: "TP",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -3960,7 +3960,7 @@ func TestTPRoutesAsTPRouteProfile(t *testing.T) {
|
||||
}
|
||||
|
||||
mdlReverse := TPRoutes{
|
||||
&TpRoute{
|
||||
&TpRouteMdl{
|
||||
PK: 2,
|
||||
Tpid: "TP",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -3981,7 +3981,7 @@ func TestTPRoutesAsTPRouteProfile(t *testing.T) {
|
||||
Weight: 0,
|
||||
CreatedAt: time.Time{},
|
||||
},
|
||||
&TpRoute{
|
||||
&TpRouteMdl{
|
||||
PK: 1,
|
||||
Tpid: "TP",
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
// Structs here are one to one mapping of the tables and fields
|
||||
// to be used by gorm orm
|
||||
|
||||
type TpTiming struct {
|
||||
type TpTimingMdl struct {
|
||||
Id int64
|
||||
Tpid string
|
||||
Tag string `index:"0" re:"\w+\s*,\s*"`
|
||||
@@ -41,7 +41,7 @@ type TpTiming struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpDestination struct {
|
||||
type TpDestinationMdl struct {
|
||||
Id int64
|
||||
Tpid string
|
||||
Tag string `index:"0" re:"\w+\s*,\s*"`
|
||||
@@ -49,7 +49,7 @@ type TpDestination struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpRate struct {
|
||||
type TpRateMdl struct {
|
||||
Id int64
|
||||
Tpid string
|
||||
Tag string `index:"0" re:"\w+\s*"`
|
||||
@@ -61,7 +61,7 @@ type TpRate struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpDestinationRate struct {
|
||||
type TpDestinationRateMdl struct {
|
||||
Id int64
|
||||
Tpid string
|
||||
Tag string `index:"0" re:"\w+\s*"`
|
||||
@@ -74,7 +74,7 @@ type TpDestinationRate struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpRatingPlan struct {
|
||||
type TpRatingPlanMdl struct {
|
||||
Id int64
|
||||
Tpid string
|
||||
Tag string `index:"0" re:"\w+\s*,\s*"`
|
||||
@@ -84,7 +84,7 @@ type TpRatingPlan struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpRatingProfile struct {
|
||||
type TpRatingProfileMdl struct {
|
||||
Id int64
|
||||
Tpid string
|
||||
Loadid string
|
||||
@@ -97,7 +97,7 @@ type TpRatingProfile struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpAction struct {
|
||||
type TpActionMdl struct {
|
||||
Id int64
|
||||
Tpid string
|
||||
Tag string `index:"0" re:"\w+\s*"`
|
||||
@@ -120,7 +120,7 @@ type TpAction struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpActionPlan struct {
|
||||
type TpActionPlanMdl struct {
|
||||
Id int64
|
||||
Tpid string
|
||||
Tag string `index:"0" re:"\w+\s*,\s*"`
|
||||
@@ -130,7 +130,7 @@ type TpActionPlan struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpActionTrigger struct {
|
||||
type TpActionTriggerMdl struct {
|
||||
Id int64
|
||||
Tpid string
|
||||
Tag string `index:"0" re:"\w+"`
|
||||
@@ -157,7 +157,7 @@ type TpActionTrigger struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpAccountAction struct {
|
||||
type TpAccountActionMdl struct {
|
||||
Id int64
|
||||
Tpid string
|
||||
Loadid string
|
||||
@@ -170,7 +170,7 @@ type TpAccountAction struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
func (aa *TpAccountAction) SetAccountActionId(id string) error {
|
||||
func (aa *TpAccountActionMdl) SetAccountActionId(id string) error {
|
||||
ids := strings.Split(id, utils.CONCATENATED_KEY_SEP)
|
||||
if len(ids) != 3 {
|
||||
return fmt.Errorf("Wrong TP Account Action Id: %s", id)
|
||||
@@ -181,11 +181,11 @@ func (aa *TpAccountAction) SetAccountActionId(id string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (aa *TpAccountAction) GetAccountActionId() string {
|
||||
func (aa *TpAccountActionMdl) GetAccountActionId() string {
|
||||
return utils.ConcatenatedKey(aa.Tenant, aa.Account)
|
||||
}
|
||||
|
||||
type TpSharedGroup struct {
|
||||
type TpSharedGroupMdl struct {
|
||||
Id int64
|
||||
Tpid string
|
||||
Tag string `index:"0" re:"\w+\s*"`
|
||||
@@ -195,7 +195,7 @@ type TpSharedGroup struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpResource struct {
|
||||
type TpResourceMdl struct {
|
||||
PK uint `gorm:"primary_key"`
|
||||
Tpid string
|
||||
Tenant string `index:"0" re:""`
|
||||
@@ -212,7 +212,7 @@ type TpResource struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpStat struct {
|
||||
type TpStatMdl struct {
|
||||
PK uint `gorm:"primary_key"`
|
||||
Tpid string
|
||||
Tenant string `index:"0" re:""`
|
||||
@@ -231,7 +231,7 @@ type TpStat struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpThreshold struct {
|
||||
type TpThresholdMdl struct {
|
||||
PK uint `gorm:"primary_key"`
|
||||
Tpid string
|
||||
Tenant string `index:"0" re:""`
|
||||
@@ -248,7 +248,7 @@ type TpThreshold struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TpFilter struct {
|
||||
type TpFilterMdl struct {
|
||||
PK uint `gorm:"primary_key"`
|
||||
Tpid string
|
||||
Tenant string `index:"0" re:""`
|
||||
@@ -348,7 +348,7 @@ func (t TBLVersion) TableName() string {
|
||||
return utils.TBLVersions
|
||||
}
|
||||
|
||||
type TpRoute struct {
|
||||
type TpRouteMdl struct {
|
||||
PK uint `gorm:"primary_key"`
|
||||
Tpid string
|
||||
Tenant string `index:"0" re:""`
|
||||
@@ -371,7 +371,7 @@ type TpRoute struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TPAttribute struct {
|
||||
type TPAttributeMdl struct {
|
||||
PK uint `gorm:"primary_key"`
|
||||
Tpid string
|
||||
Tenant string `index:"0" re:""`
|
||||
@@ -388,7 +388,7 @@ type TPAttribute struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TPCharger struct {
|
||||
type TPChargerMdl struct {
|
||||
PK uint `gorm:"primary_key"`
|
||||
Tpid string
|
||||
Tenant string `index:"0" re:""`
|
||||
@@ -401,7 +401,7 @@ type TPCharger struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TPDispatcherProfile struct {
|
||||
type TPDispatcherProfileMdl struct {
|
||||
PK uint `gorm:"primary_key"`
|
||||
Tpid string //
|
||||
Tenant string `index:"0" re:""`
|
||||
@@ -420,7 +420,7 @@ type TPDispatcherProfile struct {
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TPDispatcherHost struct {
|
||||
type TPDispatcherHostMdl struct {
|
||||
PK uint `gorm:"primary_key"`
|
||||
Tpid string //
|
||||
Tenant string `index:"0" re:""`
|
||||
|
||||
@@ -409,8 +409,8 @@ func (csvs *CSVStorage) proccesData(listType interface{}, fns []string, process
|
||||
|
||||
func (csvs *CSVStorage) GetTPTimings(tpid, id string) ([]*utils.ApierTPTiming, error) {
|
||||
var tpTimings TpTimings
|
||||
if err := csvs.proccesData(TpTiming{}, csvs.timingsFn, func(tp interface{}) {
|
||||
tm := tp.(TpTiming)
|
||||
if err := csvs.proccesData(TpTimingMdl{}, csvs.timingsFn, func(tp interface{}) {
|
||||
tm := tp.(TpTimingMdl)
|
||||
tm.Tpid = tpid
|
||||
tpTimings = append(tpTimings, tm)
|
||||
}); err != nil {
|
||||
@@ -421,8 +421,8 @@ func (csvs *CSVStorage) GetTPTimings(tpid, id string) ([]*utils.ApierTPTiming, e
|
||||
|
||||
func (csvs *CSVStorage) GetTPDestinations(tpid, id string) ([]*utils.TPDestination, error) {
|
||||
var tpDests TpDestinations
|
||||
if err := csvs.proccesData(TpDestination{}, csvs.destinationsFn, func(tp interface{}) {
|
||||
d := tp.(TpDestination)
|
||||
if err := csvs.proccesData(TpDestinationMdl{}, csvs.destinationsFn, func(tp interface{}) {
|
||||
d := tp.(TpDestinationMdl)
|
||||
d.Tpid = tpid
|
||||
tpDests = append(tpDests, d)
|
||||
}); err != nil {
|
||||
@@ -433,8 +433,8 @@ func (csvs *CSVStorage) GetTPDestinations(tpid, id string) ([]*utils.TPDestinati
|
||||
|
||||
func (csvs *CSVStorage) GetTPRates(tpid, id string) ([]*utils.TPRateRALs, error) {
|
||||
var tpRates TpRates
|
||||
if err := csvs.proccesData(TpRate{}, csvs.ratesFn, func(tp interface{}) {
|
||||
r := tp.(TpRate)
|
||||
if err := csvs.proccesData(TpRateMdl{}, csvs.ratesFn, func(tp interface{}) {
|
||||
r := tp.(TpRateMdl)
|
||||
r.Tpid = tpid
|
||||
tpRates = append(tpRates, r)
|
||||
}); err != nil {
|
||||
@@ -445,8 +445,8 @@ func (csvs *CSVStorage) GetTPRates(tpid, id string) ([]*utils.TPRateRALs, error)
|
||||
|
||||
func (csvs *CSVStorage) GetTPDestinationRates(tpid, id string, p *utils.Paginator) ([]*utils.TPDestinationRate, error) {
|
||||
var tpDestinationRates TpDestinationRates
|
||||
if err := csvs.proccesData(TpDestinationRate{}, csvs.destinationratesFn, func(tp interface{}) {
|
||||
dr := tp.(TpDestinationRate)
|
||||
if err := csvs.proccesData(TpDestinationRateMdl{}, csvs.destinationratesFn, func(tp interface{}) {
|
||||
dr := tp.(TpDestinationRateMdl)
|
||||
dr.Tpid = tpid
|
||||
tpDestinationRates = append(tpDestinationRates, dr)
|
||||
}); err != nil {
|
||||
@@ -457,8 +457,8 @@ func (csvs *CSVStorage) GetTPDestinationRates(tpid, id string, p *utils.Paginato
|
||||
|
||||
func (csvs *CSVStorage) GetTPRatingPlans(tpid, id string, p *utils.Paginator) ([]*utils.TPRatingPlan, error) {
|
||||
var tpRatingPlans TpRatingPlans
|
||||
if err := csvs.proccesData(TpRatingPlan{}, csvs.destinationratetimingsFn, func(tp interface{}) {
|
||||
rp := tp.(TpRatingPlan)
|
||||
if err := csvs.proccesData(TpRatingPlanMdl{}, csvs.destinationratetimingsFn, func(tp interface{}) {
|
||||
rp := tp.(TpRatingPlanMdl)
|
||||
rp.Tpid = tpid
|
||||
tpRatingPlans = append(tpRatingPlans, rp)
|
||||
}); err != nil {
|
||||
@@ -469,8 +469,8 @@ func (csvs *CSVStorage) GetTPRatingPlans(tpid, id string, p *utils.Paginator) ([
|
||||
|
||||
func (csvs *CSVStorage) GetTPRatingProfiles(filter *utils.TPRatingProfile) ([]*utils.TPRatingProfile, error) {
|
||||
var tpRatingProfiles TpRatingProfiles
|
||||
if err := csvs.proccesData(TpRatingProfile{}, csvs.ratingprofilesFn, func(tp interface{}) {
|
||||
rpf := tp.(TpRatingProfile)
|
||||
if err := csvs.proccesData(TpRatingProfileMdl{}, csvs.ratingprofilesFn, func(tp interface{}) {
|
||||
rpf := tp.(TpRatingProfileMdl)
|
||||
if filter != nil {
|
||||
rpf.Tpid = filter.TPid
|
||||
rpf.Loadid = filter.LoadId
|
||||
@@ -484,8 +484,8 @@ func (csvs *CSVStorage) GetTPRatingProfiles(filter *utils.TPRatingProfile) ([]*u
|
||||
|
||||
func (csvs *CSVStorage) GetTPSharedGroups(tpid, id string) ([]*utils.TPSharedGroups, error) {
|
||||
var tpSharedGroups TpSharedGroups
|
||||
if err := csvs.proccesData(TpSharedGroup{}, csvs.sharedgroupsFn, func(tp interface{}) {
|
||||
sg := tp.(TpSharedGroup)
|
||||
if err := csvs.proccesData(TpSharedGroupMdl{}, csvs.sharedgroupsFn, func(tp interface{}) {
|
||||
sg := tp.(TpSharedGroupMdl)
|
||||
sg.Tpid = tpid
|
||||
tpSharedGroups = append(tpSharedGroups, sg)
|
||||
}); err != nil {
|
||||
@@ -496,8 +496,8 @@ func (csvs *CSVStorage) GetTPSharedGroups(tpid, id string) ([]*utils.TPSharedGro
|
||||
|
||||
func (csvs *CSVStorage) GetTPActions(tpid, id string) ([]*utils.TPActions, error) {
|
||||
var tpActions TpActions
|
||||
if err := csvs.proccesData(TpAction{}, csvs.actionsFn, func(tp interface{}) {
|
||||
a := tp.(TpAction)
|
||||
if err := csvs.proccesData(TpActionMdl{}, csvs.actionsFn, func(tp interface{}) {
|
||||
a := tp.(TpActionMdl)
|
||||
a.Tpid = tpid
|
||||
tpActions = append(tpActions, a)
|
||||
}); err != nil {
|
||||
@@ -508,8 +508,8 @@ func (csvs *CSVStorage) GetTPActions(tpid, id string) ([]*utils.TPActions, error
|
||||
|
||||
func (csvs *CSVStorage) GetTPActionPlans(tpid, id string) ([]*utils.TPActionPlan, error) {
|
||||
var tpActionPlans TpActionPlans
|
||||
if err := csvs.proccesData(TpActionPlan{}, csvs.actiontimingsFn, func(tp interface{}) {
|
||||
ap := tp.(TpActionPlan)
|
||||
if err := csvs.proccesData(TpActionPlanMdl{}, csvs.actiontimingsFn, func(tp interface{}) {
|
||||
ap := tp.(TpActionPlanMdl)
|
||||
ap.Tpid = tpid
|
||||
tpActionPlans = append(tpActionPlans, ap)
|
||||
}); err != nil {
|
||||
@@ -520,8 +520,8 @@ func (csvs *CSVStorage) GetTPActionPlans(tpid, id string) ([]*utils.TPActionPlan
|
||||
|
||||
func (csvs *CSVStorage) GetTPActionTriggers(tpid, id string) ([]*utils.TPActionTriggers, error) {
|
||||
var tpActionTriggers TpActionTriggers
|
||||
if err := csvs.proccesData(TpActionTrigger{}, csvs.actiontriggersFn, func(tp interface{}) {
|
||||
at := tp.(TpActionTrigger)
|
||||
if err := csvs.proccesData(TpActionTriggerMdl{}, csvs.actiontriggersFn, func(tp interface{}) {
|
||||
at := tp.(TpActionTriggerMdl)
|
||||
at.Tpid = tpid
|
||||
tpActionTriggers = append(tpActionTriggers, at)
|
||||
}); err != nil {
|
||||
@@ -532,8 +532,8 @@ func (csvs *CSVStorage) GetTPActionTriggers(tpid, id string) ([]*utils.TPActionT
|
||||
|
||||
func (csvs *CSVStorage) GetTPAccountActions(filter *utils.TPAccountActions) ([]*utils.TPAccountActions, error) {
|
||||
var tpAccountActions TpAccountActions
|
||||
if err := csvs.proccesData(TpAccountAction{}, csvs.accountactionsFn, func(tp interface{}) {
|
||||
aa := tp.(TpAccountAction)
|
||||
if err := csvs.proccesData(TpAccountActionMdl{}, csvs.accountactionsFn, func(tp interface{}) {
|
||||
aa := tp.(TpAccountActionMdl)
|
||||
if filter != nil {
|
||||
aa.Tpid = filter.TPid
|
||||
aa.Loadid = filter.LoadId
|
||||
@@ -547,8 +547,8 @@ func (csvs *CSVStorage) GetTPAccountActions(filter *utils.TPAccountActions) ([]*
|
||||
|
||||
func (csvs *CSVStorage) GetTPResources(tpid, tenant, id string) ([]*utils.TPResourceProfile, error) {
|
||||
var tpResLimits TpResources
|
||||
if err := csvs.proccesData(TpResource{}, csvs.resProfilesFn, func(tp interface{}) {
|
||||
tpLimit := tp.(TpResource)
|
||||
if err := csvs.proccesData(TpResourceMdl{}, csvs.resProfilesFn, func(tp interface{}) {
|
||||
tpLimit := tp.(TpResourceMdl)
|
||||
tpLimit.Tpid = tpid
|
||||
tpResLimits = append(tpResLimits, &tpLimit)
|
||||
}); err != nil {
|
||||
@@ -559,8 +559,8 @@ func (csvs *CSVStorage) GetTPResources(tpid, tenant, id string) ([]*utils.TPReso
|
||||
|
||||
func (csvs *CSVStorage) GetTPStats(tpid, tenant, id string) ([]*utils.TPStatProfile, error) {
|
||||
var tpStats TpStats
|
||||
if err := csvs.proccesData(TpStat{}, csvs.statsFn, func(tp interface{}) {
|
||||
tPstats := tp.(TpStat)
|
||||
if err := csvs.proccesData(TpStatMdl{}, csvs.statsFn, func(tp interface{}) {
|
||||
tPstats := tp.(TpStatMdl)
|
||||
tPstats.Tpid = tpid
|
||||
tpStats = append(tpStats, &tPstats)
|
||||
}); err != nil {
|
||||
@@ -571,8 +571,8 @@ func (csvs *CSVStorage) GetTPStats(tpid, tenant, id string) ([]*utils.TPStatProf
|
||||
|
||||
func (csvs *CSVStorage) GetTPThresholds(tpid, tenant, id string) ([]*utils.TPThresholdProfile, error) {
|
||||
var tpThreshold TpThresholds
|
||||
if err := csvs.proccesData(TpThreshold{}, csvs.thresholdsFn, func(tp interface{}) {
|
||||
tHresholdCfg := tp.(TpThreshold)
|
||||
if err := csvs.proccesData(TpThresholdMdl{}, csvs.thresholdsFn, func(tp interface{}) {
|
||||
tHresholdCfg := tp.(TpThresholdMdl)
|
||||
tHresholdCfg.Tpid = tpid
|
||||
tpThreshold = append(tpThreshold, &tHresholdCfg)
|
||||
}); err != nil {
|
||||
@@ -583,8 +583,8 @@ func (csvs *CSVStorage) GetTPThresholds(tpid, tenant, id string) ([]*utils.TPThr
|
||||
|
||||
func (csvs *CSVStorage) GetTPFilters(tpid, tenant, id string) ([]*utils.TPFilterProfile, error) {
|
||||
var tpFilter TpFilterS
|
||||
if err := csvs.proccesData(TpFilter{}, csvs.filterFn, func(tp interface{}) {
|
||||
fIlterCfg := tp.(TpFilter)
|
||||
if err := csvs.proccesData(TpFilterMdl{}, csvs.filterFn, func(tp interface{}) {
|
||||
fIlterCfg := tp.(TpFilterMdl)
|
||||
fIlterCfg.Tpid = tpid
|
||||
tpFilter = append(tpFilter, &fIlterCfg)
|
||||
}); err != nil {
|
||||
@@ -595,8 +595,8 @@ func (csvs *CSVStorage) GetTPFilters(tpid, tenant, id string) ([]*utils.TPFilter
|
||||
|
||||
func (csvs *CSVStorage) GetTPRoutes(tpid, tenant, id string) ([]*utils.TPRouteProfile, error) {
|
||||
var tpRoutes TPRoutes
|
||||
if err := csvs.proccesData(TpRoute{}, csvs.routeProfilesFn, func(tp interface{}) {
|
||||
suppProfile := tp.(TpRoute)
|
||||
if err := csvs.proccesData(TpRouteMdl{}, csvs.routeProfilesFn, func(tp interface{}) {
|
||||
suppProfile := tp.(TpRouteMdl)
|
||||
suppProfile.Tpid = tpid
|
||||
tpRoutes = append(tpRoutes, &suppProfile)
|
||||
}); err != nil {
|
||||
@@ -607,8 +607,8 @@ func (csvs *CSVStorage) GetTPRoutes(tpid, tenant, id string) ([]*utils.TPRoutePr
|
||||
|
||||
func (csvs *CSVStorage) GetTPAttributes(tpid, tenant, id string) ([]*utils.TPAttributeProfile, error) {
|
||||
var tpAls TPAttributes
|
||||
if err := csvs.proccesData(TPAttribute{}, csvs.attributeProfilesFn, func(tp interface{}) {
|
||||
attributeProfile := tp.(TPAttribute)
|
||||
if err := csvs.proccesData(TPAttributeMdl{}, csvs.attributeProfilesFn, func(tp interface{}) {
|
||||
attributeProfile := tp.(TPAttributeMdl)
|
||||
attributeProfile.Tpid = tpid
|
||||
tpAls = append(tpAls, &attributeProfile)
|
||||
}); err != nil {
|
||||
@@ -619,8 +619,8 @@ func (csvs *CSVStorage) GetTPAttributes(tpid, tenant, id string) ([]*utils.TPAtt
|
||||
|
||||
func (csvs *CSVStorage) GetTPChargers(tpid, tenant, id string) ([]*utils.TPChargerProfile, error) {
|
||||
var tpCPPs TPChargers
|
||||
if err := csvs.proccesData(TPCharger{}, csvs.chargerProfilesFn, func(tp interface{}) {
|
||||
cpp := tp.(TPCharger)
|
||||
if err := csvs.proccesData(TPChargerMdl{}, csvs.chargerProfilesFn, func(tp interface{}) {
|
||||
cpp := tp.(TPChargerMdl)
|
||||
cpp.Tpid = tpid
|
||||
tpCPPs = append(tpCPPs, &cpp)
|
||||
}); err != nil {
|
||||
@@ -631,8 +631,8 @@ func (csvs *CSVStorage) GetTPChargers(tpid, tenant, id string) ([]*utils.TPCharg
|
||||
|
||||
func (csvs *CSVStorage) GetTPDispatcherProfiles(tpid, tenant, id string) ([]*utils.TPDispatcherProfile, error) {
|
||||
var tpDPPs TPDispatcherProfiles
|
||||
if err := csvs.proccesData(TPDispatcherProfile{}, csvs.dispatcherProfilesFn, func(tp interface{}) {
|
||||
dpp := tp.(TPDispatcherProfile)
|
||||
if err := csvs.proccesData(TPDispatcherProfileMdl{}, csvs.dispatcherProfilesFn, func(tp interface{}) {
|
||||
dpp := tp.(TPDispatcherProfileMdl)
|
||||
dpp.Tpid = tpid
|
||||
tpDPPs = append(tpDPPs, &dpp)
|
||||
}); err != nil {
|
||||
@@ -643,8 +643,8 @@ func (csvs *CSVStorage) GetTPDispatcherProfiles(tpid, tenant, id string) ([]*uti
|
||||
|
||||
func (csvs *CSVStorage) GetTPDispatcherHosts(tpid, tenant, id string) ([]*utils.TPDispatcherHost, error) {
|
||||
var tpDDHs TPDispatcherHosts
|
||||
if err := csvs.proccesData(TPDispatcherHost{}, csvs.dispatcherHostsFn, func(tp interface{}) {
|
||||
dpp := tp.(TPDispatcherHost)
|
||||
if err := csvs.proccesData(TPDispatcherHostMdl{}, csvs.dispatcherHostsFn, func(tp interface{}) {
|
||||
dpp := tp.(TPDispatcherHostMdl)
|
||||
dpp.Tpid = tpid
|
||||
tpDDHs = append(tpDDHs, &dpp)
|
||||
}); err != nil {
|
||||
|
||||
@@ -268,7 +268,7 @@ func (self *SQLStorage) SetTPTimings(timings []*utils.ApierTPTiming) error {
|
||||
|
||||
tx := self.db.Begin()
|
||||
for _, timing := range timings {
|
||||
if err := tx.Where(&TpTiming{Tpid: timing.TPid, Tag: timing.ID}).Delete(TpTiming{}).Error; err != nil {
|
||||
if err := tx.Where(&TpTimingMdl{Tpid: timing.TPid, Tag: timing.ID}).Delete(TpTimingMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -289,7 +289,7 @@ func (self *SQLStorage) SetTPDestinations(dests []*utils.TPDestination) error {
|
||||
tx := self.db.Begin()
|
||||
for _, dst := range dests {
|
||||
// Remove previous
|
||||
if err := tx.Where(&TpDestination{Tpid: dst.TPid, Tag: dst.ID}).Delete(TpDestination{}).Error; err != nil {
|
||||
if err := tx.Where(&TpDestinationMdl{Tpid: dst.TPid, Tag: dst.ID}).Delete(TpDestinationMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -313,7 +313,7 @@ func (self *SQLStorage) SetTPRates(rs []*utils.TPRateRALs) error {
|
||||
for _, rate := range rs {
|
||||
if found, _ := m[rate.ID]; !found {
|
||||
m[rate.ID] = true
|
||||
if err := tx.Where(&TpRate{Tpid: rate.TPid, Tag: rate.ID}).Delete(TpRate{}).Error; err != nil {
|
||||
if err := tx.Where(&TpRateMdl{Tpid: rate.TPid, Tag: rate.ID}).Delete(TpRateMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -338,7 +338,7 @@ func (self *SQLStorage) SetTPDestinationRates(drs []*utils.TPDestinationRate) er
|
||||
for _, dRate := range drs {
|
||||
if found, _ := m[dRate.ID]; !found {
|
||||
m[dRate.ID] = true
|
||||
if err := tx.Where(&TpDestinationRate{Tpid: dRate.TPid, Tag: dRate.ID}).Delete(TpDestinationRate{}).Error; err != nil {
|
||||
if err := tx.Where(&TpDestinationRateMdl{Tpid: dRate.TPid, Tag: dRate.ID}).Delete(TpDestinationRateMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -363,7 +363,7 @@ func (self *SQLStorage) SetTPRatingPlans(rps []*utils.TPRatingPlan) error {
|
||||
for _, rPlan := range rps {
|
||||
if found, _ := m[rPlan.ID]; !found {
|
||||
m[rPlan.ID] = true
|
||||
if err := tx.Where(&TpRatingPlan{Tpid: rPlan.TPid, Tag: rPlan.ID}).Delete(TpRatingPlan{}).Error; err != nil {
|
||||
if err := tx.Where(&TpRatingPlanMdl{Tpid: rPlan.TPid, Tag: rPlan.ID}).Delete(TpRatingPlanMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -385,9 +385,9 @@ func (self *SQLStorage) SetTPRatingProfiles(rpfs []*utils.TPRatingProfile) error
|
||||
}
|
||||
tx := self.db.Begin()
|
||||
for _, rpf := range rpfs {
|
||||
if err := tx.Where(&TpRatingProfile{Tpid: rpf.TPid, Loadid: rpf.LoadId,
|
||||
if err := tx.Where(&TpRatingProfileMdl{Tpid: rpf.TPid, Loadid: rpf.LoadId,
|
||||
Tenant: rpf.Tenant, Category: rpf.Category,
|
||||
Subject: rpf.Subject}).Delete(TpRatingProfile{}).Error; err != nil {
|
||||
Subject: rpf.Subject}).Delete(TpRatingProfileMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -411,7 +411,7 @@ func (self *SQLStorage) SetTPSharedGroups(sgs []*utils.TPSharedGroups) error {
|
||||
for _, sGroup := range sgs {
|
||||
if found, _ := m[sGroup.ID]; !found {
|
||||
m[sGroup.ID] = true
|
||||
if err := tx.Where(&TpSharedGroup{Tpid: sGroup.TPid, Tag: sGroup.ID}).Delete(TpSharedGroup{}).Error; err != nil {
|
||||
if err := tx.Where(&TpSharedGroupMdl{Tpid: sGroup.TPid, Tag: sGroup.ID}).Delete(TpSharedGroupMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -436,7 +436,7 @@ func (self *SQLStorage) SetTPActions(acts []*utils.TPActions) error {
|
||||
for _, a := range acts {
|
||||
if found, _ := m[a.ID]; !found {
|
||||
m[a.ID] = true
|
||||
if err := tx.Where(&TpAction{Tpid: a.TPid, Tag: a.ID}).Delete(TpAction{}).Error; err != nil {
|
||||
if err := tx.Where(&TpActionMdl{Tpid: a.TPid, Tag: a.ID}).Delete(TpActionMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -462,7 +462,7 @@ func (self *SQLStorage) SetTPActionPlans(ats []*utils.TPActionPlan) error {
|
||||
for _, aPlan := range ats {
|
||||
if found, _ := m[aPlan.ID]; !found {
|
||||
m[aPlan.ID] = true
|
||||
if err := tx.Where(&TpActionPlan{Tpid: aPlan.TPid, Tag: aPlan.ID}).Delete(TpActionPlan{}).Error; err != nil {
|
||||
if err := tx.Where(&TpActionPlanMdl{Tpid: aPlan.TPid, Tag: aPlan.ID}).Delete(TpActionPlanMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -487,7 +487,7 @@ func (self *SQLStorage) SetTPActionTriggers(ats []*utils.TPActionTriggers) error
|
||||
for _, aTrigger := range ats {
|
||||
if found, _ := m[aTrigger.ID]; !found {
|
||||
m[aTrigger.ID] = true
|
||||
if err := tx.Where(&TpActionTrigger{Tpid: aTrigger.TPid, Tag: aTrigger.ID}).Delete(TpActionTrigger{}).Error; err != nil {
|
||||
if err := tx.Where(&TpActionTriggerMdl{Tpid: aTrigger.TPid, Tag: aTrigger.ID}).Delete(TpActionTriggerMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -514,7 +514,7 @@ func (self *SQLStorage) SetTPAccountActions(aas []*utils.TPAccountActions) error
|
||||
for _, aa := range aas {
|
||||
if found, _ := m[aa.GetId()]; !found {
|
||||
m[aa.GetId()] = true
|
||||
if err := tx.Where(&TpAccountAction{Tpid: aa.TPid, Loadid: aa.LoadId, Tenant: aa.Tenant, Account: aa.Account}).Delete(&TpAccountAction{}).Error; err != nil {
|
||||
if err := tx.Where(&TpAccountActionMdl{Tpid: aa.TPid, Loadid: aa.LoadId, Tenant: aa.Tenant, Account: aa.Account}).Delete(&TpAccountActionMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -536,7 +536,7 @@ func (self *SQLStorage) SetTPResources(rls []*utils.TPResourceProfile) error {
|
||||
tx := self.db.Begin()
|
||||
for _, rl := range rls {
|
||||
// Remove previous
|
||||
if err := tx.Where(&TpResource{Tpid: rl.TPid, ID: rl.ID}).Delete(TpResource{}).Error; err != nil {
|
||||
if err := tx.Where(&TpResourceMdl{Tpid: rl.TPid, ID: rl.ID}).Delete(TpResourceMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -558,7 +558,7 @@ func (self *SQLStorage) SetTPStats(sts []*utils.TPStatProfile) error {
|
||||
tx := self.db.Begin()
|
||||
for _, stq := range sts {
|
||||
// Remove previous
|
||||
if err := tx.Where(&TpStat{Tpid: stq.TPid, ID: stq.ID}).Delete(TpStat{}).Error; err != nil {
|
||||
if err := tx.Where(&TpStatMdl{Tpid: stq.TPid, ID: stq.ID}).Delete(TpStatMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -580,7 +580,7 @@ func (self *SQLStorage) SetTPThresholds(ths []*utils.TPThresholdProfile) error {
|
||||
tx := self.db.Begin()
|
||||
for _, th := range ths {
|
||||
// Remove previous
|
||||
if err := tx.Where(&TpThreshold{Tpid: th.TPid, ID: th.ID}).Delete(TpThreshold{}).Error; err != nil {
|
||||
if err := tx.Where(&TpThresholdMdl{Tpid: th.TPid, ID: th.ID}).Delete(TpThresholdMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -602,7 +602,7 @@ func (self *SQLStorage) SetTPFilters(ths []*utils.TPFilterProfile) error {
|
||||
tx := self.db.Begin()
|
||||
for _, th := range ths {
|
||||
// Remove previous
|
||||
if err := tx.Where(&TpFilter{Tpid: th.TPid, ID: th.ID}).Delete(TpFilter{}).Error; err != nil {
|
||||
if err := tx.Where(&TpFilterMdl{Tpid: th.TPid, ID: th.ID}).Delete(TpFilterMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -624,7 +624,7 @@ func (self *SQLStorage) SetTPRoutes(tpRoutes []*utils.TPRouteProfile) error {
|
||||
tx := self.db.Begin()
|
||||
for _, tpRoute := range tpRoutes {
|
||||
// Remove previous
|
||||
if err := tx.Where(&TpRoute{Tpid: tpRoute.TPid, ID: tpRoute.ID}).Delete(TpRoute{}).Error; err != nil {
|
||||
if err := tx.Where(&TpRouteMdl{Tpid: tpRoute.TPid, ID: tpRoute.ID}).Delete(TpRouteMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -646,7 +646,7 @@ func (self *SQLStorage) SetTPAttributes(tpAttrs []*utils.TPAttributeProfile) err
|
||||
tx := self.db.Begin()
|
||||
for _, stq := range tpAttrs {
|
||||
// Remove previous
|
||||
if err := tx.Where(&TPAttribute{Tpid: stq.TPid, ID: stq.ID}).Delete(TPAttribute{}).Error; err != nil {
|
||||
if err := tx.Where(&TPAttributeMdl{Tpid: stq.TPid, ID: stq.ID}).Delete(TPAttributeMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -668,7 +668,7 @@ func (self *SQLStorage) SetTPChargers(tpCPPs []*utils.TPChargerProfile) error {
|
||||
tx := self.db.Begin()
|
||||
for _, cpp := range tpCPPs {
|
||||
// Remove previous
|
||||
if err := tx.Where(&TPCharger{Tpid: cpp.TPid, ID: cpp.ID}).Delete(TPCharger{}).Error; err != nil {
|
||||
if err := tx.Where(&TPChargerMdl{Tpid: cpp.TPid, ID: cpp.ID}).Delete(TPChargerMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -690,7 +690,7 @@ func (self *SQLStorage) SetTPDispatcherProfiles(tpDPPs []*utils.TPDispatcherProf
|
||||
tx := self.db.Begin()
|
||||
for _, dpp := range tpDPPs {
|
||||
// Remove previous
|
||||
if err := tx.Where(&TPDispatcherProfile{Tpid: dpp.TPid, ID: dpp.ID}).Delete(TPDispatcherProfile{}).Error; err != nil {
|
||||
if err := tx.Where(&TPDispatcherProfileMdl{Tpid: dpp.TPid, ID: dpp.ID}).Delete(TPDispatcherProfileMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -712,7 +712,7 @@ func (self *SQLStorage) SetTPDispatcherHosts(tpDPPs []*utils.TPDispatcherHost) e
|
||||
tx := self.db.Begin()
|
||||
for _, dpp := range tpDPPs {
|
||||
// Remove previous
|
||||
if err := tx.Where(&TPDispatcherHost{Tpid: dpp.TPid, ID: dpp.ID}).Delete(TPDispatcherHost{}).Error; err != nil {
|
||||
if err := tx.Where(&TPDispatcherHostMdl{Tpid: dpp.TPid, ID: dpp.ID}).Delete(TPDispatcherHostMdl{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
for _, lDataSet := range lds {
|
||||
attrModels := make(engine.TPAttributes, len(lDataSet))
|
||||
for i, ld := range lDataSet {
|
||||
attrModels[i] = new(engine.TPAttribute)
|
||||
attrModels[i] = new(engine.TPAttributeMdl)
|
||||
if err = utils.UpdateStructWithIfaceMap(attrModels[i], ld); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -314,7 +314,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
for _, lDataSet := range lds {
|
||||
resModels := make(engine.TpResources, len(lDataSet))
|
||||
for i, ld := range lDataSet {
|
||||
resModels[i] = new(engine.TpResource)
|
||||
resModels[i] = new(engine.TpResourceMdl)
|
||||
if err = utils.UpdateStructWithIfaceMap(resModels[i], ld); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -353,7 +353,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
for _, lDataSet := range lds {
|
||||
fltrModels := make(engine.TpFilterS, len(lDataSet))
|
||||
for i, ld := range lDataSet {
|
||||
fltrModels[i] = new(engine.TpFilter)
|
||||
fltrModels[i] = new(engine.TpFilterMdl)
|
||||
if err = utils.UpdateStructWithIfaceMap(fltrModels[i], ld); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -383,7 +383,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
for _, lDataSet := range lds {
|
||||
stsModels := make(engine.TpStats, len(lDataSet))
|
||||
for i, ld := range lDataSet {
|
||||
stsModels[i] = new(engine.TpStat)
|
||||
stsModels[i] = new(engine.TpStatMdl)
|
||||
if err = utils.UpdateStructWithIfaceMap(stsModels[i], ld); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -429,7 +429,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
for _, lDataSet := range lds {
|
||||
thModels := make(engine.TpThresholds, len(lDataSet))
|
||||
for i, ld := range lDataSet {
|
||||
thModels[i] = new(engine.TpThreshold)
|
||||
thModels[i] = new(engine.TpThresholdMdl)
|
||||
if err = utils.UpdateStructWithIfaceMap(thModels[i], ld); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -462,7 +462,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
for _, lDataSet := range lds {
|
||||
sppModels := make(engine.TPRoutes, len(lDataSet))
|
||||
for i, ld := range lDataSet {
|
||||
sppModels[i] = new(engine.TpRoute)
|
||||
sppModels[i] = new(engine.TpRouteMdl)
|
||||
if err = utils.UpdateStructWithIfaceMap(sppModels[i], ld); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -492,7 +492,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
for _, lDataSet := range lds {
|
||||
cppModels := make(engine.TPChargers, len(lDataSet))
|
||||
for i, ld := range lDataSet {
|
||||
cppModels[i] = new(engine.TPCharger)
|
||||
cppModels[i] = new(engine.TPChargerMdl)
|
||||
if err = utils.UpdateStructWithIfaceMap(cppModels[i], ld); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -522,7 +522,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
for _, lDataSet := range lds {
|
||||
dispModels := make(engine.TPDispatcherProfiles, len(lDataSet))
|
||||
for i, ld := range lDataSet {
|
||||
dispModels[i] = new(engine.TPDispatcherProfile)
|
||||
dispModels[i] = new(engine.TPDispatcherProfileMdl)
|
||||
if err = utils.UpdateStructWithIfaceMap(dispModels[i], ld); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -550,7 +550,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
for _, lDataSet := range lds {
|
||||
dispModels := make(engine.TPDispatcherHosts, len(lDataSet))
|
||||
for i, ld := range lDataSet {
|
||||
dispModels[i] = new(engine.TPDispatcherHost)
|
||||
dispModels[i] = new(engine.TPDispatcherHostMdl)
|
||||
if err = utils.UpdateStructWithIfaceMap(dispModels[i], ld); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user