|
|
|
@ -34,7 +34,6 @@ module API |
|
|
|
|
module V3 |
|
|
|
|
module WorkPackages |
|
|
|
|
class WorkPackageRepresenter < ::API::Decorators::Single |
|
|
|
|
|
|
|
|
|
self_link title_getter: -> (*) { represented.subject } |
|
|
|
|
|
|
|
|
|
link :update do |
|
|
|
@ -181,6 +180,8 @@ module API |
|
|
|
|
represented.fixed_version.to_s_for_project(represented.project) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
linked_property :project |
|
|
|
|
|
|
|
|
|
linked_property :priority |
|
|
|
|
|
|
|
|
|
links :children do |
|
|
|
@ -233,13 +234,6 @@ module API |
|
|
|
|
exec_context: :decorator, |
|
|
|
|
setter: -> (value, *) { self.done_ratio = value }, |
|
|
|
|
writeable: false |
|
|
|
|
property :version_id, |
|
|
|
|
getter: -> (*) { fixed_version.try(:id) }, |
|
|
|
|
setter: -> (value, *) { self.fixed_version_id = value }, |
|
|
|
|
render_nil: true |
|
|
|
|
property :version_name, getter: -> (*) { fixed_version.try(:name) }, render_nil: true |
|
|
|
|
property :project_id, getter: -> (*) { project.id } |
|
|
|
|
property :project_name, getter: -> (*) { project.try(:name) } |
|
|
|
|
property :parent_id, writeable: true |
|
|
|
|
property :created_at, |
|
|
|
|
exec_context: :decorator, |
|
|
|
@ -286,6 +280,10 @@ module API |
|
|
|
|
embedded: true, |
|
|
|
|
exec_context: :decorator, |
|
|
|
|
if: ->(*) { represented.fixed_version.present? } |
|
|
|
|
property :project, |
|
|
|
|
embedded: true, |
|
|
|
|
class: ::Project, |
|
|
|
|
decorator: ::API::V3::Projects::ProjectRepresenter |
|
|
|
|
property :watchers, |
|
|
|
|
embedded: true, |
|
|
|
|
exec_context: :decorator, |
|
|
|
@ -308,7 +306,8 @@ module API |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def watchers |
|
|
|
|
watchers = represented.watcher_users.order(User::USER_FORMATS_STRUCTURE[Setting.user_format]) |
|
|
|
|
watchers = |
|
|
|
|
represented.watcher_users.order(User::USER_FORMATS_STRUCTURE[Setting.user_format]) |
|
|
|
|
watchers.map do |watcher| |
|
|
|
|
::API::V3::Users::UserRepresenter.new(watcher, |
|
|
|
|
work_package: represented, |
|
|
|
|