Merge pull request #8517 from artoscinote/connected-item-serializer-fix

Fix ConnectedItemSerializer eager class load issue
This commit is contained in:
Martin Artnik 2025-05-26 15:55:19 +02:00 committed by GitHub
commit 8d9ee4884a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,8 +2,21 @@
module Api
module V1
class ConnectedInventoryItemSerializer < InventoryItemSerializer
belongs_to :repository, key: :inventory, serializer: InventorySerializer
class ConnectedInventoryItemSerializer < ActiveModel::Serializer
type :inventory_items
attributes :name, :archived
has_many :repository_cells, key: :inventory_cells,
serializer: InventoryCellSerializer,
class_name: 'RepositoryCell',
unless: -> { object.repository_cells.blank? }
belongs_to :repository, key: :inventory,
serializer: InventorySerializer
has_many :parent_repository_rows, key: :parents,
serializer: self
has_many :child_repository_rows, key: :children,
serializer: self
include TimestampableModel
end
end
end