2024-12-28 18:07:22 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-11-16 01:52:48 +00:00
|
|
|
# Copyright (C) 2024 Manuel Bustillo
|
|
|
|
|
2024-11-16 02:16:19 +01:00
|
|
|
require 'swagger_helper'
|
|
|
|
|
2024-12-28 18:07:22 +01:00
|
|
|
RSpec.describe 'guests' do
|
2024-11-30 19:57:08 +01:00
|
|
|
path '/{slug}/guests' do
|
2024-11-16 02:16:19 +01:00
|
|
|
get('list guests') do
|
|
|
|
tags 'Guests'
|
|
|
|
produces 'application/json'
|
2024-11-30 19:57:08 +01:00
|
|
|
parameter Swagger::Schema::SLUG
|
2024-11-16 02:16:19 +01:00
|
|
|
response(200, 'successful') do
|
|
|
|
schema type: :array,
|
|
|
|
items: {
|
|
|
|
type: :object,
|
|
|
|
required: %i[id name status group],
|
|
|
|
properties: {
|
|
|
|
id: { type: :string, format: :uuid },
|
|
|
|
name: { type: :string },
|
|
|
|
status: { type: :string, enum: Guest.statuses.keys },
|
|
|
|
group: { type: :object,
|
|
|
|
required: %i[id name],
|
|
|
|
properties: {
|
|
|
|
id: { type: :string, format: :uuid },
|
|
|
|
name: { type: :string }
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xit
|
|
|
|
end
|
2024-11-30 14:24:02 +01:00
|
|
|
regular_api_responses
|
2024-11-16 02:16:19 +01:00
|
|
|
end
|
2024-11-17 11:47:12 +01:00
|
|
|
|
|
|
|
post('create guest') do
|
|
|
|
tags 'Guests'
|
|
|
|
consumes 'application/json'
|
|
|
|
produces 'application/json'
|
2024-11-30 19:57:08 +01:00
|
|
|
parameter Swagger::Schema::SLUG
|
2024-11-17 11:47:12 +01:00
|
|
|
parameter name: :body, in: :body, schema: {
|
|
|
|
type: :object,
|
|
|
|
required: %i[guest],
|
|
|
|
properties: {
|
|
|
|
guest: {
|
|
|
|
type: :object,
|
2024-12-08 13:10:49 +01:00
|
|
|
required: %i[name status],
|
2024-11-17 11:47:12 +01:00
|
|
|
properties: {
|
|
|
|
name: { type: :string },
|
|
|
|
group_id: { type: :string, format: :uuid },
|
|
|
|
status: { type: :string, enum: Guest.statuses.keys }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-12-28 18:07:22 +01:00
|
|
|
response_empty201
|
|
|
|
response422
|
2024-11-30 14:24:02 +01:00
|
|
|
regular_api_responses
|
2024-11-17 11:47:12 +01:00
|
|
|
end
|
2024-11-16 02:16:19 +01:00
|
|
|
end
|
|
|
|
|
2024-11-30 19:57:08 +01:00
|
|
|
path '/{slug}/guests/{id}' do
|
2024-11-16 02:16:19 +01:00
|
|
|
patch('update guest') do
|
|
|
|
tags 'Guests'
|
|
|
|
consumes 'application/json'
|
|
|
|
produces 'application/json'
|
2024-11-30 19:57:08 +01:00
|
|
|
parameter Swagger::Schema::SLUG
|
2024-11-16 02:16:19 +01:00
|
|
|
parameter name: 'id', in: :path, type: :string, format: :uuid
|
|
|
|
parameter name: :body, in: :body, schema: {
|
|
|
|
type: :object,
|
|
|
|
required: %i[guest],
|
|
|
|
properties: {
|
|
|
|
guest: {
|
|
|
|
type: :object,
|
2024-12-08 13:10:49 +01:00
|
|
|
required: %i[name status],
|
2024-11-16 02:16:19 +01:00
|
|
|
properties: {
|
2024-11-17 17:07:29 +01:00
|
|
|
name: { type: :string },
|
2024-11-17 20:01:23 +01:00
|
|
|
group_id: { type: :string, format: :uuid },
|
2024-11-17 17:07:29 +01:00
|
|
|
status: { type: :string, enum: Guest.statuses.keys }
|
2024-11-16 02:16:19 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-12-28 18:07:22 +01:00
|
|
|
response_empty200
|
|
|
|
response422
|
|
|
|
response404
|
2024-11-30 14:24:02 +01:00
|
|
|
regular_api_responses
|
2024-11-16 02:16:19 +01:00
|
|
|
end
|
2024-11-17 18:24:43 +01:00
|
|
|
|
|
|
|
delete('delete guest') do
|
|
|
|
tags 'Guests'
|
|
|
|
produces 'application/json'
|
2024-11-30 19:57:08 +01:00
|
|
|
parameter Swagger::Schema::SLUG
|
2024-11-17 18:24:43 +01:00
|
|
|
parameter name: 'id', in: :path, type: :string, format: :uuid
|
|
|
|
|
2024-12-28 18:07:22 +01:00
|
|
|
response_empty200
|
|
|
|
response404
|
2024-11-30 14:24:02 +01:00
|
|
|
regular_api_responses
|
2024-11-17 18:24:43 +01:00
|
|
|
end
|
2024-11-16 02:16:19 +01:00
|
|
|
end
|
|
|
|
end
|