OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
add schema and update link to time entry
ulferts1a6e693651cf
diff --git a/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rb b/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rbindex 83dba608f4c..dc04f0c2fe3 100644--- a/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rb+++ b/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rb@@ -56,6 +56,10 @@ module APIschema :user,type: 'User'+ schema :comment,+ type: 'Formattable',+ required: false+schema_with_allowed_link :work_package,has_default: false,required: false,diff --git a/lib/api/v3/time_entries/time_entry_representer.rb b/lib/api/v3/time_entries/time_entry_representer.rbindex 30af8f3156f..268f59cf872 100644--- a/lib/api/v3/time_entries/time_entry_representer.rb+++ b/lib/api/v3/time_entries/time_entry_representer.rb@@ -50,6 +50,15 @@ module API}end+ link :update do+ next unless update_allowed?++ {+ href: api_v3_paths.time_entry_form(represented.id),+ method: :post+ }+ end+link :delete donext unless update_allowed?@@ -59,6 +68,12 @@ module API}end+ link :schema do+ {+ href: api_v3_paths.time_entry_schema+ }+ end+property :idformattable_property :comments,diff --git a/modules/boards/spec/features/action_boards/status_type_moving_board_spec.rb b/modules/boards/spec/features/action_boards/status_type_moving_board_spec.rbindex 08aaff22d3c..be15e7a8b74 100644--- a/modules/boards/spec/features/action_boards/status_type_moving_board_spec.rb+++ b/modules/boards/spec/features/action_boards/status_type_moving_board_spec.rb@@ -98,7 +98,6 @@ describe 'Status action board', type: :feature, js: true donew_status_id: open_status.id)}-let(:filters) { ::Components::WorkPackages::Filters.new }before dodiff --git a/spec/lib/api/v3/time_entries/schemas/time_entry_schema_representer_spec.rb b/spec/lib/api/v3/time_entries/schemas/time_entry_schema_representer_spec.rbindex 1ec941c6bc8..fc77954870d 100644--- a/spec/lib/api/v3/time_entries/schemas/time_entry_schema_representer_spec.rb+++ b/spec/lib/api/v3/time_entries/schemas/time_entry_schema_representer_spec.rb@@ -48,7 +48,7 @@ describe ::API::V3::TimeEntries::Schemas::TimeEntrySchemaRepresenter doallow(contract).to receive(:writable?) do |attribute|- %w(spent_on hours project work_package activity).include?(attribute.to_s)+ %w(spent_on hours project work_package activity comment).include?(attribute.to_s)endallow(contract)@@ -114,6 +114,17 @@ describe ::API::V3::TimeEntries::Schemas::TimeEntrySchemaRepresenter doendend+ describe 'comment' do+ let(:path) { 'comment' }++ it_behaves_like 'has basic schema properties' do+ let(:type) { 'Formattable' }+ let(:name) { TimeEntry.human_attribute_name('comment') }+ let(:required) { false }+ let(:writable) { true }+ end+ end+describe 'createdAt' dolet(:path) { 'createdAt' }diff --git a/spec/lib/api/v3/time_entries/time_entry_representer_rendering_spec.rb b/spec/lib/api/v3/time_entries/time_entry_representer_rendering_spec.rbindex bc0cb079925..2f7aa4b4472 100644--- a/spec/lib/api/v3/time_entries/time_entry_representer_rendering_spec.rb+++ b/spec/lib/api/v3/time_entries/time_entry_representer_rendering_spec.rb@@ -99,6 +99,11 @@ describe ::API::V3::TimeEntries::TimeEntryRepresenter, 'rendering' dolet(:title) { activity.name }end+ it_behaves_like 'has an untitled link' do+ let(:link) { 'schema' }+ let(:href) { api_v3_paths.time_entry_schema }+ end+context 'custom value' dolet(:custom_field) doFactoryBot.build_stubbed(:time_entry_custom_field, field_format: 'user')@@ -141,6 +146,12 @@ describe ::API::V3::TimeEntries::TimeEntryRepresenter, 'rendering' dolet(:method) { :patch }end+ it_behaves_like 'has an untitled link' do+ let(:link) { 'update' }+ let(:href) { api_v3_paths.time_entry_form(time_entry.id) }+ let(:method) { :post }+ end+it_behaves_like 'has an untitled link' dolet(:link) { 'delete' }let(:href) { api_v3_paths.time_entry(time_entry.id) }@@ -154,6 +165,10 @@ describe ::API::V3::TimeEntries::TimeEntryRepresenter, 'rendering' dolet(:link) { 'updateImmediately' }end+ it_behaves_like 'has no link' do+ let(:link) { 'update' }+ end+it_behaves_like 'has no link' dolet(:link) { 'delete' }end