wedding-planner/spec/requests/affinities_spec.rb

81 lines
2.2 KiB
Ruby
Raw Normal View History

2024-12-26 19:30:32 +00:00
# Copyright (C) 2024 Manuel Bustillo
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
2024-12-26 19:30:32 +00:00
# frozen_string_literal: true
require 'swagger_helper'
2024-12-28 18:07:22 +01:00
RSpec.describe 'affinities' do
path '/{slug}/groups/affinities/reset' do
parameter Swagger::Schema::SLUG
post('reset affinities') do
tags 'Affinities'
description 'Reset all affinities to default values based on the distance between groups in the hierarchy.'
response_empty200
end
end
path '/{slug}/groups/{group_id}/affinities' do
parameter Swagger::Schema::SLUG
parameter name: 'group_id', in: :path, type: :string, format: :uuid, description: 'group_id'
get('list affinities') do
tags 'Affinities'
produces 'application/json'
response(200, 'successful') do
schema type: :object, additionalProperties: { type: :integer, minimum: 0, maximum: 2 }
xit
end
end
end
path '/{slug}/groups/{group_id}/affinities/default' do
parameter Swagger::Schema::SLUG
parameter name: 'group_id', in: :path, type: :string, format: :uuid, description: 'group_id'
get('calculate default affinity') do
tags 'Affinities'
produces 'application/json'
response(200, 'successful') do
schema type: :object, additionalProperties: { type: :integer, minimum: 0, maximum: 2 }
xit
end
end
end
path '/{slug}/groups/{group_id}/affinities/bulk_update' do
parameter Swagger::Schema::SLUG
parameter name: 'group_id', in: :path, type: :string, format: :uuid, description: 'group_id'
put('bulk update affinities') do
tags 'Affinities'
produces 'application/json'
consumes 'application/json'
parameter name: :body, in: :body, schema: {
type: :object,
required: [:affinities],
properties: {
affinities: {
type: :array,
items: {
type: :object,
2024-12-28 16:43:58 +01:00
required: %i[group_id affinity],
properties: {
group_id: { type: :string, format: :uuid, description: 'ID of the associated group' },
2024-12-28 16:43:58 +01:00
affinity: { type: :integer, minimum: 0, maximum: 2 }
}
}
}
}
}
2024-12-28 18:07:22 +01:00
response_empty200
end
end
end