update :update do
primary? true
require_atomic? false
transaction? true
accept @admin_fields |> List.delete(:site_id)
argument :tag_ids, {:array, :uuid} do
description "List of tag IDs to assign to this section"
end
change slugify(:slug, into: :slug, ignore: [".", "!", "?"])
change manage_relationship(:tag_ids, :tags,
type: :append_and_remove,
on_no_match: :error,
on_match: :ignore
)
# Add metadata for event tracking
change fn changeset, context ->
Ash.Changeset.put_context(changeset, :ash_events_metadata, %{
site_id: context.tenant || changeset.data.site_id,
title: Ash.Changeset.get_attribute(changeset, :title) || changeset.data.title
})
end
description "Updates section for tenant users - requires tenant context, prevents site_id changes"
end
update :update do
primary? true
require_atomic? false
transaction? true
accept @admin_fields |> List.delete(:site_id)
argument :tag_ids, {:array, :uuid} do
description "List of tag IDs to assign to this section"
end
change slugify(:slug, into: :slug, ignore: [".", "!", "?"])
change manage_relationship(:tag_ids, :tags,
type: :append_and_remove,
on_no_match: :error,
on_match: :ignore
)
# Add metadata for event tracking
change fn changeset, context ->
Ash.Changeset.put_context(changeset, :ash_events_metadata, %{
site_id: context.tenant || changeset.data.site_id,
title: Ash.Changeset.get_attribute(changeset, :title) || changeset.data.title
})
end
description "Updates section for tenant users - requires tenant context, prevents site_id changes"
end