defmodule Atlas.Generator do
# ...
def tracking_entity_type(opts \\ []) do
tenant = opts[:tenant] || default_tenant()
module_id = opts[:module_id] || once(:default_module_id, fn -> generate(module()).id end)
changeset_generator(EntityType, :create,
defaults: [
parent_id: nil,
module_id: module_id,
name: sequence(:name, &"Entity Type #{&1}"),
slug: sequence(:slug, &"entity_type_#{&1}"),
plural_name: sequence(:plural_name, &"Entity Types #{&1}"),
plural_slug: sequence(:plural_slug, &"entity_types_#{&1}"),
label_template: "{{ id }}",
select_template: "{{ id }}",
icon: :info
],
tenant: tenant,
overrides: opts,
authorize?: false
)
end
# ...
defp default_tenant do
once(:default_tenant, fn -> generate(client()) end)
end
end
defmodule Atlas.Generator do
# ...
def tracking_entity_type(opts \\ []) do
tenant = opts[:tenant] || default_tenant()
module_id = opts[:module_id] || once(:default_module_id, fn -> generate(module()).id end)
changeset_generator(EntityType, :create,
defaults: [
parent_id: nil,
module_id: module_id,
name: sequence(:name, &"Entity Type #{&1}"),
slug: sequence(:slug, &"entity_type_#{&1}"),
plural_name: sequence(:plural_name, &"Entity Types #{&1}"),
plural_slug: sequence(:plural_slug, &"entity_types_#{&1}"),
label_template: "{{ id }}",
select_template: "{{ id }}",
icon: :info
],
tenant: tenant,
overrides: opts,
authorize?: false
)
end
# ...
defp default_tenant do
once(:default_tenant, fn -> generate(client()) end)
end
end