mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-18 07:01:58 +08:00
229a27750f
* Implement stock consumption via the API [SCI-6642] * Remove unnecessary attribute from InventoryItemSerializer [SCI-6642] * Amend permission check, add nested transaction support to consume_stock method [SCI-6642]
15 lines
398 B
Ruby
15 lines
398 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Api
|
|
module V1
|
|
class TaskInventoryItemSerializer < InventoryItemSerializer
|
|
attribute :stock_consumption, if: -> { object.repository_stock_cell.present? }
|
|
|
|
def stock_consumption
|
|
object.my_module_repository_rows
|
|
.find_by(my_module: instance_options[:my_module])
|
|
.stock_consumption
|
|
end
|
|
end
|
|
end
|
|
end
|