Skip to content

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

Fix Time Entry schema

Klaus Zanders16462254b055
diff --git a/modules/costs/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rb b/modules/costs/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rb
index ca02bd6a9c8..f9a6e05ae56 100644
--- a/modules/costs/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rb
+++ b/modules/costs/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rb
@@ -80,7 +80,7 @@ module API
# TODO: also factory needed here?
schema_with_allowed_link :entity,
has_default: false,
- required: false,
+ required: true,
href_callback: ->(*) {
allowed_work_package_href
}
diff --git a/modules/costs/spec/lib/api/v3/time_entries/schemas/time_entry_schema_representer_spec.rb b/modules/costs/spec/lib/api/v3/time_entries/schemas/time_entry_schema_representer_spec.rb
index c30734b03df..d9adf9d161e 100644
--- a/modules/costs/spec/lib/api/v3/time_entries/schemas/time_entry_schema_representer_spec.rb
+++ b/modules/costs/spec/lib/api/v3/time_entries/schemas/time_entry_schema_representer_spec.rb
@@ -41,7 +41,7 @@ RSpec.describe API::V3::TimeEntries::Schemas::TimeEntrySchemaRepresenter do
let(:assigned_project) { nil }
let(:activity) { build_stubbed(:time_entry_activity) }
let(:time_entry) { build_stubbed(:time_entry) }
- let(:writable_attributes) { %w(spent_on hours project work_package activity comment user) }
+ let(:writable_attributes) { %w(spent_on hours project entity activity comment user) }
let(:contract) do
contract = instance_double(new_record ? TimeEntries::CreateContract : TimeEntries::UpdateContract,
@@ -211,13 +211,13 @@ RSpec.describe API::V3::TimeEntries::Schemas::TimeEntrySchemaRepresenter do
end
end
- describe "work_package" do
- let(:path) { "workPackage" }
+ describe "entity" do
+ let(:path) { "entity" }
it_behaves_like "has basic schema properties" do
- let(:type) { "WorkPackage" }
- let(:name) { TimeEntry.human_attribute_name("work_package") }
- let(:required) { false }
+ let(:type) { "Entity" }
+ let(:name) { TimeEntry.human_attribute_name("entity") }
+ let(:required) { true }
let(:writable) { true }
let(:location) { "_links" }
end