Skip to content

Commit

Permalink
KAZOO-5133: make sure fields set to false get into number docs (2600h…
Browse files Browse the repository at this point in the history
…z#2824)

* KAZOO-5133: make sure fields set to false get into number docs

* qf-KNM_migration: make fmt
  • Loading branch information
fenollp authored and lazedo committed Nov 22, 2016
1 parent 7913f30 commit a3e4142
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions core/kazoo_number_manager/src/knm_phone_number.erl
Original file line number Diff line number Diff line change
Expand Up @@ -312,29 +312,31 @@ to_public_json(Number) ->
-spec to_json(knm_phone_number()) -> kz_json:object().
to_json(#knm_phone_number{doc=JObj}=N) ->
kz_json:from_list(
props:filter_empty(
[{<<"_id">>, number(N)}
,{?PVT_DB_NAME, number_db(N)}
,{?PVT_ASSIGNED_TO, assigned_to(N)}
,{?PVT_AUTH_BY, auth_by(N)}
,{?PVT_PREVIOUSLY_ASSIGNED_TO, prev_assigned_to(N)}
,{?PVT_USED_BY, used_by(N)}
,{?PVT_FEATURES, features(N)}
,{?PVT_FEATURES_AVAILABLE, features_available(N)}
,{?PVT_STATE, state(N)}
,{?PVT_RESERVE_HISTORY, reserve_history(N)}
,{?PVT_PORTED_IN, ported_in(N)}
,{?PVT_MODULE_NAME, module_name(N)}
,{?PVT_CARRIER_DATA, carrier_data(N)}
,{?PVT_REGION, region(N)}
,{?PVT_MODIFIED, modified(N)}
,{?PVT_CREATED, created(N)}
,{?PVT_IS_BILLABLE, is_billable(N)}
,{?PVT_TYPE, <<"number">>}
| kz_json:to_proplist(
kz_json:delete_key(<<"id">>, kz_json:public_fields(JObj))
)
])
[{<<"_id">>, number(N)}
,{?PVT_DB_NAME, number_db(N)}
,{?PVT_STATE, state(N)}
,{?PVT_PORTED_IN, ported_in(N)}
,{?PVT_MODULE_NAME, module_name(N)}
,{?PVT_MODIFIED, modified(N)}
,{?PVT_CREATED, created(N)}
,{?PVT_IS_BILLABLE, is_billable(N)}
,{?PVT_TYPE, <<"number">>}
| kz_json:to_proplist(
kz_json:delete_key(<<"id">>, kz_json:public_fields(JObj))
)
]
++
props:filter_empty(
[{?PVT_ASSIGNED_TO, assigned_to(N)}
,{?PVT_AUTH_BY, auth_by(N)}
,{?PVT_PREVIOUSLY_ASSIGNED_TO, prev_assigned_to(N)}
,{?PVT_USED_BY, used_by(N)}
,{?PVT_FEATURES, features(N)}
,{?PVT_FEATURES_AVAILABLE, features_available(N)}
,{?PVT_RESERVE_HISTORY, reserve_history(N)}
,{?PVT_CARRIER_DATA, carrier_data(N)}
,{?PVT_REGION, region(N)}
])
).

%%--------------------------------------------------------------------
Expand Down

0 comments on commit a3e4142

Please sign in to comment.