Install acts_as_tenant gem and update documentation
This commit is contained in:
parent
cf6ca5aa17
commit
988e158d99
1
Gemfile
1
Gemfile
@ -20,6 +20,7 @@ gem 'jsonapi-rails'
|
||||
gem 'rack-cors'
|
||||
gem 'react-rails'
|
||||
gem 'rubytree'
|
||||
gem 'acts_as_tenant'
|
||||
|
||||
group :development, :test do
|
||||
gem 'annotaterb'
|
||||
|
@ -72,6 +72,8 @@ GEM
|
||||
securerandom (>= 0.3)
|
||||
tzinfo (~> 2.0, >= 2.0.5)
|
||||
uri (>= 0.13.1)
|
||||
acts_as_tenant (1.0.1)
|
||||
rails (>= 6.0)
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
annotaterb (4.13.0)
|
||||
@ -387,6 +389,7 @@ PLATFORMS
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
acts_as_tenant
|
||||
annotaterb
|
||||
bootsnap
|
||||
chroma
|
||||
|
@ -2,26 +2,30 @@
|
||||
|
||||
Rails.application.routes.draw do
|
||||
mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development?
|
||||
devise_for :users, skip: [:registration, :session, :confirmation]
|
||||
devise_scope :user do
|
||||
post 'users', to: 'users/registrations#create'
|
||||
scope ":slug", constraints: {slug: /[a-z]+/} do
|
||||
devise_for :users, skip: [:registration, :session, :confirmation]
|
||||
devise_scope :user do
|
||||
post 'users', to: 'users/registrations#create'
|
||||
|
||||
post '/users/sign_in', to: 'users/sessions#create'
|
||||
delete '/users/sign_out', to: 'users/sessions#destroy'
|
||||
post '/users/sign_in', to: 'users/sessions#create'
|
||||
delete '/users/sign_out', to: 'users/sessions#destroy'
|
||||
|
||||
get '/users/confirmation', to: 'users/confirmations#show', as: :confirmation
|
||||
get '/users/confirmation', to: 'users/confirmations#show', as: :confirmation
|
||||
end
|
||||
|
||||
resources :groups, only: :index
|
||||
resources :guests, only: %i[index create update destroy] do
|
||||
post :bulk_update, on: :collection
|
||||
end
|
||||
resources :expenses, only: %i[index update] do
|
||||
get :summary, on: :collection
|
||||
end
|
||||
resources :tables_arrangements, only: %i[index show]
|
||||
end
|
||||
|
||||
|
||||
mount Rswag::Ui::Engine => '/api-docs'
|
||||
mount Rswag::Api::Engine => '/api-docs'
|
||||
resources :groups, only: :index
|
||||
resources :guests, only: %i[index create update destroy] do
|
||||
post :bulk_update, on: :collection
|
||||
end
|
||||
resources :expenses, only: %i[index update] do
|
||||
get :summary, on: :collection
|
||||
end
|
||||
resources :tables_arrangements, only: %i[index show]
|
||||
|
||||
get 'up' => 'rails/health#show', as: :rails_health_check
|
||||
|
||||
|
@ -9,7 +9,7 @@ Group.delete_all
|
||||
|
||||
Wedding.delete_all
|
||||
|
||||
Wedding.create!(date: 1.year.from_now)
|
||||
Wedding.create!(slug: :default, date: 1.year.from_now)
|
||||
|
||||
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed')
|
||||
|
@ -3,10 +3,12 @@
|
||||
require 'swagger_helper'
|
||||
|
||||
RSpec.describe 'expenses', type: :request do
|
||||
path '/expenses' do
|
||||
path '/{slug}/expenses' do
|
||||
get('list expenses') do
|
||||
tags 'Expenses'
|
||||
produces 'application/json'
|
||||
parameter Swagger::Schema::SLUG
|
||||
|
||||
response(200, 'successful') do
|
||||
schema type: :array,
|
||||
items: {
|
||||
@ -26,12 +28,13 @@ RSpec.describe 'expenses', type: :request do
|
||||
end
|
||||
end
|
||||
|
||||
path '/expenses/{id}' do
|
||||
path '/{slug}/expenses/{id}' do
|
||||
|
||||
patch('update expense') do
|
||||
tags 'Expenses'
|
||||
consumes 'application/json'
|
||||
produces 'application/json'
|
||||
parameter Swagger::Schema::SLUG
|
||||
parameter name: 'id', in: :path, type: :string, format: :uuid, description: 'id'
|
||||
parameter name: :body, in: :body, schema: {
|
||||
type: :object,
|
||||
|
@ -3,10 +3,11 @@
|
||||
require 'swagger_helper'
|
||||
|
||||
RSpec.describe 'groups', type: :request do
|
||||
path '/groups' do
|
||||
path '/{slug}/groups' do
|
||||
get('list groups') do
|
||||
tags 'Groups'
|
||||
produces 'application/json'
|
||||
parameter Swagger::Schema::SLUG
|
||||
response(200, 'successful') do
|
||||
schema type: :array,
|
||||
items: {
|
||||
|
@ -3,10 +3,11 @@
|
||||
require 'swagger_helper'
|
||||
|
||||
RSpec.describe 'guests', type: :request do
|
||||
path '/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: {
|
||||
@ -33,6 +34,7 @@ RSpec.describe 'guests', type: :request do
|
||||
tags 'Guests'
|
||||
consumes 'application/json'
|
||||
produces 'application/json'
|
||||
parameter Swagger::Schema::SLUG
|
||||
parameter name: :body, in: :body, schema: {
|
||||
type: :object,
|
||||
required: %i[guest],
|
||||
@ -55,11 +57,12 @@ RSpec.describe 'guests', type: :request do
|
||||
end
|
||||
end
|
||||
|
||||
path '/guests/{id}' do
|
||||
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,
|
||||
@ -85,6 +88,7 @@ RSpec.describe 'guests', type: :request do
|
||||
delete('delete guest') do
|
||||
tags 'Guests'
|
||||
produces 'application/json'
|
||||
parameter Swagger::Schema::SLUG
|
||||
parameter name: 'id', in: :path, type: :string, format: :uuid
|
||||
|
||||
response_empty_200
|
||||
|
@ -9,5 +9,13 @@ module Swagger
|
||||
updated_at: SwaggerResponseHelper::TIMESTAMP
|
||||
|
||||
}
|
||||
|
||||
SLUG = {
|
||||
name: 'slug',
|
||||
in: :path,
|
||||
type: :string,
|
||||
example: :default,
|
||||
description: 'Wedding slug'
|
||||
}
|
||||
end
|
||||
end
|
@ -4,11 +4,12 @@ require 'swagger_helper'
|
||||
|
||||
RSpec.describe 'users/confirmations', type: :request do
|
||||
|
||||
path '/users/confirmation' do
|
||||
path '/{slug}/users/confirmation' do
|
||||
get('confirm user email') do
|
||||
tags 'Users'
|
||||
produces 'application/json'
|
||||
|
||||
parameter Swagger::Schema::SLUG
|
||||
parameter name: :confirmation_token, in: :query, type: :string, required: true
|
||||
|
||||
response(200, 'confirmed') do
|
||||
|
@ -4,12 +4,13 @@ require 'swagger_helper'
|
||||
|
||||
RSpec.describe 'users/registrations', type: :request do
|
||||
|
||||
path '/users' do
|
||||
path '/{slug}/users' do
|
||||
post('create registration') do
|
||||
tags 'Users Registrations'
|
||||
consumes 'application/json'
|
||||
produces 'application/json'
|
||||
|
||||
|
||||
parameter Swagger::Schema::SLUG
|
||||
parameter name: :body, in: :body, schema: {
|
||||
type: :object,
|
||||
required: [:user],
|
||||
|
@ -4,13 +4,14 @@ require 'swagger_helper'
|
||||
|
||||
RSpec.describe 'users/sessions', type: :request do
|
||||
|
||||
path '/users/sign_in' do
|
||||
path '/{slug}/users/sign_in' do
|
||||
|
||||
post('create session') do
|
||||
tags 'Users Sessions'
|
||||
consumes 'application/json'
|
||||
produces 'application/json'
|
||||
|
||||
parameter Swagger::Schema::SLUG
|
||||
parameter name: :body, in: :body, schema: {
|
||||
type: :object,
|
||||
required: %i[user],
|
||||
@ -35,8 +36,8 @@ RSpec.describe 'users/sessions', type: :request do
|
||||
end
|
||||
end
|
||||
|
||||
path '/users/sign_out' do
|
||||
|
||||
path '/{slug}/users/sign_out' do
|
||||
parameter Swagger::Schema::SLUG
|
||||
delete('delete session') do
|
||||
tags 'Users Sessions'
|
||||
consumes 'application/json'
|
||||
|
Loading…
x
Reference in New Issue
Block a user