11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/global_registry_bindings/entity/entity_type_methods.rb', line 11
def push_entity_type_to_global_registry
return unless global_registry_entity.ensure_type?
parent_entity_id = parent_entity_type_id
entity_type = Rails.cache.fetch(entity_type_cache_key, expires_in: 1.hour) do
GlobalRegistry::EntityType.get("filters[name]" => global_registry_entity.type,
"filters[parent_id]" => parent_entity_id)["entity_types"]&.first
end
entity_type ||= GlobalRegistry::EntityType.post(entity_type: {name: global_registry_entity.type,
parent_id: parent_entity_id,
field_type: "entity"})["entity_type"]
push_entity_type_fields_to_global_registry(entity_type)
entity_type
end
|