2024-11-16 01:52:48 +00:00
|
|
|
# Copyright (C) 2024 Manuel Bustillo
|
|
|
|
|
2024-11-16 02:16:19 +01:00
|
|
|
require 'swagger_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'guests', type: :request do
|
|
|
|
path '/guests/bulk_update' do
|
|
|
|
post('Update multiple guests in a single request') do
|
|
|
|
tags 'Guests'
|
|
|
|
consumes 'application/json'
|
|
|
|
produces 'application/json'
|
|
|
|
parameter name: :body, in: :body, schema: {
|
|
|
|
type: :object,
|
|
|
|
required: %i[guest_ids properties],
|
|
|
|
properties: {
|
|
|
|
guest_ids: { type: :array, items: { type: :string, format: :uuid } },
|
|
|
|
properties: {
|
|
|
|
type: :object,
|
|
|
|
required: %i[status],
|
|
|
|
properties: {
|
|
|
|
status: { type: :string, enum: Guest.statuses.keys }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-11-16 10:22:10 +01:00
|
|
|
|
2024-11-16 02:16:19 +01:00
|
|
|
response_empty_200
|
|
|
|
response_422
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
path '/guests' do
|
|
|
|
get('list guests') do
|
|
|
|
tags 'Guests'
|
|
|
|
produces 'application/json'
|
|
|
|
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
|
|
|
|
end
|
2024-11-17 11:47:12 +01:00
|
|
|
|
|
|
|
post('create guest') do
|
|
|
|
tags 'Guests'
|
|
|
|
consumes 'application/json'
|
|
|
|
produces 'application/json'
|
|
|
|
parameter name: :body, in: :body, schema: {
|
|
|
|
type: :object,
|
|
|
|
required: %i[guest],
|
|
|
|
properties: {
|
|
|
|
guest: {
|
|
|
|
type: :object,
|
|
|
|
required: %i[name group_id status],
|
|
|
|
properties: {
|
|
|
|
name: { type: :string },
|
|
|
|
group_id: { type: :string, format: :uuid },
|
|
|
|
status: { type: :string, enum: Guest.statuses.keys }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
response_empty_201
|
|
|
|
response_422
|
|
|
|
end
|
2024-11-16 02:16:19 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
path '/guests/{id}' do
|
|
|
|
patch('update guest') do
|
|
|
|
tags 'Guests'
|
|
|
|
consumes 'application/json'
|
|
|
|
produces 'application/json'
|
|
|
|
parameter name: 'id', in: :path, type: :string, format: :uuid
|
|
|
|
parameter name: :body, in: :body, schema: {
|
|
|
|
type: :object,
|
|
|
|
required: %i[guest],
|
|
|
|
properties: {
|
|
|
|
guest: {
|
|
|
|
type: :object,
|
|
|
|
required: %i[name],
|
|
|
|
properties: {
|
|
|
|
name: { type: :string }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
response_empty_200
|
|
|
|
response_422
|
|
|
|
response_404
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|