def graph_deleted(sender, **kwargs): """ Hook into save event of a Graph, resulting in payload being constructed and sent to message broker. """ graph = kwargs['instance'] payload = { 'type': graph.__class__.__name__, 'graph_id': graph.id, 'operation': DELETE } channel_layer = get_channel_layer() async_to_sync(channel_layer.group_send)(NOTIFICATION_GROUP_NAME, { 'type': NOTIFICATION_TYPE, 'message': json.dumps(payload) }) tasks.publish_update(graph.__class__.__name__, payload)
def schema_saved(sender, **kwargs): """ Hook into save event of a Schema, resulting in payload being constructed and sent to message broker. """ schema = kwargs['instance'] operation = POST if kwargs['created'] else UPDATE payload = { 'type': schema.__class__.__name__, 'schema_id': schema.id, 'operation': operation } channel_layer = get_channel_layer() async_to_sync(channel_layer.group_send)(NOTIFICATION_GROUP_NAME, { 'type': NOTIFICATION_TYPE, 'message': json.dumps(payload) }) tasks.publish_update(schema.__class__.__name__, payload)
def graph_attribute_def_transaction_deleted(sender, **kwargs): """ Hook into delete event of a GraphAttribDefTrans, resulting in payload being constructed and sent to message broker. """ attribute_def = kwargs['instance'] graph = attribute_def.graph_fk payload = { 'type': attribute_def.__class__.__name__, 'graph_id': graph.id, 'attribute_def_id': kwargs['instance'].id, 'operation': DELETE } channel_layer = get_channel_layer() async_to_sync(channel_layer.group_send)(NOTIFICATION_GROUP_NAME, { 'type': NOTIFICATION_TYPE, 'message': json.dumps(payload) }) tasks.publish_update(attribute_def.__class__.__name__, payload)
def schema_attribute_def_vertex_deleted(sender, **kwargs): """ Hook into delete event of a SchemaAttribDefVertex, resulting in payload being constructed and sent to message broker. """ attribute_def = kwargs['instance'] schema = attribute_def.schema_fk payload = { 'type': attribute_def.__class__.__name__, 'schema_id': schema.id, 'attribute_def_id': kwargs['instance'].id, 'operation': DELETE } channel_layer = get_channel_layer() async_to_sync(channel_layer.group_send)(NOTIFICATION_GROUP_NAME, { 'type': NOTIFICATION_TYPE, 'message': json.dumps(payload) }) tasks.publish_update(attribute_def.__class__.__name__, payload)
def graph_attribute_saved(sender, **kwargs): """ Hook into save event of a GraphAttrib, resulting in payload being constructed and sent to message broker. """ attribute = kwargs['instance'] graph = attribute.graph_fk operation = POST if kwargs['created'] else UPDATE payload = { 'type': attribute.__class__.__name__, 'graph_id': graph.id, 'attribute_id': kwargs['instance'].id, 'operation': operation } channel_layer = get_channel_layer() async_to_sync(channel_layer.group_send)(NOTIFICATION_GROUP_NAME, { 'type': NOTIFICATION_TYPE, 'message': json.dumps(payload) }) tasks.publish_update(attribute.__class__.__name__, payload)
def vertex_attribute_deleted(sender, **kwargs): """ Hook into delete event of a VertexAttrib, resulting in payload being constructed and sent to message broker. """ attribute = kwargs['instance'] vertex = attribute.vertex_fk payload = { 'type': attribute.__class__.__name__, 'graph_id': vertex.graph_fk.id, 'vertex_id': vertex.id, 'vx_id': vertex.vx_id, 'attribute_id': kwargs['instance'].id, 'operation': DELETE } channel_layer = get_channel_layer() async_to_sync(channel_layer.group_send)(NOTIFICATION_GROUP_NAME, { 'type': NOTIFICATION_TYPE, 'message': json.dumps(payload) }) tasks.publish_update(attribute.__class__.__name__, payload)