Compare commits
4 Commits
9e222f59be
...
5b3c1fdfac
Author | SHA1 | Date | |
---|---|---|---|
5b3c1fdfac | |||
8bff98b165 | |||
988e158d99 | |||
cf6ca5aa17 |
1
Gemfile
1
Gemfile
@ -20,6 +20,7 @@ gem 'jsonapi-rails'
|
|||||||
gem 'rack-cors'
|
gem 'rack-cors'
|
||||||
gem 'react-rails'
|
gem 'react-rails'
|
||||||
gem 'rubytree'
|
gem 'rubytree'
|
||||||
|
gem 'acts_as_tenant'
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem 'annotaterb'
|
gem 'annotaterb'
|
||||||
|
@ -72,6 +72,8 @@ GEM
|
|||||||
securerandom (>= 0.3)
|
securerandom (>= 0.3)
|
||||||
tzinfo (~> 2.0, >= 2.0.5)
|
tzinfo (~> 2.0, >= 2.0.5)
|
||||||
uri (>= 0.13.1)
|
uri (>= 0.13.1)
|
||||||
|
acts_as_tenant (1.0.1)
|
||||||
|
rails (>= 6.0)
|
||||||
addressable (2.8.7)
|
addressable (2.8.7)
|
||||||
public_suffix (>= 2.0.2, < 7.0)
|
public_suffix (>= 2.0.2, < 7.0)
|
||||||
annotaterb (4.13.0)
|
annotaterb (4.13.0)
|
||||||
@ -387,6 +389,7 @@ PLATFORMS
|
|||||||
x86_64-linux
|
x86_64-linux
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
acts_as_tenant
|
||||||
annotaterb
|
annotaterb
|
||||||
bootsnap
|
bootsnap
|
||||||
chroma
|
chroma
|
||||||
|
@ -10,8 +10,18 @@
|
|||||||
# pricing_type :enum default("fixed"), not null
|
# pricing_type :enum default("fixed"), not null
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
|
# wedding_id :uuid not null
|
||||||
|
#
|
||||||
|
# Indexes
|
||||||
|
#
|
||||||
|
# index_expenses_on_wedding_id (wedding_id)
|
||||||
|
#
|
||||||
|
# Foreign Keys
|
||||||
|
#
|
||||||
|
# fk_rails_... (wedding_id => weddings.id)
|
||||||
#
|
#
|
||||||
class Expense < ApplicationRecord
|
class Expense < ApplicationRecord
|
||||||
|
acts_as_tenant :wedding
|
||||||
enum :pricing_type,
|
enum :pricing_type,
|
||||||
fixed: 'fixed',
|
fixed: 'fixed',
|
||||||
per_person: 'per_person'
|
per_person: 'per_person'
|
||||||
|
@ -12,17 +12,22 @@
|
|||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
# parent_id :uuid
|
# parent_id :uuid
|
||||||
|
# wedding_id :uuid not null
|
||||||
#
|
#
|
||||||
# Indexes
|
# Indexes
|
||||||
#
|
#
|
||||||
# index_groups_on_name (name) UNIQUE
|
# index_groups_on_name (name) UNIQUE
|
||||||
# index_groups_on_parent_id (parent_id)
|
# index_groups_on_parent_id (parent_id)
|
||||||
|
# index_groups_on_wedding_id (wedding_id)
|
||||||
#
|
#
|
||||||
# Foreign Keys
|
# Foreign Keys
|
||||||
#
|
#
|
||||||
# fk_rails_... (parent_id => groups.id)
|
# fk_rails_... (parent_id => groups.id)
|
||||||
|
# fk_rails_... (wedding_id => weddings.id)
|
||||||
#
|
#
|
||||||
class Group < ApplicationRecord
|
class Group < ApplicationRecord
|
||||||
|
acts_as_tenant :wedding
|
||||||
|
|
||||||
validates :name, uniqueness: true
|
validates :name, uniqueness: true
|
||||||
validates :name, :order, presence: true
|
validates :name, :order, presence: true
|
||||||
|
|
||||||
|
@ -11,16 +11,20 @@
|
|||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
# group_id :uuid not null
|
# group_id :uuid not null
|
||||||
|
# wedding_id :uuid not null
|
||||||
#
|
#
|
||||||
# Indexes
|
# Indexes
|
||||||
#
|
#
|
||||||
# index_guests_on_group_id (group_id)
|
# index_guests_on_group_id (group_id)
|
||||||
|
# index_guests_on_wedding_id (wedding_id)
|
||||||
#
|
#
|
||||||
# Foreign Keys
|
# Foreign Keys
|
||||||
#
|
#
|
||||||
# fk_rails_... (group_id => groups.id)
|
# fk_rails_... (group_id => groups.id)
|
||||||
|
# fk_rails_... (wedding_id => weddings.id)
|
||||||
#
|
#
|
||||||
class Guest < ApplicationRecord
|
class Guest < ApplicationRecord
|
||||||
|
acts_as_tenant :wedding
|
||||||
belongs_to :group
|
belongs_to :group
|
||||||
|
|
||||||
enum :status, {
|
enum :status, {
|
||||||
|
@ -10,18 +10,22 @@
|
|||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
# guest_id :uuid not null
|
# guest_id :uuid not null
|
||||||
# tables_arrangement_id :uuid not null
|
# tables_arrangement_id :uuid not null
|
||||||
|
# wedding_id :uuid not null
|
||||||
#
|
#
|
||||||
# Indexes
|
# Indexes
|
||||||
#
|
#
|
||||||
# index_seats_on_guest_id (guest_id)
|
# index_seats_on_guest_id (guest_id)
|
||||||
# index_seats_on_tables_arrangement_id (tables_arrangement_id)
|
# index_seats_on_tables_arrangement_id (tables_arrangement_id)
|
||||||
|
# index_seats_on_wedding_id (wedding_id)
|
||||||
#
|
#
|
||||||
# Foreign Keys
|
# Foreign Keys
|
||||||
#
|
#
|
||||||
# fk_rails_... (guest_id => guests.id)
|
# fk_rails_... (guest_id => guests.id)
|
||||||
# fk_rails_... (tables_arrangement_id => tables_arrangements.id) ON DELETE => cascade
|
# fk_rails_... (tables_arrangement_id => tables_arrangements.id) ON DELETE => cascade
|
||||||
|
# fk_rails_... (wedding_id => weddings.id)
|
||||||
#
|
#
|
||||||
class Seat < ApplicationRecord
|
class Seat < ApplicationRecord
|
||||||
|
acts_as_tenant :wedding
|
||||||
belongs_to :guest
|
belongs_to :guest
|
||||||
belongs_to :table_arrangement
|
belongs_to :table_arrangement
|
||||||
end
|
end
|
||||||
|
@ -9,8 +9,18 @@
|
|||||||
# name :string not null
|
# name :string not null
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
|
# wedding_id :uuid not null
|
||||||
|
#
|
||||||
|
# Indexes
|
||||||
|
#
|
||||||
|
# index_tables_arrangements_on_wedding_id (wedding_id)
|
||||||
|
#
|
||||||
|
# Foreign Keys
|
||||||
|
#
|
||||||
|
# fk_rails_... (wedding_id => weddings.id)
|
||||||
#
|
#
|
||||||
class TablesArrangement < ApplicationRecord
|
class TablesArrangement < ApplicationRecord
|
||||||
|
acts_as_tenant :wedding
|
||||||
has_many :seats
|
has_many :seats
|
||||||
has_many :guests, through: :seats
|
has_many :guests, through: :seats
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development?
|
mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development?
|
||||||
|
scope ":slug", constraints: {slug: /[a-z]+/} do
|
||||||
devise_for :users, skip: [:registration, :session, :confirmation]
|
devise_for :users, skip: [:registration, :session, :confirmation]
|
||||||
devise_scope :user do
|
devise_scope :user do
|
||||||
post 'users', to: 'users/registrations#create'
|
post 'users', to: 'users/registrations#create'
|
||||||
@ -12,8 +13,6 @@ Rails.application.routes.draw do
|
|||||||
get '/users/confirmation', to: 'users/confirmations#show', as: :confirmation
|
get '/users/confirmation', to: 'users/confirmations#show', as: :confirmation
|
||||||
end
|
end
|
||||||
|
|
||||||
mount Rswag::Ui::Engine => '/api-docs'
|
|
||||||
mount Rswag::Api::Engine => '/api-docs'
|
|
||||||
resources :groups, only: :index
|
resources :groups, only: :index
|
||||||
resources :guests, only: %i[index create update destroy] do
|
resources :guests, only: %i[index create update destroy] do
|
||||||
post :bulk_update, on: :collection
|
post :bulk_update, on: :collection
|
||||||
@ -22,6 +21,11 @@ Rails.application.routes.draw do
|
|||||||
get :summary, on: :collection
|
get :summary, on: :collection
|
||||||
end
|
end
|
||||||
resources :tables_arrangements, only: %i[index show]
|
resources :tables_arrangements, only: %i[index show]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
mount Rswag::Ui::Engine => '/api-docs'
|
||||||
|
mount Rswag::Api::Engine => '/api-docs'
|
||||||
|
|
||||||
get 'up' => 'rails/health#show', as: :rails_health_check
|
get 'up' => 'rails/health#show', as: :rails_health_check
|
||||||
|
|
||||||
|
7
db/migrate/20241130185731_add_wedding_id_to_models.rb
Normal file
7
db/migrate/20241130185731_add_wedding_id_to_models.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
class AddWeddingIdToModels < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
[:expenses, :guests, :seats, :tables_arrangements, :groups].each do |table|
|
||||||
|
add_reference table, :wedding, type: :uuid, null: false, foreign_key: true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
17
db/schema.rb
generated
17
db/schema.rb
generated
@ -12,7 +12,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do
|
ActiveRecord::Schema[8.0].define(version: 2024_11_30_185731) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_catalog.plpgsql"
|
enable_extension "pg_catalog.plpgsql"
|
||||||
|
|
||||||
@ -26,6 +26,8 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do
|
|||||||
t.enum "pricing_type", default: "fixed", null: false, enum_type: "pricing_types"
|
t.enum "pricing_type", default: "fixed", null: false, enum_type: "pricing_types"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.uuid "wedding_id", null: false
|
||||||
|
t.index ["wedding_id"], name: "index_expenses_on_wedding_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "groups", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
create_table "groups", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||||
@ -36,8 +38,10 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do
|
|||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.uuid "parent_id"
|
t.uuid "parent_id"
|
||||||
t.string "color"
|
t.string "color"
|
||||||
|
t.uuid "wedding_id", null: false
|
||||||
t.index ["name"], name: "index_groups_on_name", unique: true
|
t.index ["name"], name: "index_groups_on_name", unique: true
|
||||||
t.index ["parent_id"], name: "index_groups_on_parent_id"
|
t.index ["parent_id"], name: "index_groups_on_parent_id"
|
||||||
|
t.index ["wedding_id"], name: "index_groups_on_wedding_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "guests", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
create_table "guests", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||||
@ -47,7 +51,9 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do
|
|||||||
t.uuid "group_id", null: false
|
t.uuid "group_id", null: false
|
||||||
t.integer "status", default: 0
|
t.integer "status", default: 0
|
||||||
t.string "name"
|
t.string "name"
|
||||||
|
t.uuid "wedding_id", null: false
|
||||||
t.index ["group_id"], name: "index_guests_on_group_id"
|
t.index ["group_id"], name: "index_guests_on_group_id"
|
||||||
|
t.index ["wedding_id"], name: "index_guests_on_wedding_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "seats", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
create_table "seats", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||||
@ -56,8 +62,10 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do
|
|||||||
t.integer "table_number"
|
t.integer "table_number"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.uuid "wedding_id", null: false
|
||||||
t.index ["guest_id"], name: "index_seats_on_guest_id"
|
t.index ["guest_id"], name: "index_seats_on_guest_id"
|
||||||
t.index ["tables_arrangement_id"], name: "index_seats_on_tables_arrangement_id"
|
t.index ["tables_arrangement_id"], name: "index_seats_on_tables_arrangement_id"
|
||||||
|
t.index ["wedding_id"], name: "index_seats_on_wedding_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||||
@ -186,6 +194,8 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do
|
|||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
|
t.uuid "wedding_id", null: false
|
||||||
|
t.index ["wedding_id"], name: "index_tables_arrangements_on_wedding_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
create_table "users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||||
@ -216,14 +226,19 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do
|
|||||||
t.index ["slug"], name: "index_weddings_on_slug", unique: true
|
t.index ["slug"], name: "index_weddings_on_slug", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_foreign_key "expenses", "weddings"
|
||||||
add_foreign_key "groups", "groups", column: "parent_id"
|
add_foreign_key "groups", "groups", column: "parent_id"
|
||||||
|
add_foreign_key "groups", "weddings"
|
||||||
add_foreign_key "guests", "groups"
|
add_foreign_key "guests", "groups"
|
||||||
|
add_foreign_key "guests", "weddings"
|
||||||
add_foreign_key "seats", "guests"
|
add_foreign_key "seats", "guests"
|
||||||
add_foreign_key "seats", "tables_arrangements", on_delete: :cascade
|
add_foreign_key "seats", "tables_arrangements", on_delete: :cascade
|
||||||
|
add_foreign_key "seats", "weddings"
|
||||||
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "tables_arrangements", "weddings"
|
||||||
end
|
end
|
||||||
|
66
db/seeds.rb
66
db/seeds.rb
@ -9,24 +9,23 @@ Group.delete_all
|
|||||||
|
|
||||||
Wedding.delete_all
|
Wedding.delete_all
|
||||||
|
|
||||||
Wedding.create!(date: 1.year.from_now)
|
ActsAsTenant.with_tenant(Wedding.create!(slug: :default, date: 1.year.from_now)) do
|
||||||
|
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
|
||||||
|
Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed')
|
||||||
|
Expense.create!(name: 'Catering', amount: 200, pricing_type: 'per_person')
|
||||||
|
Expense.create!(name: 'Flowers', amount: 500, pricing_type: 'fixed')
|
||||||
|
Expense.create!(name: 'Band', amount: 1000, pricing_type: 'fixed')
|
||||||
|
Expense.create!(name: 'Wedding planner', amount: 2000, pricing_type: 'fixed')
|
||||||
|
Expense.create!(name: 'Dress', amount: 1000, pricing_type: 'fixed')
|
||||||
|
Expense.create!(name: 'Suit', amount: 500, pricing_type: 'fixed')
|
||||||
|
Expense.create!(name: 'Rings', amount: 1000, pricing_type: 'fixed')
|
||||||
|
Expense.create!(name: 'Makeup', amount: 200, pricing_type: 'fixed')
|
||||||
|
Expense.create!(name: 'Hair', amount: 200, pricing_type: 'fixed')
|
||||||
|
Expense.create!(name: 'Transportation', amount: 3000, pricing_type: 'fixed')
|
||||||
|
Expense.create!(name: 'Invitations', amount: 200, pricing_type: 'fixed')
|
||||||
|
Expense.create!(name: 'Cake', amount: 500, pricing_type: 'fixed')
|
||||||
|
|
||||||
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
|
Group.create!(name: "Jim's guests", icon: 'pi pi-heart').tap do |parent|
|
||||||
Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed')
|
|
||||||
Expense.create!(name: 'Catering', amount: 200, pricing_type: 'per_person')
|
|
||||||
Expense.create!(name: 'Flowers', amount: 500, pricing_type: 'fixed')
|
|
||||||
Expense.create!(name: 'Band', amount: 1000, pricing_type: 'fixed')
|
|
||||||
Expense.create!(name: 'Wedding planner', amount: 2000, pricing_type: 'fixed')
|
|
||||||
Expense.create!(name: 'Dress', amount: 1000, pricing_type: 'fixed')
|
|
||||||
Expense.create!(name: 'Suit', amount: 500, pricing_type: 'fixed')
|
|
||||||
Expense.create!(name: 'Rings', amount: 1000, pricing_type: 'fixed')
|
|
||||||
Expense.create!(name: 'Makeup', amount: 200, pricing_type: 'fixed')
|
|
||||||
Expense.create!(name: 'Hair', amount: 200, pricing_type: 'fixed')
|
|
||||||
Expense.create!(name: 'Transportation', amount: 3000, pricing_type: 'fixed')
|
|
||||||
Expense.create!(name: 'Invitations', amount: 200, pricing_type: 'fixed')
|
|
||||||
Expense.create!(name: 'Cake', amount: 500, pricing_type: 'fixed')
|
|
||||||
|
|
||||||
Group.create!(name: "Jim's guests", icon: 'pi pi-heart').tap do |parent|
|
|
||||||
parent.children.create!(name: "Jim's family", icon: 'pi pi-users').tap do |family|
|
parent.children.create!(name: "Jim's family", icon: 'pi pi-users').tap do |family|
|
||||||
family.children.create!(name: "Jim's close family", icon: 'pi pi-home')
|
family.children.create!(name: "Jim's close family", icon: 'pi pi-home')
|
||||||
family.children.create!(name: "Jim's cousins", icon: 'pi pi-home')
|
family.children.create!(name: "Jim's cousins", icon: 'pi pi-home')
|
||||||
@ -36,9 +35,9 @@ Group.create!(name: "Jim's guests", icon: 'pi pi-heart').tap do |parent|
|
|||||||
parent.children.create!(name: "Jim's work", icon: 'pi pi-desktop').tap do |work|
|
parent.children.create!(name: "Jim's work", icon: 'pi pi-desktop').tap do |work|
|
||||||
work.children.create!(name: "Jim's besties at work", icon: 'pi pi-briefcase')
|
work.children.create!(name: "Jim's besties at work", icon: 'pi pi-briefcase')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Group.create!(name: "Pam's guests", icon: 'pi pi-heart-fill').tap do |parent|
|
Group.create!(name: "Pam's guests", icon: 'pi pi-heart-fill').tap do |parent|
|
||||||
parent.children.create!(name: "Pam's family", icon: 'pi pi-users').tap do |family|
|
parent.children.create!(name: "Pam's family", icon: 'pi pi-users').tap do |family|
|
||||||
family.children.create!(name: "Pam's close family", icon: 'pi pi-home')
|
family.children.create!(name: "Pam's close family", icon: 'pi pi-home')
|
||||||
family.children.create!(name: "Pam's cousins", icon: 'pi pi-home')
|
family.children.create!(name: "Pam's cousins", icon: 'pi pi-home')
|
||||||
@ -48,27 +47,34 @@ Group.create!(name: "Pam's guests", icon: 'pi pi-heart-fill').tap do |parent|
|
|||||||
parent.children.create!(name: "Pam's work", icon: 'pi pi-desktop').tap do |work|
|
parent.children.create!(name: "Pam's work", icon: 'pi pi-desktop').tap do |work|
|
||||||
work.children.create!(name: "Pam's besties at work", icon: 'pi pi-briefcase')
|
work.children.create!(name: "Pam's besties at work", icon: 'pi pi-briefcase')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Group.create!(name: 'Common guests', icon: 'pi pi-users').tap do |parent|
|
Group.create!(name: 'Common guests', icon: 'pi pi-users').tap do |parent|
|
||||||
parent.children.create!(name: 'College friends', icon: 'pi pi-calculator')
|
parent.children.create!(name: 'College friends', icon: 'pi pi-calculator')
|
||||||
parent.children.create!(name: 'High school friends', icon: 'pi pi-crown')
|
parent.children.create!(name: 'High school friends', icon: 'pi pi-crown')
|
||||||
parent.children.create!(name: 'Childhood friends', icon: 'pi pi-envelope')
|
parent.children.create!(name: 'Childhood friends', icon: 'pi pi-envelope')
|
||||||
end
|
end
|
||||||
|
|
||||||
groups = Group.all
|
groups = Group.all
|
||||||
|
|
||||||
NUMBER_OF_GUESTS.times do
|
NUMBER_OF_GUESTS.times do
|
||||||
Guest.create!(
|
Guest.create!(
|
||||||
name: Faker::Name.name,
|
name: Faker::Name.name,
|
||||||
phone: Faker::PhoneNumber.cell_phone,
|
phone: Faker::PhoneNumber.cell_phone,
|
||||||
group: groups.sample,
|
group: groups.sample,
|
||||||
status: Guest.statuses.keys.sample
|
status: Guest.statuses.keys.sample
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new })
|
||||||
|
|
||||||
|
'red'.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) }
|
||||||
|
|
||||||
|
Group.roots.each(&:colorize_children)
|
||||||
end
|
end
|
||||||
|
User.create!(
|
||||||
ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new })
|
email: 'development@example.com',
|
||||||
|
confirmed_at: Time.zone.now,
|
||||||
'red'.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) }
|
password: 'supersecretpassword',
|
||||||
|
password_confirmation: 'supersecretpassword',
|
||||||
Group.roots.each(&:colorize_children)
|
)
|
@ -3,10 +3,12 @@
|
|||||||
require 'swagger_helper'
|
require 'swagger_helper'
|
||||||
|
|
||||||
RSpec.describe 'expenses', type: :request do
|
RSpec.describe 'expenses', type: :request do
|
||||||
path '/expenses' do
|
path '/{slug}/expenses' do
|
||||||
get('list expenses') do
|
get('list expenses') do
|
||||||
tags 'Expenses'
|
tags 'Expenses'
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
|
parameter Swagger::Schema::SLUG
|
||||||
|
|
||||||
response(200, 'successful') do
|
response(200, 'successful') do
|
||||||
schema type: :array,
|
schema type: :array,
|
||||||
items: {
|
items: {
|
||||||
@ -26,12 +28,13 @@ RSpec.describe 'expenses', type: :request do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
path '/expenses/{id}' do
|
path '/{slug}/expenses/{id}' do
|
||||||
|
|
||||||
patch('update expense') do
|
patch('update expense') do
|
||||||
tags 'Expenses'
|
tags 'Expenses'
|
||||||
consumes 'application/json'
|
consumes 'application/json'
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
|
parameter Swagger::Schema::SLUG
|
||||||
parameter name: 'id', in: :path, type: :string, format: :uuid, description: 'id'
|
parameter name: 'id', in: :path, type: :string, format: :uuid, description: 'id'
|
||||||
parameter name: :body, in: :body, schema: {
|
parameter name: :body, in: :body, schema: {
|
||||||
type: :object,
|
type: :object,
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
require 'swagger_helper'
|
require 'swagger_helper'
|
||||||
|
|
||||||
RSpec.describe 'groups', type: :request do
|
RSpec.describe 'groups', type: :request do
|
||||||
path '/groups' do
|
path '/{slug}/groups' do
|
||||||
get('list groups') do
|
get('list groups') do
|
||||||
tags 'Groups'
|
tags 'Groups'
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
|
parameter Swagger::Schema::SLUG
|
||||||
response(200, 'successful') do
|
response(200, 'successful') do
|
||||||
schema type: :array,
|
schema type: :array,
|
||||||
items: {
|
items: {
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
require 'swagger_helper'
|
require 'swagger_helper'
|
||||||
|
|
||||||
RSpec.describe 'guests', type: :request do
|
RSpec.describe 'guests', type: :request do
|
||||||
path '/guests' do
|
path '/{slug}/guests' do
|
||||||
get('list guests') do
|
get('list guests') do
|
||||||
tags 'Guests'
|
tags 'Guests'
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
|
parameter Swagger::Schema::SLUG
|
||||||
response(200, 'successful') do
|
response(200, 'successful') do
|
||||||
schema type: :array,
|
schema type: :array,
|
||||||
items: {
|
items: {
|
||||||
@ -33,6 +34,7 @@ RSpec.describe 'guests', type: :request do
|
|||||||
tags 'Guests'
|
tags 'Guests'
|
||||||
consumes 'application/json'
|
consumes 'application/json'
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
|
parameter Swagger::Schema::SLUG
|
||||||
parameter name: :body, in: :body, schema: {
|
parameter name: :body, in: :body, schema: {
|
||||||
type: :object,
|
type: :object,
|
||||||
required: %i[guest],
|
required: %i[guest],
|
||||||
@ -55,11 +57,12 @@ RSpec.describe 'guests', type: :request do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
path '/guests/{id}' do
|
path '/{slug}/guests/{id}' do
|
||||||
patch('update guest') do
|
patch('update guest') do
|
||||||
tags 'Guests'
|
tags 'Guests'
|
||||||
consumes 'application/json'
|
consumes 'application/json'
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
|
parameter Swagger::Schema::SLUG
|
||||||
parameter name: 'id', in: :path, type: :string, format: :uuid
|
parameter name: 'id', in: :path, type: :string, format: :uuid
|
||||||
parameter name: :body, in: :body, schema: {
|
parameter name: :body, in: :body, schema: {
|
||||||
type: :object,
|
type: :object,
|
||||||
@ -85,6 +88,7 @@ RSpec.describe 'guests', type: :request do
|
|||||||
delete('delete guest') do
|
delete('delete guest') do
|
||||||
tags 'Guests'
|
tags 'Guests'
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
|
parameter Swagger::Schema::SLUG
|
||||||
parameter name: 'id', in: :path, type: :string, format: :uuid
|
parameter name: 'id', in: :path, type: :string, format: :uuid
|
||||||
|
|
||||||
response_empty_200
|
response_empty_200
|
||||||
|
@ -9,5 +9,13 @@ module Swagger
|
|||||||
updated_at: SwaggerResponseHelper::TIMESTAMP
|
updated_at: SwaggerResponseHelper::TIMESTAMP
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SLUG = {
|
||||||
|
name: 'slug',
|
||||||
|
in: :path,
|
||||||
|
type: :string,
|
||||||
|
example: :default,
|
||||||
|
description: 'Wedding slug'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -4,11 +4,12 @@ require 'swagger_helper'
|
|||||||
|
|
||||||
RSpec.describe 'users/confirmations', type: :request do
|
RSpec.describe 'users/confirmations', type: :request do
|
||||||
|
|
||||||
path '/users/confirmation' do
|
path '/{slug}/users/confirmation' do
|
||||||
get('confirm user email') do
|
get('confirm user email') do
|
||||||
tags 'Users'
|
tags 'Users'
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
|
|
||||||
|
parameter Swagger::Schema::SLUG
|
||||||
parameter name: :confirmation_token, in: :query, type: :string, required: true
|
parameter name: :confirmation_token, in: :query, type: :string, required: true
|
||||||
|
|
||||||
response(200, 'confirmed') do
|
response(200, 'confirmed') do
|
||||||
|
@ -4,12 +4,13 @@ require 'swagger_helper'
|
|||||||
|
|
||||||
RSpec.describe 'users/registrations', type: :request do
|
RSpec.describe 'users/registrations', type: :request do
|
||||||
|
|
||||||
path '/users' do
|
path '/{slug}/users' do
|
||||||
post('create registration') do
|
post('create registration') do
|
||||||
tags 'Users Registrations'
|
tags 'Users Registrations'
|
||||||
consumes 'application/json'
|
consumes 'application/json'
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
|
|
||||||
|
parameter Swagger::Schema::SLUG
|
||||||
parameter name: :body, in: :body, schema: {
|
parameter name: :body, in: :body, schema: {
|
||||||
type: :object,
|
type: :object,
|
||||||
required: [:user],
|
required: [:user],
|
||||||
|
@ -4,13 +4,14 @@ require 'swagger_helper'
|
|||||||
|
|
||||||
RSpec.describe 'users/sessions', type: :request do
|
RSpec.describe 'users/sessions', type: :request do
|
||||||
|
|
||||||
path '/users/sign_in' do
|
path '/{slug}/users/sign_in' do
|
||||||
|
|
||||||
post('create session') do
|
post('create session') do
|
||||||
tags 'Users Sessions'
|
tags 'Users Sessions'
|
||||||
consumes 'application/json'
|
consumes 'application/json'
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
|
|
||||||
|
parameter Swagger::Schema::SLUG
|
||||||
parameter name: :body, in: :body, schema: {
|
parameter name: :body, in: :body, schema: {
|
||||||
type: :object,
|
type: :object,
|
||||||
required: %i[user],
|
required: %i[user],
|
||||||
@ -35,8 +36,8 @@ RSpec.describe 'users/sessions', type: :request do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
path '/users/sign_out' do
|
path '/{slug}/users/sign_out' do
|
||||||
|
parameter Swagger::Schema::SLUG
|
||||||
delete('delete session') do
|
delete('delete session') do
|
||||||
tags 'Users Sessions'
|
tags 'Users Sessions'
|
||||||
consumes 'application/json'
|
consumes 'application/json'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user