Manuel Bustillo
e20a366410
All checks were successful
Check usage of free licenses / check-licenses (pull_request) Successful in 56s
Add copyright notice / copyright_notice (pull_request) Successful in 1m36s
Run unit tests / unit_tests (pull_request) Successful in 3m56s
Build Nginx-based docker image / build-static-assets (pull_request) Successful in 28m26s
103 lines
2.7 KiB
Ruby
103 lines
2.7 KiB
Ruby
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
|
|
|
# frozen_string_literal: true
|
|
|
|
require 'swagger_helper'
|
|
|
|
RSpec.describe 'guests' do
|
|
path '/{slug}/guests' do
|
|
get('list guests') do
|
|
tags 'Guests'
|
|
produces 'application/json'
|
|
parameter Swagger::Schema::SLUG
|
|
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
|
|
regular_api_responses
|
|
end
|
|
|
|
post('create guest') do
|
|
tags 'Guests'
|
|
consumes 'application/json'
|
|
produces 'application/json'
|
|
parameter Swagger::Schema::SLUG
|
|
parameter name: :body, in: :body, schema: {
|
|
type: :object,
|
|
required: %i[guest],
|
|
properties: {
|
|
guest: {
|
|
type: :object,
|
|
required: %i[name status],
|
|
properties: {
|
|
name: { type: :string },
|
|
group_id: { type: :string, format: :uuid },
|
|
status: { type: :string, enum: Guest.statuses.keys }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
response_empty201
|
|
response422
|
|
regular_api_responses
|
|
end
|
|
end
|
|
|
|
path '/{slug}/guests/{id}' do
|
|
patch('update guest') do
|
|
tags 'Guests'
|
|
consumes 'application/json'
|
|
produces 'application/json'
|
|
parameter Swagger::Schema::SLUG
|
|
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 status],
|
|
properties: {
|
|
name: { type: :string },
|
|
group_id: { type: :string, format: :uuid },
|
|
status: { type: :string, enum: Guest.statuses.keys }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
response_empty200
|
|
response422
|
|
response404
|
|
regular_api_responses
|
|
end
|
|
|
|
delete('delete guest') do
|
|
tags 'Guests'
|
|
produces 'application/json'
|
|
parameter Swagger::Schema::SLUG
|
|
parameter name: 'id', in: :path, type: :string, format: :uuid
|
|
|
|
response_empty200
|
|
response404
|
|
regular_api_responses
|
|
end
|
|
end
|
|
end
|