observe_rsc_update_done/2
An updated resource has just been persisted. Observe this notification to execute follow-up actions for a resource update.
Type:
Return:
return value is ignored
#rsc_update_done{}
properties:
action:
insert|update|delete
id:
m_rsc:resource_id()
pre_is_a:
list
post_is_a:
list
pre_props:
m_rsc:props()
post_props:
m_rsc:props()
pre_is_a
List of resource categories before the update.
post_is_a
List of resource categories after the update.
pre_props
Map of properties before the update.
post_props
Map of properties after the update.
Example
Add some default edges when a resource is created:
observe_rsc_update_done(#rsc_update_done{action = insert, id = Id, post_is_a = PostIsA, post_props = Props}, Context) ->
case lists:member(activity, PostIsA) of
false ->
ok;
true ->
m_my_rsc:create_default_edges(Id, Context),
ok
end;
observe_rsc_update_done(#rsc_update_done{}, _Context) ->
%% Fall through
ok.