wedding-planner/spec/requests/affinities_spec.rb
bustikiller acf3b7b82a
All checks were successful
Check usage of free licenses / check-licenses (push) Successful in 42s
Run unit tests / unit_tests (push) Successful in 2m3s
Build Nginx-based docker image / build-static-assets (push) Successful in 12m11s
Merge pull request 'Update copyright assignment to cover 2025 and include all contributors' (#212) from copyright-2025 into main
Reviewed-on: #212
2025-01-13 21:04:10 +00:00

81 lines
2.2 KiB
Ruby

# Copyright (C) 2024 Manuel Bustillo
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
# frozen_string_literal: true
require 'swagger_helper'
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,
required: %i[group_id affinity],
properties: {
group_id: { type: :string, format: :uuid, description: 'ID of the associated group' },
affinity: { type: :integer, minimum: 0, maximum: 2 }
}
}
}
}
}
response_empty200
end
end
end