All checks were successful
		
		
	
	Check usage of free licenses / check-licenses (pull_request) Successful in 1m38s
				
			Add copyright notice / copyright_notice (pull_request) Successful in 3m16s
				
			Run unit tests / unit_tests (pull_request) Successful in 5m31s
				
			Build Nginx-based docker image / build-static-assets (pull_request) Successful in 41m31s
				
			
		
			
				
	
	
		
			79 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			79 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # 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
 |