refactor: q ordered article parameter

This commit is contained in:
Philipp Rothmann 2022-12-12 16:59:17 +01:00
parent eac550daa9
commit 5201d1740c
3 changed files with 17 additions and 11 deletions

View file

@ -9,17 +9,8 @@ describe 'Order Articles', type: :request do
produces 'application/json'
parameter name: "per_page", in: :query, type: :integer, required: false
parameter name: "page", in: :query, type: :integer, required: false
parameter name: 'q', in: :query, required: false,
description: "'member' show articles ordered by the user's ordergroup, 'all' by all members, and 'supplier' ordered at the supplier",
schema: {
type: :object,
properties: {
ordered: {
type: :string,
enum: %w[member all supplier]
}
}
}
q_ordered_url_param
let(:api_scopes) { ['orders:read', 'orders:write'] }
let(:order) { create(:order, article_count: 4) }
let(:order_articles) { order.order_articles }

View file

@ -70,5 +70,11 @@ module ApiHelper
def self.id_url_param
parameter name: :id, in: :path, type: :integer, required: true
end
def self.q_ordered_url_param
parameter name: 'q', in: :query, required: false,
description: "'member' show articles ordered by the user's ordergroup, 'all' by all members, and 'supplier' ordered at the supplier",
schema: { '$ref' => '#/components/schemas/q_ordered' }
end
end
end

View file

@ -351,6 +351,15 @@ RSpec.configure do |config|
}
]
},
q_ordered: {
type: :object,
properties: {
ordered: {
type: :string,
enum: %w[member all supplier]
}
}
},
Meta: {
type: :object,
properties: {