From 9d90ade40c8c63a958d456fec89037efa281e99a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 8 Dec 2024 14:00:53 +0100 Subject: [PATCH 1/2] Document tables arrangements controller --- spec/requests/schemas.rb | 7 +++ spec/requests/tables_arrangements_spec.rb | 59 +++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 spec/requests/tables_arrangements_spec.rb diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index e8e8e9b..30a9b58 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -9,6 +9,13 @@ module Swagger updated_at: SwaggerResponseHelper::TIMESTAMP } + ID = { + name: 'id', + in: :path, + type: :string, + format: :uuid, + } + GROUP = { name: { type: :string }, icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' }, diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb new file mode 100644 index 0000000..2230d0c --- /dev/null +++ b/spec/requests/tables_arrangements_spec.rb @@ -0,0 +1,59 @@ +require 'swagger_helper' + +RSpec.describe 'tables_arrangements', type: :request do + + path '/{slug}/tables_arrangements' do + get('list tables arrangements') do + tags 'Tables Arrangements' + produces 'application/json' + parameter Swagger::Schema::SLUG + response(200, 'successful') do + schema type: :array, + items: { + type: :object, + required: %i[id name discomfort], + properties: { + id: { type: :string, format: :uuid }, + name: { type: :string }, + discomfort: { type: :integer } + } + } + xit + end + regular_api_responses + end + end + + path '/{slug}/tables_arrangements/{id}' do + get('show tables arrangement') do + tags 'Tables Arrangements' + produces 'application/json' + parameter Swagger::Schema::SLUG + parameter Swagger::Schema::ID + response(200, 'successful') do + schema type: :array, + items: { + type: :object, + required: %i[number guests], + properties: { + number: { type: :integer }, + guests: { + type: :array, + items: { + type: :object, + required: %i[id name color], + properties: { + id: { type: :string, format: :uuid }, + name: { type: :string }, + color: { type: :string } + } + } + } + } + } + xit + end + regular_api_responses + end + end +end From 5cbc81c4982f8d1fd513d861d95522af09d0ca7e Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 8 Dec 2024 13:02:08 +0000 Subject: [PATCH 2/2] Add copyright notice --- spec/requests/tables_arrangements_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index 2230d0c..1581d9a 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'tables_arrangements', type: :request do