mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 06:38:45 +05:00
Started renaming AccountPRofile into Account
This commit is contained in:
committed by
Dan Christian Bogos
parent
31414ca68b
commit
1f485d7cf9
@@ -301,11 +301,11 @@ func (dbM *DataDBMock) RemoveActionProfileDrv(string, string) error {
|
||||
return utils.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (dbM *DataDBMock) GetAccountProfileDrv(string, string) (*utils.AccountProfile, error) {
|
||||
func (dbM *DataDBMock) GetAccountProfileDrv(string, string) (*utils.Account, error) {
|
||||
return nil, utils.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (dbM *DataDBMock) SetAccountProfileDrv(profile *utils.AccountProfile) error {
|
||||
func (dbM *DataDBMock) SetAccountProfileDrv(profile *utils.Account) error {
|
||||
return utils.ErrNotImplemented
|
||||
}
|
||||
|
||||
|
||||
@@ -2831,7 +2831,7 @@ func (dm *DataManager) checkFilters(tenant string, ids []string) (brokenReferenc
|
||||
return
|
||||
}
|
||||
|
||||
func (dm *DataManager) GetAccountProfile(tenant, id string) (ap *utils.AccountProfile, err error) {
|
||||
func (dm *DataManager) GetAccountProfile(tenant, id string) (ap *utils.Account, err error) {
|
||||
if dm == nil {
|
||||
err = utils.ErrNoDatabaseConn
|
||||
return
|
||||
@@ -2857,7 +2857,7 @@ func (dm *DataManager) GetAccountProfile(tenant, id string) (ap *utils.AccountPr
|
||||
return
|
||||
}
|
||||
|
||||
func (dm *DataManager) SetAccountProfile(ap *utils.AccountProfile, withIndex bool) (err error) {
|
||||
func (dm *DataManager) SetAccountProfile(ap *utils.Account, withIndex bool) (err error) {
|
||||
if dm == nil {
|
||||
return utils.ErrNoDatabaseConn
|
||||
}
|
||||
@@ -2890,8 +2890,8 @@ func (dm *DataManager) SetAccountProfile(ap *utils.AccountProfile, withIndex boo
|
||||
config.CgrConfig().DataDbCfg().RplFiltered,
|
||||
utils.AccountProfilePrefix, ap.TenantID(), // this are used to get the host IDs from cache
|
||||
utils.ReplicatorSv1SetAccountProfile,
|
||||
&utils.AccountProfileWithAPIOpts{
|
||||
AccountProfile: ap,
|
||||
&utils.AccountWithAPIOpts{
|
||||
Account: ap,
|
||||
APIOpts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID,
|
||||
config.CgrConfig().DataDbCfg().RplCache, utils.EmptyString)})
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ func (dDP *dynamicDP) fieldAsInterface(fldPath []string) (val interface{}, err e
|
||||
// split the field name in 3 parts
|
||||
// fieldNameType (~*accounts), accountID(1001) and queried part (BalanceMap.*monetary[0].Value)
|
||||
|
||||
var account utils.AccountProfile
|
||||
var account utils.Account
|
||||
if err = connMgr.Call(dDP.apiConns, nil, utils.APIerSv1GetAccountProfile,
|
||||
&utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: dDP.tenant, ID: fldPath[1]}}, &account); err != nil {
|
||||
return
|
||||
|
||||
@@ -2845,8 +2845,8 @@ func APItoModelTPAccountProfile(tPrf *utils.TPAccountProfile) (mdls AccountProfi
|
||||
return
|
||||
}
|
||||
|
||||
func APItoAccountProfile(tpAp *utils.TPAccountProfile, timezone string) (ap *utils.AccountProfile, err error) {
|
||||
ap = &utils.AccountProfile{
|
||||
func APItoAccountProfile(tpAp *utils.TPAccountProfile, timezone string) (ap *utils.Account, err error) {
|
||||
ap = &utils.Account{
|
||||
Tenant: tpAp.Tenant,
|
||||
ID: tpAp.ID,
|
||||
FilterIDs: make([]string, len(tpAp.FilterIDs)),
|
||||
@@ -2939,7 +2939,7 @@ func APItoAccountProfile(tpAp *utils.TPAccountProfile, timezone string) (ap *uti
|
||||
return
|
||||
}
|
||||
|
||||
func AccountProfileToAPI(ap *utils.AccountProfile) (tpAp *utils.TPAccountProfile) {
|
||||
func AccountProfileToAPI(ap *utils.Account) (tpAp *utils.TPAccountProfile) {
|
||||
tpAp = &utils.TPAccountProfile{
|
||||
Tenant: ap.Tenant,
|
||||
ID: ap.ID,
|
||||
|
||||
@@ -5617,7 +5617,7 @@ func TestApitoAccountProfileCase2(t *testing.T) {
|
||||
},
|
||||
ThresholdIDs: []string{"WARN_RES1"},
|
||||
}
|
||||
exp := &utils.AccountProfile{
|
||||
exp := &utils.Account{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ResGroup1",
|
||||
FilterIDs: []string{"FLTR_RES_GR1"},
|
||||
@@ -5809,7 +5809,7 @@ func TestModelHelpersActionProfileToAPICase2(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestModelHelpersAccountProfileToAPI(t *testing.T) {
|
||||
testStruct := &utils.AccountProfile{
|
||||
testStruct := &utils.Account{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "RP1",
|
||||
FilterIDs: []string{"test_filterId"},
|
||||
|
||||
@@ -107,8 +107,8 @@ type DataDB interface {
|
||||
GetActionProfileDrv(string, string) (*ActionProfile, error)
|
||||
SetActionProfileDrv(*ActionProfile) error
|
||||
RemoveActionProfileDrv(string, string) error
|
||||
GetAccountProfileDrv(string, string) (*utils.AccountProfile, error)
|
||||
SetAccountProfileDrv(profile *utils.AccountProfile) error
|
||||
GetAccountProfileDrv(string, string) (*utils.Account, error)
|
||||
SetAccountProfileDrv(profile *utils.Account) error
|
||||
RemoveAccountProfileDrv(string, string) error
|
||||
}
|
||||
|
||||
|
||||
@@ -677,15 +677,15 @@ func (iDB *InternalDB) RemoveIndexesDrv(idxItmType, tntCtx, idxKey string) (err
|
||||
return
|
||||
}
|
||||
|
||||
func (iDB *InternalDB) GetAccountProfileDrv(tenant, id string) (ap *utils.AccountProfile, err error) {
|
||||
func (iDB *InternalDB) GetAccountProfileDrv(tenant, id string) (ap *utils.Account, err error) {
|
||||
x, ok := Cache.Get(utils.CacheAccountProfiles, utils.ConcatenatedKey(tenant, id))
|
||||
if !ok || x == nil {
|
||||
return nil, utils.ErrNotFound
|
||||
}
|
||||
return x.(*utils.AccountProfile).Clone(), nil
|
||||
return x.(*utils.Account).Clone(), nil
|
||||
}
|
||||
|
||||
func (iDB *InternalDB) SetAccountProfileDrv(ap *utils.AccountProfile) (err error) {
|
||||
func (iDB *InternalDB) SetAccountProfileDrv(ap *utils.Account) (err error) {
|
||||
Cache.SetWithoutReplicate(utils.CacheAccountProfiles, ap.TenantID(), ap, nil,
|
||||
cacheCommit(utils.NonTransactional), utils.NonTransactional)
|
||||
return
|
||||
|
||||
@@ -1612,8 +1612,8 @@ func (ms *MongoStorage) RemoveIndexesDrv(idxItmType, tntCtx, idxKey string) (err
|
||||
})
|
||||
}
|
||||
|
||||
func (ms *MongoStorage) GetAccountProfileDrv(tenant, id string) (ap *utils.AccountProfile, err error) {
|
||||
ap = new(utils.AccountProfile)
|
||||
func (ms *MongoStorage) GetAccountProfileDrv(tenant, id string) (ap *utils.Account, err error) {
|
||||
ap = new(utils.Account)
|
||||
err = ms.query(func(sctx mongo.SessionContext) (err error) {
|
||||
cur := ms.getCol(ColAnp).FindOne(sctx, bson.M{"tenant": tenant, "id": id})
|
||||
if err := cur.Decode(ap); err != nil {
|
||||
@@ -1628,7 +1628,7 @@ func (ms *MongoStorage) GetAccountProfileDrv(tenant, id string) (ap *utils.Accou
|
||||
return
|
||||
}
|
||||
|
||||
func (ms *MongoStorage) SetAccountProfileDrv(ap *utils.AccountProfile) (err error) {
|
||||
func (ms *MongoStorage) SetAccountProfileDrv(ap *utils.Account) (err error) {
|
||||
return ms.query(func(sctx mongo.SessionContext) (err error) {
|
||||
_, err = ms.getCol(ColAnp).UpdateOne(sctx, bson.M{"tenant": ap.Tenant, "id": ap.ID},
|
||||
bson.M{"$set": ap},
|
||||
|
||||
@@ -937,7 +937,7 @@ func (rs *RedisStorage) RemoveIndexesDrv(idxItmType, tntCtx, idxKey string) (err
|
||||
return rs.Cmd(nil, redisHDEL, utils.CacheInstanceToPrefix[idxItmType]+tntCtx, idxKey)
|
||||
}
|
||||
|
||||
func (rs *RedisStorage) GetAccountProfileDrv(tenant, id string) (ap *utils.AccountProfile, err error) {
|
||||
func (rs *RedisStorage) GetAccountProfileDrv(tenant, id string) (ap *utils.Account, err error) {
|
||||
var values []byte
|
||||
if err = rs.Cmd(&values, redisGET, utils.AccountProfilePrefix+utils.ConcatenatedKey(tenant, id)); err != nil {
|
||||
return
|
||||
@@ -949,7 +949,7 @@ func (rs *RedisStorage) GetAccountProfileDrv(tenant, id string) (ap *utils.Accou
|
||||
return
|
||||
}
|
||||
|
||||
func (rs *RedisStorage) SetAccountProfileDrv(ap *utils.AccountProfile) (err error) {
|
||||
func (rs *RedisStorage) SetAccountProfileDrv(ap *utils.Account) (err error) {
|
||||
var result []byte
|
||||
if result, err = rs.ms.Marshal(ap); err != nil {
|
||||
return
|
||||
|
||||
@@ -763,7 +763,7 @@ func (tpr *TpReader) WriteToDatabase(verbose, disableReverse bool) (err error) {
|
||||
log.Print("AccountProfiles:")
|
||||
}
|
||||
for _, tpAP := range tpr.accountProfiles {
|
||||
var ap *utils.AccountProfile
|
||||
var ap *utils.Account
|
||||
if ap, err = APItoAccountProfile(tpAP, tpr.timezone); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user