Merge pull request #2778 from okriuchykhin/ok_SCI_4911

Add created_at and user to API Step serializer [SCI-4911]
This commit is contained in:
Miha Mencin 2020-08-10 10:27:53 +02:00 committed by GitHub
commit 1080ad2821
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -59,7 +59,7 @@ module Api
end end
def permitted_includes def permitted_includes
%w(tables assets checklists checklists.checklist_items comments) %w(tables assets checklists checklists.checklist_items comments user)
end end
def load_step_for_managing def load_step_for_managing

View file

@ -8,8 +8,9 @@ module Api
include InputSanitizeHelper include InputSanitizeHelper
type :steps type :steps
attributes :id, :name, :description, :position, :completed attributes :id, :name, :description, :created_at, :position, :completed
attribute :completed_on, if: -> { object.completed? } attribute :completed_on, if: -> { object.completed? }
belongs_to :user, serializer: UserSerializer
belongs_to :protocol, serializer: ProtocolSerializer belongs_to :protocol, serializer: ProtocolSerializer
has_many :assets, serializer: AssetSerializer has_many :assets, serializer: AssetSerializer
has_many :checklists, serializer: ChecklistSerializer has_many :checklists, serializer: ChecklistSerializer