updated RemTpData to check args map in switch case

This commit is contained in:
gezimbll
2024-05-28 05:09:00 -04:00
committed by Dan Christian Bogos
parent b9fcf8b24e
commit 9dfd36e7f2

View File

@@ -558,8 +558,23 @@ func (iDB *InternalDB) RemTpData(table, tpid string, args map[string]string) (er
}
key := tpid
if args != nil {
for _, val := range args {
key += utils.CONCATENATED_KEY_SEP + val
switch table {
case utils.TBLTPAccountActions:
key += utils.CONCATENATED_KEY_SEP + args["loadid"] +
utils.CONCATENATED_KEY_SEP + args["tenant"] +
utils.CONCATENATED_KEY_SEP + args["account"]
case utils.TBLTPRateProfiles:
key += utils.CONCATENATED_KEY_SEP + args["loadid"] +
utils.CONCATENATED_KEY_SEP + args["tenant"] +
utils.CONCATENATED_KEY_SEP + args["category"] +
utils.CONCATENATED_KEY_SEP + args["subject"]
default:
if tag, has := args["tag"]; has {
key += utils.CONCATENATED_KEY_SEP + tag
} else if id, has := args["id"]; has {
key += utils.CONCATENATED_KEY_SEP + args["tenant"] +
utils.CONCATENATED_KEY_SEP + id
}
}
}
ids := iDB.db.GetItemIDs(table, key)