mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
passing entire account to event in *export action
This commit is contained in:
committed by
Dan Christian Bogos
parent
5929cd0d1b
commit
2b0bc6761c
@@ -1366,19 +1366,14 @@ func export(ub *Account, a *Action, _ Actions, _ *FilterS, extraData any, _ Shar
|
||||
Tenant: utils.NewTenantID(ub.ID).Tenant,
|
||||
ID: utils.GenUUID(),
|
||||
Event: map[string]any{
|
||||
utils.AccountField: ub.ID,
|
||||
utils.EventType: utils.AccountUpdate,
|
||||
utils.EventSource: utils.AccountService,
|
||||
utils.AllowNegative: ub.AllowNegative,
|
||||
utils.Disabled: ub.Disabled,
|
||||
utils.BalanceMap: ub.BalanceMap,
|
||||
utils.UnitCounters: ub.UnitCounters,
|
||||
utils.ActionTriggers: ub.ActionTriggers,
|
||||
utils.UpdateTime: ub.UpdateTime,
|
||||
utils.AccountField: ub,
|
||||
utils.EventType: utils.AccountUpdate,
|
||||
utils.EventSource: utils.AccountService,
|
||||
},
|
||||
|
||||
APIOpts: map[string]any{
|
||||
utils.MetaEventType: utils.AccountUpdate,
|
||||
utils.MetaEventTime: time.Now(),
|
||||
},
|
||||
}
|
||||
case extraData != nil:
|
||||
|
||||
@@ -107,7 +107,18 @@ func (cgr *CGREventWithEeIDs) UnmarshalJSON(data []byte) error {
|
||||
// ensuring the type of CostDetails is *EventCost.
|
||||
temp.Event[utils.CostDetails] = &ec
|
||||
}
|
||||
|
||||
isAccountUpdate := temp.Event[utils.EventType] == utils.AccountUpdate
|
||||
if accEv, has := temp.Event[utils.AccountField]; has && isAccountUpdate {
|
||||
accBytes, err := json.Marshal(accEv)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var as Account
|
||||
if err = json.Unmarshal(accBytes, &as); err != nil {
|
||||
return err
|
||||
}
|
||||
temp.Event[utils.AccountField] = &as
|
||||
}
|
||||
// Assign the extracted EeIDs and CGREvent
|
||||
// to the main struct fields.
|
||||
cgr.EeIDs = temp.EeIDs
|
||||
|
||||
@@ -2830,6 +2830,7 @@ const (
|
||||
OptsAttributesProfileRuns = "*attrProfileRuns"
|
||||
OptsAttributesProfileIgnoreFilters = "*attrProfileIgnoreFilters"
|
||||
MetaEventType = "*eventType"
|
||||
MetaEventTime = "*eventTime"
|
||||
EventType = "EventType"
|
||||
SchedulerInit = "SchedulerInit"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user