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

Merge remote-tracking branch 'origin/dev' into bim/feature/viewpoints

Oliver Güntherbdf3909fdfa1
diff --cc modules/bcf/app/controllers/bcf/api/v2_1/topics_api.rb
index 6bff40eef32,e9f47446017..c5c39b230f8
--- a/modules/bcf/app/controllers/bcf/api/v2_1/topics_api.rb
+++ b/modules/bcf/app/controllers/bcf/api/v2_1/topics_api.rb
@@@ -47,9 -47,28 +47,28 @@@ module Bcf::API::V2_
scope: -> { topics })
.mount
+ post &::Bcf::API::V2_1::Endpoints::Create
+ .new(model: Bcf::Issue,
+ api_name: 'Topics',
+ params_modifier: ->(attributes) {
+ attributes[:project_id] = @project.id
+
+ wp_attributes = Bcf::Issues::TransformAttributesService
+ .new
+ .call(attributes)
+ .result
+
+ attributes
+ .slice(:stage,
+ :index,
+ :labels)
+ .merge(wp_attributes)
+ })
+ .mount
+
- route_param :uuid, regexp: /\A[a-f0-9\-]+\z/ do
+ route_param :topic_uuid, regexp: /\A[a-f0-9\-]+\z/ do
after_validation do
- @issue = topics.find_by_uuid!(params[:uuid])
+ @issue = topics.find_by_uuid!(params[:topic_uuid])
end
get &::Bcf::API::V2_1::Endpoints::Show
diff --cc modules/bcf/spec/factories/bcf_issue_factory.rb
index bf07fda9bb1,bdfc3df7167..094993505a3
--- a/modules/bcf/spec/factories/bcf_issue_factory.rb
+++ b/modules/bcf/spec/factories/bcf_issue_factory.rb
@@@ -114,13 -109,10 +109,16 @@@ FactoryBot.define d
</Markup>
MARKUP
end
+ stage { 'Construction stop' }
+ labels { ['Structural', 'IT Development', 'Huge'] }
+ sequence(:index) { |n| n }
+ factory :bcf_issue_with_viewpoint do
+ after(:create) do |issue|
+ create(:bcf_viewpoint, issue: issue)
+ end
+ end
+
factory :bcf_issue_with_comment do
after(:create) do |issue|
viewpoint = create(:bcf_viewpoint, issue: issue)
diff --cc modules/bcf/spec/requests/api/bcf/v2_1/shared_responses.rb
index 44bbd1a759f,5db1743e6e2..5d4041e793e
--- a/modules/bcf/spec/requests/api/bcf/v2_1/shared_responses.rb
+++ b/modules/bcf/spec/requests/api/bcf/v2_1/shared_responses.rb
@@@ -86,35 -70,13 +70,26 @@@ shared_examples_for 'bcf api not allowe
end
shared_examples_for 'bcf api unprocessable response' do
- it 'responds 403 NOT ALLOWED' do
- expect(subject.status)
- .to eql 422
+ let(:expect_422) do
+ { message: message }
end
- it 'states a reason message' do
- expected = {
- message: message
- }
-
- expect(subject.body)
- .to be_json_eql(expected.to_json)
- end
-
- it 'is has a json content type header' do
- expect(subject.headers['Content-Type'])
- .to eql 'application/json; charset=utf-8'
+ it 'responds 422 UNPROCESSABLE ENTITY', :aggregate_failures do
+ expect(subject.status).to eq 422
+ expect(subject.body).to be_json_eql(expect_422.to_json)
+ expect(subject.headers['Content-Type']).to eql 'application/json; charset=utf-8'
end
end
+
+shared_examples_for 'bcf api not implemented response' do
+ it 'responds 501 not implemented', :aggregate_failures do
+ expect(subject.status).to eql 501
+
+ expected = {
+ message: expected_message
+ }
+
+ expect(subject.body).to be_json_eql(expected.to_json)
+ expect(subject.headers['Content-Type']).to eql 'application/json; charset=utf-8'
+ end
+end