Compare commits
No commits in common. "70bbf79a5a34aa73fe27faa3cdd11519258c845c" and "71eecf94a6920801f10f274b3e9f0ae69eb5242b" have entirely different histories.
70bbf79a5a
...
71eecf94a6
@ -2,18 +2,7 @@
|
|||||||
|
|
||||||
class GroupsController < ApplicationController
|
class GroupsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
query_result = Groups::SummaryQuery.new.call.as_json.map(&:deep_symbolize_keys).map do |group|
|
render json: Groups::SummaryQuery.new.call.as_json
|
||||||
{
|
|
||||||
id: group[:id],
|
|
||||||
name: group[:name],
|
|
||||||
icon: group[:icon],
|
|
||||||
color: group[:color],
|
|
||||||
parent_id: group[:parent_id],
|
|
||||||
attendance: group.slice(:total, :considered, :invited, :confirmed, :declined, :tentative)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
render json: query_result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
@ -12,17 +12,13 @@ RSpec.describe 'groups', type: :request do
|
|||||||
schema type: :array,
|
schema type: :array,
|
||||||
items: {
|
items: {
|
||||||
type: :object,
|
type: :object,
|
||||||
required: %i[id name icon parent_id color attendance],
|
required: %i[id name icon parent_id color total considered invited confirmed declined tentative],
|
||||||
properties: {
|
properties: {
|
||||||
id: { type: :string, format: :uuid, required: true },
|
id: { type: :string, format: :uuid, required: true },
|
||||||
name: { type: :string },
|
name: { type: :string },
|
||||||
icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' },
|
icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' },
|
||||||
parent_id: { type: :string, format: :uuid },
|
parent_id: { type: :string, format: :uuid },
|
||||||
color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' },
|
color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' },
|
||||||
attendance: {
|
|
||||||
type: :object,
|
|
||||||
required: %i[total considered invited confirmed declined tentative],
|
|
||||||
properties: {
|
|
||||||
total: { type: :integer, minimum: 0, description: 'Total number of guests in any status' },
|
total: { type: :integer, minimum: 0, description: 'Total number of guests in any status' },
|
||||||
considered: { type: :integer, minimum: 0 },
|
considered: { type: :integer, minimum: 0 },
|
||||||
invited: { type: :integer, minimum: 0 },
|
invited: { type: :integer, minimum: 0 },
|
||||||
@ -31,8 +27,6 @@ RSpec.describe 'groups', type: :request do
|
|||||||
tentative: { type: :integer, minimum: 0 }
|
tentative: { type: :integer, minimum: 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
xit
|
xit
|
||||||
end
|
end
|
||||||
regular_api_responses
|
regular_api_responses
|
||||||
|
Loading…
x
Reference in New Issue
Block a user