Define a new endpoint to create simulations
All checks were successful
Run unit tests / copyright_notice (pull_request) Successful in 1m3s
Run unit tests / rubocop (pull_request) Successful in 1m28s
Run unit tests / check-licenses (pull_request) Successful in 1m33s
Run unit tests / unit_tests (pull_request) Successful in 1m4s
Run unit tests / build-static-assets (pull_request) Successful in 12m29s
All checks were successful
Run unit tests / copyright_notice (pull_request) Successful in 1m3s
Run unit tests / rubocop (pull_request) Successful in 1m28s
Run unit tests / check-licenses (pull_request) Successful in 1m33s
Run unit tests / unit_tests (pull_request) Successful in 1m4s
Run unit tests / build-static-assets (pull_request) Successful in 12m29s
This commit is contained in:
parent
707f05d81c
commit
998c0f43f3
@ -7,10 +7,11 @@ class TablesArrangementsController < ApplicationController
|
||||
current_digest = Tables::Distribution.digest(current_tenant)
|
||||
|
||||
render json: TablesArrangement
|
||||
.order(valid: :desc)
|
||||
.order(discomfort: :asc)
|
||||
.select(:id, :name, :discomfort)
|
||||
.select("digest = '#{current_digest}'::uuid as valid")
|
||||
.limit(3)
|
||||
.limit(20)
|
||||
.as_json(only: %i[id name discomfort valid])
|
||||
end
|
||||
|
||||
@ -23,6 +24,12 @@ class TablesArrangementsController < ApplicationController
|
||||
.then { |result| render json: { id: params[:id], tables: result } }
|
||||
end
|
||||
|
||||
def create
|
||||
TableSimulatorJob.perform_later(current_tenant.id)
|
||||
|
||||
render json: {}, status: :created
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def format(number:, guests:)
|
||||
|
@ -37,7 +37,7 @@ Rails.application.routes.draw do
|
||||
resources :expenses, only: %i[index create update destroy] do
|
||||
get :summary, on: :collection
|
||||
end
|
||||
resources :tables_arrangements, only: %i[index show]
|
||||
resources :tables_arrangements, only: %i[index show create]
|
||||
resources :summary, only: :index
|
||||
|
||||
root to: redirect("/%{slug}")
|
||||
|
@ -26,6 +26,19 @@ RSpec.describe 'tables_arrangements' do
|
||||
end
|
||||
regular_api_responses
|
||||
end
|
||||
|
||||
post('create tables arrangement') do
|
||||
tags 'Tables Arrangements'
|
||||
produces 'application/json'
|
||||
parameter Swagger::Schema::SLUG
|
||||
response(201, 'successful') do
|
||||
schema type: :object,
|
||||
required: [],
|
||||
properties: {}
|
||||
xit
|
||||
end
|
||||
regular_api_responses
|
||||
end
|
||||
end
|
||||
|
||||
path '/{slug}/tables_arrangements/{id}' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user