From 5aa85d44c86c938a0a755213abf9773a2965f876 Mon Sep 17 00:00:00 2001 From: spaquet <176050+spaquet@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:27:40 -0800 Subject: [PATCH] Paywall (#145) * Gem updages * Fixing connectors in Settings * Sync plans with Stripe * Upgrading Turbo Rails to version 8.0.2 * Upgrading Rails 7.1.3.2 * Setting default statement_timeout value to 10 minutes * migration[7.1] * Better foreign_key creation * Aligning migration to online_migrations recommendations --- Gemfile | 26 +- Gemfile.lock | 222 ++++++------ app/controllers/application_controller.rb | 19 +- app/controllers/events_controller.rb | 144 ++++---- app/controllers/organization_controller.rb | 2 +- app/controllers/subscriptions_controller.rb | 8 +- app/controllers/webhooks/stripe_controller.rb | 46 ++- app/models/attendance.rb | 1 - app/models/concerns/subscribable.rb | 16 + app/models/event.rb | 2 +- app/models/group.rb | 1 - app/models/group_membership.rb | 1 - app/models/organization.rb | 6 +- app/models/poll.rb | 3 +- app/models/poll_answer.rb | 2 - app/models/poll_participation.rb | 1 - app/models/question.rb | 3 +- app/models/question_answer.rb | 1 - app/models/resource_invite.rb | 19 +- app/models/room.rb | 5 +- app/models/user.rb | 2 +- app/policies/application_policy.rb | 6 +- app/policies/event_policy.rb | 3 +- app/policies/organization_policy.rb | 10 +- app/policies/poll_policy.rb | 3 +- app/policies/resource_policy.rb | 10 +- app/policies/room_policy.rb | 2 + app/policies/settings_policy.rb | 2 + app/policies/user_policy.rb | 3 +- app/policies/welcome_policy.rb | 2 + app/views/connectors/index.html.erb | 205 +++++------ app/views/settings/_sidebar.html.erb | 4 +- app/views/subscriptions/index.html.erb | 25 +- config/environments/development.rb | 2 +- config/initializers/online_migrations.rb | 3 + db/migrate/20220419214313_enable_uuid.rb | 2 +- db/migrate/20220528004235_create_users.rb | 2 +- db/migrate/20220528004314_create_profiles.rb | 2 +- .../20220529204552_create_active_sessions.rb | 2 +- db/migrate/20220530003434_create_events.rb | 2 +- db/migrate/20220530003555_create_rooms.rb | 4 +- db/migrate/20220530004425_create_questions.rb | 17 +- ...te_active_storage_tables.active_storage.rb | 2 +- .../20220606033225_create_attendances.rb | 11 +- ...607232424_add_uid_and_provider_to_users.rb | 7 +- db/migrate/20220622180927_create_accounts.rb | 13 - .../20220622180927_create_organizations.rb | 13 + db/migrate/20220622183029_create_members.rb | 4 +- .../20220627215506_rolify_create_roles.rb | 2 +- ...0220629230932_add_anonymous_to_question.rb | 5 +- db/migrate/20220701215523_create_versions.rb | 2 +- db/migrate/20220703224559_create_votes.rb | 2 +- ...8163651_add_reject_cause_id_to_question.rb | 5 +- .../20220730021732_create_notifications.rb | 2 +- db/migrate/20220730203417_create_messages.rb | 2 +- ...811205958_create_ahoy_visits_and_events.rb | 2 +- ...0220907192723_add_parent_id_to_question.rb | 5 +- ...20230105225145_add_account_id_to_tables.rb | 48 --- ...105225145_add_organization_id_to_tables.rb | 49 +++ ...0230117215006_add_sso_fields_to_account.rb | 21 +- ...08_rename_account_model_to_organization.rb | 23 -- db/migrate/20230316015629_create_topics.rb | 2 +- .../20230317012332_add_tone_to_question.rb | 6 - .../20230320192611_add_timezone_to_user.rb | 5 +- ...30322221914_add_ai_response_to_question.rb | 2 +- ...20230325011418_add_keywords_to_question.rb | 2 +- .../20230331184052_create_merit_actions.rb | 6 +- ...230331184053_create_merit_activity_logs.rb | 4 +- db/migrate/20230331184054_create_sashes.rb | 4 +- .../20230331184055_create_badges_sashes.rb | 6 +- ...20230331184056_create_scores_and_points.rb | 8 +- ...0230331184103_add_merit_fields_to_users.rb | 9 +- .../20230405193622_add_invited_to_user.rb | 5 +- ...add_max_failed_attempts_to_organization.rb | 2 +- .../20230420201240_create_import_results.rb | 2 +- db/migrate/20230427212345_create_polls.rb | 16 +- .../20230501024923_create_poll_options.rb | 2 +- .../20230501024948_create_poll_answers.rb | 19 +- db/migrate/20230514234427_create_prompts.rb | 2 +- db/migrate/20230515175134_create_plans.rb | 2 +- .../20230515175407_create_subscriptions.rb | 2 +- ..._add_stripe_customer_id_to_organization.rb | 5 +- ...30705005152_add_unique_indexe_to_topics.rb | 5 +- ...20230705191628_create_food_for_thoughts.rb | 2 +- ...0230707190034_add_pew_points_to_profile.rb | 5 +- .../20230724181326_add_selector_to_poll.rb | 5 +- ...230725000820_create_poll_participations.rb | 11 +- db/migrate/20230725052107_update_poll.rb | 6 - ...155_remove_default_from_choice_in_votes.rb | 2 +- ...0230728232345_add_status_to_poll_option.rb | 5 +- .../20230730193848_create_resource_invites.rb | 19 +- db/migrate/20230802183841_create_groups.rb | 11 +- ...20230802183847_create_group_memberships.rb | 11 +- .../20230824194117_add_details_to_rooms.rb | 11 +- .../20230901073924_create_question_answers.rb | 11 +- db/schema.rb | 52 ++- lib/tasks/stripe_sync.rake | 57 +++ package.json | 10 +- test/fixtures/attendances.yml | 1 - test/fixtures/events.yml | 2 +- test/fixtures/group_memberships.yml | 1 - test/fixtures/groups.yml | 1 - test/fixtures/poll_answers.yml | 2 - test/fixtures/poll_participations.yml | 1 - test/fixtures/polls.yml | 3 +- test/fixtures/question_answers.yml | 1 - test/fixtures/questions.yml | 3 +- test/fixtures/rooms.yml | 5 +- test/fixtures/users.yml | 4 +- test/models/attendance_test.rb | 1 - test/models/event_test.rb | 2 +- test/models/group_membership_test.rb | 1 - test/models/group_test.rb | 1 - test/models/member_test.rb | 2 +- test/models/poll_answer_test.rb | 2 - test/models/poll_participation_test.rb | 1 - test/models/poll_test.rb | 3 +- test/models/question_answer_test.rb | 1 - test/models/question_test.rb | 3 +- test/models/resource_invite_test.rb | 19 +- test/models/room_test.rb | 5 +- test/models/user_test.rb | 2 +- yarn.lock | 324 +++++++++--------- 123 files changed, 970 insertions(+), 814 deletions(-) create mode 100644 app/models/concerns/subscribable.rb delete mode 100644 db/migrate/20220622180927_create_accounts.rb create mode 100644 db/migrate/20220622180927_create_organizations.rb delete mode 100644 db/migrate/20230105225145_add_account_id_to_tables.rb create mode 100644 db/migrate/20230105225145_add_organization_id_to_tables.rb delete mode 100644 db/migrate/20230124185308_rename_account_model_to_organization.rb delete mode 100644 db/migrate/20230317012332_add_tone_to_question.rb delete mode 100644 db/migrate/20230725052107_update_poll.rb create mode 100644 lib/tasks/stripe_sync.rake diff --git a/Gemfile b/Gemfile index 23b9bc20..2c615ca0 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ ruby '3.3.0' # IMPORTANT: This must be the first gem listed # Add support to appmap in development and test -gem 'appmap', '0.103.0', groups: %i[development test] +gem 'appmap', '1.0.0', groups: %i[development test] # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem 'rails', '~> 7.1.3' @@ -23,7 +23,7 @@ gem 'puma', '~> 6.4.2' gem 'jsbundling-rails', '~> 1.3.0' # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] -gem 'turbo-rails', '~> 1.5.0' +gem 'turbo-rails', '~> 2.0.0' # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] gem 'stimulus-rails', '~> 1.3.3' @@ -38,7 +38,7 @@ gem 'jbuilder' gem 'oj', '~> 3.16.1' # Use Redis adapter to run Action Cable in production -gem 'redis', '~> 5.0.5' +gem 'redis', '~> 5.1.0' # To speed up caching in production gem 'hiredis', '~> 0.6.3' @@ -47,13 +47,13 @@ gem 'hiredis', '~> 0.6.3' # gem 'kredis' # Sidekiq [https://github.com/mperham/sidekiq] -gem 'sidekiq', '~>7.2.0' +gem 'sidekiq', '~>7.2.2' # Add Noticed to support notifications [https://github.com/excid3/noticed] gem 'noticed', '~> 1.5' # Adding support to View Component (better than partials ;-) ) [https://github.com/github/view_component] -gem 'view_component', '~> 3.10.0' +gem 'view_component', '~> 3.11.0' # User authentication # Use Argon2 to hash passwords [https://github.com/technion/ruby-argon2] @@ -77,7 +77,7 @@ gem 'omniauth-google-oauth2', '~> 1.1.1' gem 'omniauth-rails_csrf_protection' # Adding invisible_captcha [https://github.com/markets/invisible_captcha] -gem 'invisible_captcha', '~> 2.1.0' +gem 'invisible_captcha', '~> 2.2.0' # Adding Pundit to manage authorizations [https://github.com/varvet/pundit] gem 'pundit' @@ -103,13 +103,13 @@ gem 'meta-tags', '~> 2.20.0' gem 'sendgrid-actionmailer', '~> 3.2.0' # Monitoring - Honeybadger [] -gem 'honeybadger', '~> 5.4.1' +gem 'honeybadger', '~> 5.5.0' # Use Sass to process CSS # gem "sassc-rails" # Nokogiri to parse HTML and more [https://github.com/sparklemotion/nokogiri] -gem 'nokogiri', '~> 1.15.0' +gem 'nokogiri', '~> 1.16.0' # Download gem 'down', '~> 5.0' @@ -127,13 +127,13 @@ gem 'ruby-vips', '>= 2.1.0' # Octokig [https://github.com/octokit/octokit.rb] # Mostly used to import openAI prompts from GitHub repo using the import_prompts.rake task -gem 'octokit', '~> 8.0.0' +gem 'octokit', '~> 8.1.0' # Pagination [https://github.com/ddnexus/pagy] -gem 'pagy', '~> 6.4.2' +gem 'pagy', '~> 7.0.1' # Countries [https://github.com/countries/countries] -gem 'countries', '~> 5.7.0', require: 'countries/global' +gem 'countries', '~> 6.0.0', require: 'countries/global' # Validate URL format [https://github.com/perfectline/validates_url] gem 'validate_url' @@ -155,7 +155,7 @@ gem 'ruby-openai', '~> 6.3.0' gem 'pg_search', '~> 2.3.6' # Stripe (payment, subscription processing) [https://github.com/stripe/stripe-ruby] -gem 'stripe', '~> 10.6.0' +gem 'stripe', '~> 10.9.0' # To enable retry in Faraday v2.0+ gem 'faraday-retry', '~> 2.2.0' @@ -164,7 +164,7 @@ gem 'faraday-retry', '~> 2.2.0' gem 'whenever', '~> 1.0.0', require: false # Add support online_migration (a strong_migration on steroid) [https://github.com/fatkodima/online_migrations] -gem 'online_migrations', '~> 0.13.0' +gem 'online_migrations', '~> 0.14.0' # Adding Scenic to better support online_migration [https://github.com/scenic-views/scenic] gem 'scenic', '~> 1.7.0' diff --git a/Gemfile.lock b/Gemfile.lock index c6732479..f38c384f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/faker-ruby/faker.git - revision: d355cc3ed6767c118729039839e2d7666c49ee56 + revision: 3f7371e2eb8fe074823570a7fba5d0d9a42257f7 specs: faker (3.2.3) i18n (>= 1.8.11, < 2) @@ -8,35 +8,35 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3) - actionpack (= 7.1.3) - activesupport (= 7.1.3) + actioncable (7.1.3.2) + actionpack (= 7.1.3.2) + activesupport (= 7.1.3.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3) - actionpack (= 7.1.3) - activejob (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + actionmailbox (7.1.3.2) + actionpack (= 7.1.3.2) + activejob (= 7.1.3.2) + activerecord (= 7.1.3.2) + activestorage (= 7.1.3.2) + activesupport (= 7.1.3.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.3) - actionpack (= 7.1.3) - actionview (= 7.1.3) - activejob (= 7.1.3) - activesupport (= 7.1.3) + actionmailer (7.1.3.2) + actionpack (= 7.1.3.2) + actionview (= 7.1.3.2) + activejob (= 7.1.3.2) + activesupport (= 7.1.3.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.3) - actionview (= 7.1.3) - activesupport (= 7.1.3) + actionpack (7.1.3.2) + actionview (= 7.1.3.2) + activesupport (= 7.1.3.2) nokogiri (>= 1.8.5) racc rack (>= 2.2.4) @@ -44,15 +44,15 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3) - actionpack (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + actiontext (7.1.3.2) + actionpack (= 7.1.3.2) + activerecord (= 7.1.3.2) + activestorage (= 7.1.3.2) + activesupport (= 7.1.3.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3) - activesupport (= 7.1.3) + actionview (7.1.3.2) + activesupport (= 7.1.3.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) @@ -62,22 +62,22 @@ GEM activemodel (>= 5.2.0) activestorage (>= 5.2.0) activesupport (>= 5.2.0) - activejob (7.1.3) - activesupport (= 7.1.3) + activejob (7.1.3.2) + activesupport (= 7.1.3.2) globalid (>= 0.3.6) - activemodel (7.1.3) - activesupport (= 7.1.3) - activerecord (7.1.3) - activemodel (= 7.1.3) - activesupport (= 7.1.3) + activemodel (7.1.3.2) + activesupport (= 7.1.3.2) + activerecord (7.1.3.2) + activemodel (= 7.1.3.2) + activesupport (= 7.1.3.2) timeout (>= 0.4.0) - activestorage (7.1.3) - actionpack (= 7.1.3) - activejob (= 7.1.3) - activerecord (= 7.1.3) - activesupport (= 7.1.3) + activestorage (7.1.3.2) + actionpack (= 7.1.3.2) + activejob (= 7.1.3.2) + activerecord (= 7.1.3.2) + activesupport (= 7.1.3.2) marcel (~> 1.0) - activesupport (7.1.3) + activesupport (7.1.3.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -99,7 +99,7 @@ GEM annotate (3.2.0) activerecord (>= 3.2, < 8.0) rake (>= 10.4, < 14.0) - appmap (0.103.0) + appmap (1.0.0) activesupport method_source rack @@ -109,17 +109,17 @@ GEM ffi-compiler (~> 1.0) ast (2.4.2) aws-eventstream (1.3.0) - aws-partitions (1.883.0) - aws-sdk-core (3.190.3) + aws-partitions (1.894.0) + aws-sdk-core (3.191.3) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.76.0) - aws-sdk-core (~> 3, >= 3.188.0) + aws-sdk-kms (1.77.0) + aws-sdk-core (~> 3, >= 3.191.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.142.0) - aws-sdk-core (~> 3, >= 3.189.0) + aws-sdk-s3 (1.143.0) + aws-sdk-core (~> 3, >= 3.191.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.8) aws-sigv4 (1.8.0) @@ -127,9 +127,9 @@ GEM base64 (0.2.0) bigdecimal (3.1.6) bindex (0.8.1) - bootsnap (1.17.1) + bootsnap (1.18.3) msgpack (~> 1.2) - brakeman (6.1.1) + brakeman (6.1.2) racc builder (3.2.4) bullet (7.1.6) @@ -156,11 +156,11 @@ GEM capistrano (~> 3.7) capistrano-bundler puma (>= 5.1, < 7.0) - capybara (3.39.2) + capybara (3.40.0) addressable matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) @@ -177,7 +177,7 @@ GEM chronic (0.10.2) concurrent-ruby (1.2.3) connection_pool (2.4.1) - countries (5.7.1) + countries (6.0.0) unaccent (~> 0.3) crass (1.0.6) cssbundling-rails (1.4.0) @@ -213,13 +213,14 @@ GEM activesupport (>= 6.1) hashie (5.0.0) hiredis (0.6.3) - honeybadger (5.4.1) + honeybadger (5.5.0) htmlentities (4.3.4) - http (5.1.1) + http (5.2.0) addressable (~> 2.8) + base64 (~> 0.1) http-cookie (~> 1.0) http-form_data (~> 2.2) - llhttp-ffi (~> 0.4.0) + llhttp-ffi (~> 0.5.0) http-cookie (1.0.5) domain_name (~> 0.5) http-form_data (2.3.0) @@ -228,10 +229,10 @@ GEM image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - invisible_captcha (2.1.0) + invisible_captcha (2.2.0) rails (>= 5.2) io-console (0.7.2) - irb (1.11.1) + irb (1.11.2) rdoc reline (>= 0.4.2) jbuilder (2.11.5) @@ -241,9 +242,10 @@ GEM jsbundling-rails (1.3.0) railties (>= 6.0.0) json (2.7.1) - jwt (2.7.1) + jwt (2.8.0) + base64 language_server-protocol (3.17.0.3) - llhttp-ffi (0.4.0) + llhttp-ffi (0.5.0) ffi-compiler (~> 1.0) rake (~> 13.0) loofah (2.22.0) @@ -264,15 +266,14 @@ GEM method_source (1.0.0) mini_magick (4.12.0) mini_mime (1.1.5) - mini_portile2 (2.8.5) - minitest (5.21.2) + minitest (5.22.2) msgpack (1.7.2) multi_xml (0.6.0) - multipart-post (2.3.0) + multipart-post (2.4.0) mutex_m (0.2.0) net-http (0.4.1) uri - net-imap (0.4.9.1) + net-imap (0.4.10) date net-protocol net-pop (0.1.2) @@ -287,8 +288,11 @@ GEM net-protocol net-ssh (7.2.1) nio4r (2.7.0) - nokogiri (1.15.5) - mini_portile2 (~> 2.8.2) + nokogiri (1.16.2-aarch64-linux) + racc (~> 1.4) + nokogiri (1.16.2-arm64-darwin) + racc (~> 1.4) + nokogiri (1.16.2-x86_64-linux) racc (~> 1.4) noticed (1.6.3) http (>= 4.0.0) @@ -300,7 +304,8 @@ GEM rack (>= 1.2, < 4) snaky_hash (~> 2.0) version_gem (~> 1.1) - octokit (8.0.0) + octokit (8.1.0) + base64 faraday (>= 1, < 3) sawyer (~> 0.9) oj (3.16.3) @@ -320,9 +325,9 @@ GEM omniauth-rails_csrf_protection (1.0.1) actionpack (>= 4.2) omniauth (~> 2.0) - online_migrations (0.13.0) + online_migrations (0.14.1) activerecord (>= 6.1) - pagy (6.4.3) + pagy (7.0.4) paper_trail (15.1.0) activerecord (>= 6.1) request_store (~> 1.4) @@ -330,7 +335,7 @@ GEM parser (3.3.0.5) ast (~> 2.4.1) racc - pg (1.5.4) + pg (1.5.5) pg_search (2.3.6) activerecord (>= 5.2) activesupport (>= 5.2) @@ -342,7 +347,7 @@ GEM pundit (2.3.1) activesupport (>= 3.0.0) racc (1.7.3) - rack (3.0.8) + rack (3.0.9.1) rack-protection (4.0.0) base64 (>= 0.1.0) rack (>= 3.0.0, < 4) @@ -353,20 +358,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.1.3) - actioncable (= 7.1.3) - actionmailbox (= 7.1.3) - actionmailer (= 7.1.3) - actionpack (= 7.1.3) - actiontext (= 7.1.3) - actionview (= 7.1.3) - activejob (= 7.1.3) - activemodel (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + rails (7.1.3.2) + actioncable (= 7.1.3.2) + actionmailbox (= 7.1.3.2) + actionmailer (= 7.1.3.2) + actionpack (= 7.1.3.2) + actiontext (= 7.1.3.2) + actionview (= 7.1.3.2) + activejob (= 7.1.3.2) + activemodel (= 7.1.3.2) + activerecord (= 7.1.3.2) + activestorage (= 7.1.3.2) + activesupport (= 7.1.3.2) bundler (>= 1.15.0) - railties (= 7.1.3) + railties (= 7.1.3.2) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -374,9 +379,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.3) - actionpack (= 7.1.3) - activesupport (= 7.1.3) + railties (7.1.3.2) + actionpack (= 7.1.3.2) + activesupport (= 7.1.3.2) irb rackup (>= 1.0.0) rake (>= 12.2) @@ -386,20 +391,20 @@ GEM rake (13.1.0) rdoc (6.6.2) psych (>= 4.0.0) - redis (5.0.8) + redis (5.1.0) redis-client (>= 0.17.0) - redis-client (0.19.1) + redis-client (0.20.0) connection_pool regexp_parser (2.9.0) reline (0.4.2) io-console (~> 0.5) - request_store (1.5.1) + request_store (1.6.0) rack (>= 1.4) reverse_markdown (2.1.1) nokogiri rexml (3.2.6) rolify (6.0.1) - rubocop (1.60.1) + rubocop (1.60.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -422,7 +427,7 @@ GEM faraday (>= 1) faraday-multipart (>= 1) ruby-progressbar (1.13.0) - ruby-vips (2.2.0) + ruby-vips (2.2.1) ffi (~> 1.12) ruby2_keywords (0.0.5) ruby_http_client (3.5.5) @@ -434,7 +439,8 @@ GEM scenic (1.7.0) activerecord (>= 4.0.0) railties (>= 4.0.0) - selenium-webdriver (4.16.0) + selenium-webdriver (4.18.1) + base64 (~> 0.2) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -443,7 +449,7 @@ GEM sendgrid-ruby (~> 6.4) sendgrid-ruby (6.7.0) ruby_http_client (~> 3.4) - sidekiq (7.2.1) + sidekiq (7.2.2) concurrent-ruby (< 2) connection_pool (>= 2.3.0) rack (>= 2.2.4) @@ -472,10 +478,10 @@ GEM stimulus-rails (1.3.3) railties (>= 6.0.0) stringio (3.1.0) - stripe (10.6.0) + stripe (10.9.0) thor (1.3.0) timeout (0.4.1) - turbo-rails (1.5.0) + turbo-rails (2.0.4) actionpack (>= 6.0.0) activejob (>= 6.0.0) railties (>= 6.0.0) @@ -489,7 +495,7 @@ GEM activemodel (>= 3.0.0) public_suffix version_gem (1.1.3) - view_component (3.10.0) + view_component (3.11.0) activesupport (>= 5.2.0, < 8.0) concurrent-ruby (~> 1.0) method_source (~> 1.0) @@ -509,7 +515,7 @@ GEM nokogiri (~> 1.8) xsv (1.3.0) rubyzip (>= 1.3, < 3) - zeitwerk (2.6.12) + zeitwerk (2.6.13) PLATFORMS aarch64-linux-musl @@ -521,7 +527,7 @@ DEPENDENCIES active_storage_validations (~> 1.1.3) ahoy_matey (~> 4.2.1) annotate (~> 3.2.0) - appmap (= 0.103.0) + appmap (= 1.0.0) argon2 (~> 2.3.0) aws-sdk-s3 bootsnap @@ -537,7 +543,7 @@ DEPENDENCIES caxlsx (~> 4.0.0) caxlsx_rails chartkick - countries (~> 5.7.0) + countries (~> 6.0.0) cssbundling-rails (~> 1.4.0) debug down (~> 5.0) @@ -545,29 +551,29 @@ DEPENDENCIES faraday-retry (~> 2.2.0) groupdate hiredis (~> 0.6.3) - honeybadger (~> 5.4.1) + honeybadger (~> 5.5.0) image_processing (~> 1.2) - invisible_captcha (~> 2.1.0) + invisible_captcha (~> 2.2.0) jbuilder jsbundling-rails (~> 1.3.0) merit meta-tags (~> 2.20.0) - nokogiri (~> 1.15.0) + nokogiri (~> 1.16.0) noticed (~> 1.5) - octokit (~> 8.0.0) + octokit (~> 8.1.0) oj (~> 3.16.1) omniauth (~> 2.1.0) omniauth-google-oauth2 (~> 1.1.1) omniauth-rails_csrf_protection - online_migrations (~> 0.13.0) - pagy (~> 6.4.2) + online_migrations (~> 0.14.0) + pagy (~> 7.0.1) paper_trail (~> 15.1.0) pg (~> 1.5.4) pg_search (~> 2.3.6) puma (~> 6.4.2) pundit rails (~> 7.1.3) - redis (~> 5.0.5) + redis (~> 5.1.0) rolify (~> 6.0.0) rubocop (~> 1.50) rubocop-rails @@ -576,15 +582,15 @@ DEPENDENCIES scenic (~> 1.7.0) selenium-webdriver sendgrid-actionmailer (~> 3.2.0) - sidekiq (~> 7.2.0) + sidekiq (~> 7.2.2) simplecov sprockets-rails stimulus-rails (~> 1.3.3) - stripe (~> 10.6.0) - turbo-rails (~> 1.5.0) + stripe (~> 10.9.0) + turbo-rails (~> 2.0.0) tzinfo-data validate_url - view_component (~> 3.10.0) + view_component (~> 3.11.0) web-console whenever (~> 1.0.0) xsv diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b3df5806..5d969ec7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -12,21 +12,22 @@ class ApplicationController < ActionController::Base private def user_not_authorized - flash[:alert] = "You are not authorized to perform this action." - redirect_to(request.referrer || root_path) + if current_user&.organization&.active_subscription? + redirect_to(root_path, alert: 'You are not authorized to perform this action.') + else + redirect_to(subscriptions_path, alert: 'You need an active subscription to access this feature.') + end end - def switch_timezone(&action) - Time.use_zone(timezone_from_cookies, &action) + def switch_timezone(&) + Time.use_zone(timezone_from_cookies, &) rescue TZInfo::UnknownTimezone, TZInfo::InvalidTimezoneIdentifier Time.zone end def timezone_from_cookies - if cookies[:timezone].nil? - return "Etc/UTC" - else - return cookies[:timezone] - end + return 'Etc/UTC' if cookies[:timezone].nil? + + cookies[:timezone] end end diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 19380bca..2c8b985a 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -1,13 +1,24 @@ class EventsController < ApplicationController include Invitable - + before_action :authenticate_user!, only: %i[index edit destroy update new] before_action :redirect_if_unauthenticated, only: %i[index edit destroy update new] before_action :set_event, except: %i[index new create event validate_pin user_stats] - before_action :authorize_event, only: [:show, :edit, :update, :stats, :export, :destroy] + before_action :authorize_event, only: %i[show edit update stats export destroy] def index - @events = policy_scope(Event).includes(:user => :profile).order(start_date: :desc) + @events = policy_scope(Event).includes(user: :profile).order(start_date: :desc) + end + + # GET /events/:id + def show + # If there is only one default room, we redirect to that room. + # If there is more than one room or if the room has a different name than __default__ + # we display the event show page + return unless @event.rooms.count == 1 && @event.rooms.first.name.downcase == '__default__' + + redirect_to(room_questions_path(@event.rooms.first)) + nil end def new @@ -16,6 +27,10 @@ def new @event = current_user.events.new end + def edit + @invited_users = fetch_invited_users(@event) + end + def create is_confirmed? and return @@ -24,18 +39,18 @@ def create # Flowbite Datepicker returns the date formatted as mm/dd/yyyy # This format must be aligned with the expected datetime (aka timestamp) used by ActiveRecord # Using Date.parse leads to strange result such as April 1st being converted to Jan 1st - @event.start_date = Date.strptime(create_event_params[:start_date], "%m/%d/%Y") - @event.end_date = Date.strptime(create_event_params[:end_date], "%m/%d/%Y") - + @event.start_date = Date.strptime(create_event_params[:start_date], '%m/%d/%Y') + @event.end_date = Date.strptime(create_event_params[:end_date], '%m/%d/%Y') + if @event.save # Make the user the admin of the event - current_user.add_role :admin, @event + current_user.add_role(:admin, @event) - # Trigger the invitation if the event is not universal. Event type is tested in + # Trigger the invitation if the event is not universal. Event type is tested in # ResourceInviteService # params[:invited_users] is already a JSON so we pass it as it is to the next # steps as Sidekiq is expecting this format. - ResourceInviteService.new(params[:invited_users], current_user.id, @event).create if !params[:invited_users].blank? + ResourceInviteService.new(params[:invited_users], current_user.id, @event).create if params[:invited_users].present? # When a new event is create we attach a default room. room = @event.rooms.new @@ -47,42 +62,27 @@ def create room.room_type = @event.event_type if room.save # Make the user the admin of the default room - current_user.add_role :admin, room + current_user.add_role(:admin, room) - redirect_to events_path, notice: "Event was successfully created." + redirect_to(events_path, notice: 'Event was successfully created.') else - flash[:alert] = "An error prevented the event from being created" - render :new, status: :unprocessable_entity + flash[:alert] = 'An error prevented the event from being created' + render(:new, status: :unprocessable_entity) end else - flash[:alert] = "An error prevented the event from being created" - render :new, status: :unprocessable_entity - end - end - - # GET /events/:id - def show - # If there is only one default room, we redirect to that room. - # If there is more than one room or if the room has a different name than __default__ - # we display the event show page - if @event.rooms.count == 1 && @event.rooms.first.name.downcase == "__default__" - redirect_to room_questions_path(@event.rooms.first) - return + flash[:alert] = 'An error prevented the event from being created' + render(:new, status: :unprocessable_entity) end end - def edit - @invited_users = fetch_invited_users(@event) - end - # GET /event/:id/stats def stats @questions = Question.where(room_id: @event.rooms.first.id).order(status: :desc).order(created_at: :desc) @count = @questions.count - if @count > 0 - @approved_count = @questions.approved.count - @answered_count = @questions.answered.count - end + return unless @count > 0 + + @approved_count = @questions.approved.count + @answered_count = @questions.answered.count end def update @@ -94,24 +94,24 @@ def update # This format must be aligned with the expected datetime (aka timestamp) used by ActiveRecord # Using Date.parse leads to strange result such as April 1st being converted to Jan 1st attributes = update_event_params.clone - attributes[:start_date] = Date.strptime(update_event_params[:start_date], "%m/%d/%Y") - attributes[:end_date] = Date.strptime(update_event_params[:end_date], "%m/%d/%Y") + attributes[:start_date] = Date.strptime(update_event_params[:start_date], '%m/%d/%Y') + attributes[:end_date] = Date.strptime(update_event_params[:end_date], '%m/%d/%Y') - # Update the invitation if the event is not universal. Event type is tested in + # Update the invitation if the event is not universal. Event type is tested in # ResourceInviteService # params[:invited_users] is already a JSON so we pass it as it is to the next # steps as Sidekiq is expecting this format. - ResourceInviteService.new(params[:invited_users], current_user.id, @event).update if !params[:invited_users].blank? + ResourceInviteService.new(params[:invited_users], current_user.id, @event).update if params[:invited_users].present? if @event.update(attributes) if @event.saved_changes? - redirect_to events_path, notice: "Event was successfully updated." + redirect_to(events_path, notice: 'Event was successfully updated.') else - redirect_to events_path, notice: "No changes were made." + redirect_to(events_path, notice: 'No changes were made.') end else - flash[:alert] = "An error prevented the event from being created" - render :edit, status: :unprocessable_entity + flash[:alert] = 'An error prevented the event from being created' + render(:edit, status: :unprocessable_entity) end end @@ -128,23 +128,23 @@ def event if @event format.html { redirect_to(room_questions_path(@event.rooms.first), notice: 'Welcome in!') } else - format.html { redirect_to(root_path(), alert: 'Invalid PIN', status: :unprocessable_entity) } + format.html { redirect_to(root_path, alert: 'Invalid PIN', status: :unprocessable_entity) } end end end # GET /event/:id/export def export - @room = @event.rooms.first + @room = @event.rooms.first @questions = Question.where(room_id: @room.id) respond_to do |format| - format.xlsx { + format.xlsx do response.headers[ 'Content-Disposition' - ] = "attachment; filename=event-#{DateTime.now.strftime("%d%m%Y%H%M")}.xlsx" - } + ] = "attachment; filename=event-#{DateTime.now.strftime('%d%m%Y%H%M')}.xlsx" + end end end @@ -162,33 +162,31 @@ def user_stats # Number of votes collected by these questions @votes_on_user_event_questions_count = Vote.where(votable: questions_on_user_events).count - + # Stats for the events created by the user @created_events_count = user_event_ids.count - # Questions asked by the user in any event @questions_asked_count = Question.where(user_id: current_user.id).count - + # Votes casted by the user for questions in any event - @votes_on_questions_count = Vote.joins("INNER JOIN questions ON votes.votable_id = questions.id") + @votes_on_questions_count = Vote.joins('INNER JOIN questions ON votes.votable_id = questions.id') .where("votes.votable_type = 'Question' AND questions.user_id = ?", current_user.id).count - + # Votes casted by the user for any votable type @total_votes_casted_by_user = Vote.where(user_id: current_user.id).count - + # Event creation key dates @first_event_date = current_user.events.order(:created_at).first&.created_at @last_event_date = current_user.events.order(:created_at).last&.created_at - + # Key dates related to the user's participation in events (via questions & votes) @first_question_date = Question.where(user_id: current_user.id).order(:created_at).first&.created_at @last_question_date = Question.where(user_id: current_user.id).order(:created_at).last&.created_at - + # @first_vote_date = Vote.where(votable_type: 'Question', user_id: current_user.id).order(:created_at).first&.created_at # @last_vote_date = Vote.where(votable_type: 'Question', user_id: current_user.id).order(:created_at).last&.created_at end - # POST / def validate_pin @@ -196,14 +194,14 @@ def validate_pin # Validate the PIN format first validate_pin_format(pin) and return - + @event = Event.find_by(short_code: pin) respond_to do |format| if @event format.html { redirect_to(room_questions_path(@event.rooms.first.id), notice: 'Welcome in!') } else - format.html { redirect_to(root_path(), alert: "No event matches this pin number: #{pin}.", status: :unprocessable_entity) } + format.html { redirect_to(root_path, alert: "No event matches this pin number: #{pin}.", status: :unprocessable_entity) } end end end @@ -218,17 +216,17 @@ def destroy else flash.now[:alert] = 'Something went wrong' end - redirect_to events_path + redirect_to(events_path) end private def authorize_event - authorize @event + authorize(@event) end def rooms_by_blocks - rooms.order("DATE(start_date), EXTRACT(HOUR FROM start_date), EXTRACT(MINUTE FROM start_date), name") + rooms.order('DATE(start_date), EXTRACT(HOUR FROM start_date), EXTRACT(MINUTE FROM start_date), name') end def set_event @@ -236,27 +234,31 @@ def set_event end def create_event_params - params.require(:event).permit(:allow_anonymous, :always_on, :description, :event_type, :name, :public_description, :start_date, :status, :end_date) + params.require(:event).permit(:allow_anonymous, :always_on, :description, :event_type, :name, :public_description, :start_date, :status, + :end_date + ) end def update_event_params - params.require(:event).permit(:allow_anonymous, :always_on, :description, :event_type, :name, :public_description, :short_code, :start_date, :status, :end_date) + params.require(:event).permit(:allow_anonymous, :always_on, :description, :event_type, :name, :public_description, :short_code, :start_date, + :status, :end_date + ) end # Called to make sure a user's account is confirmed before they can create or edit an event. def is_confirmed? - if !current_user.confirmed? - flash[:alert] = 'You must confirm your email address before you can create or edit an event.' - redirect_to(edit_account_path(current_user)) and return true - end + return if current_user.confirmed? + + flash[:alert] = 'You must confirm your email address before you can create or edit an event.' + redirect_to(edit_account_path(current_user)) and return true end # Used to valide that the pin format is valid # Used by the show method def validate_pin_format(pin) - if pin.blank? || pin.length != 6 || (pin.is_a? Integer) - flash.now[:alert] = "Invalid PIN format" - redirect_to root_path, status: 406 and return true - end + return unless pin.blank? || pin.length != 6 || pin.is_a?(Integer) + + flash.now[:alert] = 'Invalid PIN format' + redirect_to(root_path, status: :not_acceptable) and return true end end diff --git a/app/controllers/organization_controller.rb b/app/controllers/organization_controller.rb index dd90a396..6e9aaaf4 100644 --- a/app/controllers/organization_controller.rb +++ b/app/controllers/organization_controller.rb @@ -18,7 +18,7 @@ def show def edit # TODO: add a condition for when a user is an admin for the account. # Current code only displays account information when the user is the owner - @organization.name = nil if @organization.name === '__default__' + @organization.name = nil if @organization.name == '__default__' end # PUT /organization/:id diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb index 5a87237a..4cb7f7e6 100644 --- a/app/controllers/subscriptions_controller.rb +++ b/app/controllers/subscriptions_controller.rb @@ -8,9 +8,9 @@ class SubscriptionsController < ApplicationController # GET /subscriptions def index @plans = Plan.where(active: true) - @starter = @plans.find_by(label: 'starter') - @pro = @plans.find_by(label: 'pro') - @enterprise = @plans.find_by(label: 'enterprise') + @starter = @plans.find_by(label: 'Starter') + @pro = @plans.find_by(label: 'Pro') + @enterprise = @plans.find_by(label: 'Enterprise') end def new @@ -85,7 +85,6 @@ def create organization = Organization.new organization.name = organization_name organization.website = organization_website - organization.owner = true unless organization.save user.destroy @@ -97,6 +96,7 @@ def create member = Member.new member.organization_id = organization.id member.user_id = user.id + member.owner = true unless member.save user.destroy organization.destroy diff --git a/app/controllers/webhooks/stripe_controller.rb b/app/controllers/webhooks/stripe_controller.rb index 0d9d3831..8d38eb02 100644 --- a/app/controllers/webhooks/stripe_controller.rb +++ b/app/controllers/webhooks/stripe_controller.rb @@ -5,11 +5,11 @@ def create # docs: https://stripe.com/docs/payments/checkout/fulfill-orders # receive POST from Stripe payload = request.body.read - signature_header = request.env["HTTP_STRIPE_SIGNATURE"] + signature_header = request.env['HTTP_STRIPE_SIGNATURE'] # Stripe webhook secret passed as environment variable - endpoint_secret = Rails.env.production? ? ENV["STRIPE_WEBHOOK_SECRET_KEY"] : Rails.application.credentials.stripe[:webhook_secret_key] - + endpoint_secret = Rails.env.production? ? ENV.fetch('STRIPE_WEBHOOK_SECRET_KEY', nil) : Rails.application.credentials.stripe[:webhook_secret_key] + # Making sure we start from an empty event event = nil @@ -21,34 +21,35 @@ def create ) rescue JSON::ParserError => e # Invalid payload - render json: {message: e}, status: 400 + render(json: { message: e }, status: :bad_request) return rescue Stripe::SignatureVerificationError => e # Invalid signature - render json: {message: e}, status: 400 + render(json: { message: e }, status: :bad_request) return end # Handle Stripe event case event.type - when "payment_intent.created" - logger.warn "payment_intent.created not yet supported" - when 'checkout.session.completed', "payment_intent.succeeded" + when 'payment_intent.created' + logger.warn('payment_intent.created not yet supported') + when 'checkout.session.completed', 'payment_intent.succeeded' fullfill_order(event.data.object) - when "customer.subscription.deleted", "customer.subscription.updated" + when 'customer.subscription.deleted', 'customer.subscription.updated' update_subscription(event.data.object) + when 'plan.created', 'plan.updated' + update_plan(event.data.object) else - logger.warn "Unhandled event type: #{event.type}" + logger.warn("Unhandled event type: #{event.type}") end - end private - + def fullfill_order(checkout_session) # Find user and assign customer id from Stripe # user = User.find(checkout_session.client_reference_id) - user = User.find_by(:email => checkout_session.customer_details.email) + user = User.find_by(email: checkout_session.customer_details.email) organization = user.organization organization.update!(stripe_customer_id: checkout_session.customer) @@ -62,11 +63,10 @@ def fullfill_order(checkout_session) current_period_end: Time.at(stripe_subscription.current_period_end).to_datetime, customer_id: stripe_subscription.customer, interval: stripe_subscription.plan.interval, - organization: organization, + organization:, status: stripe_subscription.status, stripe_plan: stripe_subscription.plan.id, - subscription_id: stripe_subscription.id, - + subscription_id: stripe_subscription.id ) # Send the invitation email to the user @@ -81,7 +81,17 @@ def update_subscription(subscription) current_period_start: Time.at(stripe_subscription.current_period_start).to_datetime, current_period_end: Time.at(stripe_subscription.current_period_end).to_datetime, plan: stripe_subscription.plan.id, - interval: stripe_subscription.plan.interval, + interval: stripe_subscription.plan.interval + ) + end + + def update_plan(stripe_plan) + plan = Plan.find_or_initialize_by(stripe_product_id: stripe_plan.product) + plan.update( + label: stripe_plan.nickname, + price_mo: stripe_plan.amount / 100.0, # Assuming amount is in cents + active: stripe_plan.active + # Add other attributes as needed ) end -end \ No newline at end of file +end diff --git a/app/models/attendance.rb b/app/models/attendance.rb index 3185c84c..b5c0ab5c 100644 --- a/app/models/attendance.rb +++ b/app/models/attendance.rb @@ -22,7 +22,6 @@ # # Foreign Keys # -# fk_rails_... (event_id => events.id) # fk_rails_... (user_id => users.id) # class Attendance < ApplicationRecord diff --git a/app/models/concerns/subscribable.rb b/app/models/concerns/subscribable.rb new file mode 100644 index 00000000..ae7728a3 --- /dev/null +++ b/app/models/concerns/subscribable.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# app/models/concerns/subscribable.rb + +module Subscribable + extend ActiveSupport::Concern + + included do + has_one :subscription + end + + # Check if the organization has an active subscription + def active_subscription? + subscription.present? && subscription.active? + end +end diff --git a/app/models/event.rb b/app/models/event.rb index 44c0555c..cb4eb55e 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -14,7 +14,7 @@ # status :integer default("draft"), not null # created_at :datetime not null # updated_at :datetime not null -# organization_id :uuid not null +# organization_id :uuid # user_id :uuid not null # # Indexes diff --git a/app/models/group.rb b/app/models/group.rb index 2975c9d4..1c2a1448 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -22,7 +22,6 @@ # # Foreign Keys # -# fk_rails_... (organization_id => organizations.id) # fk_rails_... (user_id => users.id) # class Group < ApplicationRecord diff --git a/app/models/group_membership.rb b/app/models/group_membership.rb index 31d00b52..9a1eb163 100644 --- a/app/models/group_membership.rb +++ b/app/models/group_membership.rb @@ -19,7 +19,6 @@ # # Foreign Keys # -# fk_rails_... (group_id => groups.id) # fk_rails_... (user_id => users.id) # class GroupMembership < ApplicationRecord diff --git a/app/models/organization.rb b/app/models/organization.rb index f7fd9562..3bb72aba 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -29,6 +29,8 @@ # index_organizations_on_stripe_customer_id (stripe_customer_id) UNIQUE # class Organization < ApplicationRecord + include Subscribable + # enable rolify on the Account class resourcify @@ -42,8 +44,8 @@ class Organization < ApplicationRecord has_one :subscription - has_many :events, dependent: :destroy - has_many :members + has_many :events, dependent: :destroy + has_many :members, dependent: :destroy has_many :polls, dependent: :destroy has_many :users, through: :members diff --git a/app/models/poll.rb b/app/models/poll.rb index 6eb81370..33fa7396 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -12,6 +12,7 @@ # max_votes :integer # num_answers :integer # num_votes :integer +# participants :integer default(0), not null # poll_type :integer not null # selectors :string default(["\"upvote\"", "\"downvote\"", "\"neutral\""]), is an Array # status :integer not null @@ -23,6 +24,7 @@ # # Indexes # +# index_polls_on_is_anonymous (is_anonymous) # index_polls_on_organization_id (organization_id) # index_polls_on_poll_type (poll_type) # index_polls_on_selectors (selectors) @@ -32,7 +34,6 @@ # Foreign Keys # # fk_rails_... (organization_id => organizations.id) -# fk_rails_... (user_id => users.id) # class Poll < ApplicationRecord belongs_to :organization diff --git a/app/models/poll_answer.rb b/app/models/poll_answer.rb index 7526c881..9c6524c0 100644 --- a/app/models/poll_answer.rb +++ b/app/models/poll_answer.rb @@ -20,8 +20,6 @@ # # Foreign Keys # -# fk_rails_... (poll_id => polls.id) -# fk_rails_... (poll_option_id => poll_options.id) # fk_rails_... (user_id => users.id) # class PollAnswer < ApplicationRecord diff --git a/app/models/poll_participation.rb b/app/models/poll_participation.rb index 1a76e2bc..f3cc66ea 100644 --- a/app/models/poll_participation.rb +++ b/app/models/poll_participation.rb @@ -17,7 +17,6 @@ # # Foreign Keys # -# fk_rails_... (poll_id => polls.id) # fk_rails_... (user_id => users.id) # class PollParticipation < ApplicationRecord diff --git a/app/models/question.rb b/app/models/question.rb index ec1da39f..f275b192 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -14,7 +14,7 @@ # tone :integer default("undefined"), not null # created_at :datetime not null # updated_at :datetime not null -# organization_id :uuid not null +# organization_id :uuid # parent_id :uuid # room_id :uuid not null # user_id :uuid not null @@ -34,7 +34,6 @@ # # Foreign Keys # -# fk_rails_... (room_id => rooms.id) # fk_rails_... (user_id => users.id) # class Question < ApplicationRecord diff --git a/app/models/question_answer.rb b/app/models/question_answer.rb index fa9caf04..55a0c731 100644 --- a/app/models/question_answer.rb +++ b/app/models/question_answer.rb @@ -17,7 +17,6 @@ # # Foreign Keys # -# fk_rails_... (question_id => questions.id) # fk_rails_... (user_id => users.id) # class QuestionAnswer < ApplicationRecord diff --git a/app/models/resource_invite.rb b/app/models/resource_invite.rb index 025d00a7..208279d2 100644 --- a/app/models/resource_invite.rb +++ b/app/models/resource_invite.rb @@ -23,21 +23,18 @@ # # Indexes # -# index_resource_invites_on_email (email) -# index_resource_invites_on_group_id (group_id) -# index_resource_invites_on_invitable (invitable_type,invitable_id) -# index_resource_invites_on_invitable_type_and_invitable_id (invitable_type,invitable_id) -# index_resource_invites_on_organization_id (organization_id) -# index_resource_invites_on_recipient_id (recipient_id) -# index_resource_invites_on_sender_id (sender_id) -# index_resource_invites_on_status (status) -# index_resource_invites_on_token (token) UNIQUE +# index_resource_invites_on_email (email) +# index_resource_invites_on_group_id (group_id) +# index_resource_invites_on_invitable (invitable_type,invitable_id) +# index_resource_invites_on_organization_id (organization_id) +# index_resource_invites_on_recipient_id (recipient_id) +# index_resource_invites_on_sender_id (sender_id) +# index_resource_invites_on_status (status) +# index_resource_invites_on_token (token) UNIQUE # # Foreign Keys # # fk_rails_... (organization_id => organizations.id) -# fk_rails_... (recipient_id => users.id) -# fk_rails_... (sender_id => users.id) # class ResourceInvite < ApplicationRecord include PgSearch::Model diff --git a/app/models/room.rb b/app/models/room.rb index ea3811a6..5fa739a7 100644 --- a/app/models/room.rb +++ b/app/models/room.rb @@ -9,12 +9,12 @@ # always_on :boolean default(FALSE), not null # end_date :datetime not null # name :string not null -# room_type :integer +# room_type :integer default("universal"), not null # start_date :datetime not null # created_at :datetime not null # updated_at :datetime not null # event_id :uuid not null -# organization_id :uuid not null +# organization_id :uuid # # Indexes # @@ -22,6 +22,7 @@ # index_rooms_on_always_on (always_on) # index_rooms_on_event_id (event_id) # index_rooms_on_organization_id (organization_id) +# index_rooms_on_room_type (room_type) # index_rooms_on_start_date (start_date) # # Foreign Keys diff --git a/app/models/user.rb b/app/models/user.rb index 734e6c9d..eed6d6e3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -22,7 +22,7 @@ # uid :string # created_at :datetime not null # updated_at :datetime not null -# sash_id :integer +# sash_id :uuid # # Indexes # diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb index e000cba5..00a9d056 100644 --- a/app/policies/application_policy.rb +++ b/app/policies/application_policy.rb @@ -36,6 +36,10 @@ def destroy? false end + def user_has_active_subscription? + user.organization.active_subscription? + end + class Scope def initialize(user, scope) @user = user @@ -43,7 +47,7 @@ def initialize(user, scope) end def resolve - raise NotImplementedError, "You must define #resolve in #{self.class}" + raise(NotImplementedError, "You must define #resolve in #{self.class}") end private diff --git a/app/policies/event_policy.rb b/app/policies/event_policy.rb index b5f8ac4f..fdabe9a5 100644 --- a/app/policies/event_policy.rb +++ b/app/policies/event_policy.rb @@ -1,5 +1,6 @@ -class EventPolicy < ResourcePolicy +# frozen_string_literal: true +class EventPolicy < ResourcePolicy def stats? user_created_event? || user.has_role?(:admin, record) end diff --git a/app/policies/organization_policy.rb b/app/policies/organization_policy.rb index c2d47aa9..cfbbb1ca 100644 --- a/app/policies/organization_policy.rb +++ b/app/policies/organization_policy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class OrganizationPolicy < ApplicationPolicy def show? user_is_owner? || user.has_role?(:admin, record) @@ -7,10 +9,10 @@ def update? show? end - alias_method :edit?, :update? + alias edit? update? def manage_users? - user.has_role?(:admin, record) || user.member.owner? + (user.has_role?(:admin, record) || user.member.owner?) && user_has_active_subscription? end def upload_logo? @@ -21,6 +23,6 @@ def upload_logo? private def user_is_owner? - record.members.where(user: user, owner: true).exists? + record.members.where(user:, owner: true).exists? end -end \ No newline at end of file +end diff --git a/app/policies/poll_policy.rb b/app/policies/poll_policy.rb index 1fa8a139..86cbe1a2 100644 --- a/app/policies/poll_policy.rb +++ b/app/policies/poll_policy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Defines the access policies for the Poll resource. # As the Poll is aligned with the new ResourcePolicy we do not need # to defined specific policies. Should this change, specific policies @@ -5,5 +7,4 @@ # All policies are using Pundit class PollPolicy < ResourcePolicy - end diff --git a/app/policies/resource_policy.rb b/app/policies/resource_policy.rb index 6675203d..f13db258 100644 --- a/app/policies/resource_policy.rb +++ b/app/policies/resource_policy.rb @@ -1,4 +1,4 @@ -# This defines the generci policies applies to a resource (Poll, Event, Room, Survey, etc.) +# This defines the generic policies applies to a resource (Poll, Event, Room, Survey, etc.) # At the moment Event are not fully aligned with the new convention and may remain outside # of this generic policy. @@ -18,11 +18,11 @@ def destroy? # As a user I can edit the resource I created or I have been made admin on. def update? - user_is_resource_creator_or_admin? + user_is_resource_creator_or_admin? && user_has_active_subscription? end def edit? - update? + update? && user_has_active_subscription? end # Depending on the resource the method may differ, but we need something generic to let a user list the resources the user created or is admin on. @@ -32,6 +32,10 @@ def index? user_is_resource_creator_or_admin? end + def new? + user_has_active_subscription? + end + private def user_is_resource_creator_or_admin? diff --git a/app/policies/room_policy.rb b/app/policies/room_policy.rb index 3391ce33..f0cf915f 100644 --- a/app/policies/room_policy.rb +++ b/app/policies/room_policy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RoomPolicy < ResourcePolicy class Scope < Scope # NOTE: Be explicit about which records you allow access to! diff --git a/app/policies/settings_policy.rb b/app/policies/settings_policy.rb index 451e6942..00f85b8b 100644 --- a/app/policies/settings_policy.rb +++ b/app/policies/settings_policy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SettingsPolicy < ApplicationPolicy def index? user.has_role?(:admin, record) || user.organization_owner?(record) diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb index f825b19b..d8a94fa7 100644 --- a/app/policies/user_policy.rb +++ b/app/policies/user_policy.rb @@ -1,5 +1,4 @@ class UserPolicy < ApplicationPolicy - def index? admin_or_owner? end @@ -38,7 +37,7 @@ def user_has_admin_role? user.has_role?(:admin, record.organization) end - # Checking if the user (the one performing the action) is an owner of the organization + # Checking if the user (the one performing the action) is an owner of the organization # that the record (the user being acted upon) belongs to def user_is_organization_owner? organization = record.organization diff --git a/app/policies/welcome_policy.rb b/app/policies/welcome_policy.rb index 3ec59cb4..44b675d4 100644 --- a/app/policies/welcome_policy.rb +++ b/app/policies/welcome_policy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class WelcomePolicy < ApplicationPolicy def index? true diff --git a/app/views/connectors/index.html.erb b/app/views/connectors/index.html.erb index c993e44f..37f83c7d 100644 --- a/app/views/connectors/index.html.erb +++ b/app/views/connectors/index.html.erb @@ -1,103 +1,106 @@ -

- Connectors -

-
- -
-
-

Documents

-
- <%= render partial: "connector", locals: { connector: Connector.new(name: "Hubspot", description: "CRM", version: "1.2.3"), installed: true } %> -
-
-
-

Communication

-
- <%= render partial: "connector", locals: { connector: Connector.new(name: "Microsoft Teams", description: "Collaboration", version: "1.2.3"), installed: false } %> - <%= render partial: "connector", locals: { connector: Connector.new(name: "Zoom", description: "Meetings", version: "1.2.3"), installed: true } %> - <%= render partial: "connector", locals: { connector: Connector.new(name: "Slack", description: "Chat", version: "1.2.3"), installed: true } %> -
-
-
-

Polls

-
- <%= render partial: "connector", locals: { connector: Connector.new(name: "Typeform", description: "Forms & Surveys", version: "1.2.3"), installed: false } %> - <%= render partial: "connector", locals: { connector: Connector.new(name: "Google Form", description: "Forms", version: "1.2.3"), installed: true } %> - <%= render partial: "connector", locals: { connector: Connector.new(name: "Mailchimp", description: "Mailing & Surveys", version: "1.2.3"), installed: false } %> - <%= render partial: "connector", locals: { connector: Connector.new(name: "Survey Monkey", description: "Surveys", version: "1.2.3"), installed: false } %> + +<%= turbo_frame_tag "settings_main" do %> +

+ Connectors +

+
-
-

Surveys

-
- <%= render partial: "connector", locals: { connector: Connector.new(name: "Typeform", description: "Forms & Surveys", version: "1.2.3"), installed: false } %> - <%= render partial: "connector", locals: { connector: Connector.new(name: "Google Form", description: "Forms", version: "1.2.3"), installed: true } %> - <%= render partial: "connector", locals: { connector: Connector.new(name: "Mailchimp", description: "Mailing & Surveys", version: "1.2.3"), installed: false } %> - <%= render partial: "connector", locals: { connector: Connector.new(name: "Survey Monkey", description: "Surveys", version: "1.2.3"), installed: false } %> -
-
-
-

HR

-
-
-
+ +
+
+

Documents

+
+ <%= render partial: "connector", locals: { connector: Connector.new(name: "Hubspot", description: "CRM", version: "1.2.3"), installed: true } %> +
+
+
+

Communication

+
+ <%= render partial: "connector", locals: { connector: Connector.new(name: "Microsoft Teams", description: "Collaboration", version: "1.2.3"), installed: false } %> + <%= render partial: "connector", locals: { connector: Connector.new(name: "Zoom", description: "Meetings", version: "1.2.3"), installed: true } %> + <%= render partial: "connector", locals: { connector: Connector.new(name: "Slack", description: "Chat", version: "1.2.3"), installed: true } %> +
+
+
+

Polls

+
+ <%= render partial: "connector", locals: { connector: Connector.new(name: "Typeform", description: "Forms & Surveys", version: "1.2.3"), installed: false } %> + <%= render partial: "connector", locals: { connector: Connector.new(name: "Google Form", description: "Forms", version: "1.2.3"), installed: true } %> + <%= render partial: "connector", locals: { connector: Connector.new(name: "Mailchimp", description: "Mailing & Surveys", version: "1.2.3"), installed: false } %> + <%= render partial: "connector", locals: { connector: Connector.new(name: "Survey Monkey", description: "Surveys", version: "1.2.3"), installed: false } %> +
+
+
+

Surveys

+
+ <%= render partial: "connector", locals: { connector: Connector.new(name: "Typeform", description: "Forms & Surveys", version: "1.2.3"), installed: false } %> + <%= render partial: "connector", locals: { connector: Connector.new(name: "Google Form", description: "Forms", version: "1.2.3"), installed: true } %> + <%= render partial: "connector", locals: { connector: Connector.new(name: "Mailchimp", description: "Mailing & Surveys", version: "1.2.3"), installed: false } %> + <%= render partial: "connector", locals: { connector: Connector.new(name: "Survey Monkey", description: "Surveys", version: "1.2.3"), installed: false } %> +
+
+
+

HR

+
+
+
+
-
+<% end %> diff --git a/app/views/settings/_sidebar.html.erb b/app/views/settings/_sidebar.html.erb index cc5aa3b4..65915201 100644 --- a/app/views/settings/_sidebar.html.erb +++ b/app/views/settings/_sidebar.html.erb @@ -37,13 +37,13 @@ <% end %>
  • - + <%= link_to connectors_path, data: { turbo_frame: :settings_main }, class: "flex items-center p-2 text-base font-normal text-gray-900 transition duration-75 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 dark:text-white group" do %> Connectors - + <% end %>
  • <%# diff --git a/app/views/subscriptions/index.html.erb b/app/views/subscriptions/index.html.erb index 41333348..f93bdc88 100644 --- a/app/views/subscriptions/index.html.erb +++ b/app/views/subscriptions/index.html.erb @@ -31,17 +31,20 @@
  • - Team size: 1 developer + Team size: + 1 developer
  • - Premium support: 6 months + Premium support: + 6 months
  • - Free updates: 6 months + Free updates: + 6 months
  • @@ -54,7 +57,7 @@ /month - <%= link_to "Go Pro!", new_subscription_path(plan_id: @plans.find_by(label: 'pro')), class: "mb-4 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800" %> + <%= link_to "Go Pro!", new_subscription_path(plan_id: @pro.id), class: "mb-4 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800" %> @@ -83,7 +87,7 @@ /month - <%= link_to "Contact us", new_subscription_path(plan_id: @plans.find_by(label: 'enterprise')), class: "mb-4 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800" %> + <%= link_to "Contact us", new_subscription_path(plan_id: @enterprise.id), class: "mb-4 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800" %> diff --git a/config/environments/development.rb b/config/environments/development.rb index 06032502..abd98138 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -90,7 +90,7 @@ # config.hosts = nil unless Rails.env.production? config.hosts << "127.0.0.1" config.hosts << "localhost" - config.hosts << "4fc0-98-42-90-152.ngrok-free.app" + config.hosts << "ef5d-67-170-203-242.ngrok-free.app" # Mailcatcher configuration config.action_mailer.delivery_method = :smtp diff --git a/config/initializers/online_migrations.rb b/config/initializers/online_migrations.rb index d6caa55f..bec37192 100644 --- a/config/initializers/online_migrations.rb +++ b/config/initializers/online_migrations.rb @@ -10,6 +10,9 @@ # Configure whether to perform checks when migrating down. config.check_down = false + # + config.statement_timeout = 10.minutes + # Configure custom error messages. # error_messages is a Hash with keys - error names and values - error messages. # config.error_messages[:remove_column] = "Your custom instructions" diff --git a/db/migrate/20220419214313_enable_uuid.rb b/db/migrate/20220419214313_enable_uuid.rb index 2271b4d0..e9c56d22 100644 --- a/db/migrate/20220419214313_enable_uuid.rb +++ b/db/migrate/20220419214313_enable_uuid.rb @@ -1,4 +1,4 @@ -class EnableUuid < ActiveRecord::Migration[7.0] +class EnableUuid < ActiveRecord::Migration[7.1] def change enable_extension 'pgcrypto' end diff --git a/db/migrate/20220528004235_create_users.rb b/db/migrate/20220528004235_create_users.rb index adb98ee4..89e91024 100644 --- a/db/migrate/20220528004235_create_users.rb +++ b/db/migrate/20220528004235_create_users.rb @@ -1,4 +1,4 @@ -class CreateUsers < ActiveRecord::Migration[7.0] +class CreateUsers < ActiveRecord::Migration[7.1] def change create_table :users, id: :uuid do |t| t.string :email, null: false diff --git a/db/migrate/20220528004314_create_profiles.rb b/db/migrate/20220528004314_create_profiles.rb index fe596134..0b1daf37 100644 --- a/db/migrate/20220528004314_create_profiles.rb +++ b/db/migrate/20220528004314_create_profiles.rb @@ -1,4 +1,4 @@ -class CreateProfiles < ActiveRecord::Migration[7.0] +class CreateProfiles < ActiveRecord::Migration[7.1] def change create_table :profiles, id: :uuid do |t| t.belongs_to :user, null: false, foreign_key: true, type: :uuid diff --git a/db/migrate/20220529204552_create_active_sessions.rb b/db/migrate/20220529204552_create_active_sessions.rb index bb16094e..78d1159a 100644 --- a/db/migrate/20220529204552_create_active_sessions.rb +++ b/db/migrate/20220529204552_create_active_sessions.rb @@ -1,4 +1,4 @@ -class CreateActiveSessions < ActiveRecord::Migration[7.0] +class CreateActiveSessions < ActiveRecord::Migration[7.1] def change create_table :active_sessions, id: :uuid do |t| t.references :user, null: false, type: :uuid, foreign_key: {on_delete: :cascade} diff --git a/db/migrate/20220530003434_create_events.rb b/db/migrate/20220530003434_create_events.rb index 6742d4c3..782a9dc1 100644 --- a/db/migrate/20220530003434_create_events.rb +++ b/db/migrate/20220530003434_create_events.rb @@ -1,4 +1,4 @@ -class CreateEvents < ActiveRecord::Migration[7.0] +class CreateEvents < ActiveRecord::Migration[7.1] def change create_table :events, id: :uuid do |t| t.belongs_to :user, null: false, type: :uuid, foreign_key: true diff --git a/db/migrate/20220530003555_create_rooms.rb b/db/migrate/20220530003555_create_rooms.rb index 63ad8abd..54e95a95 100644 --- a/db/migrate/20220530003555_create_rooms.rb +++ b/db/migrate/20220530003555_create_rooms.rb @@ -1,4 +1,4 @@ -class CreateRooms < ActiveRecord::Migration[7.0] +class CreateRooms < ActiveRecord::Migration[7.1] def change create_table :rooms, id: :uuid do |t| t.belongs_to :event, null: false, type: :uuid, foreign_key: true @@ -6,6 +6,7 @@ def change t.boolean :always_on, null: false, default: false t.boolean :allow_anonymous, null: false, default: false t.datetime :start_date, null: false + t.integer :room_type, null: false, default: 10 t.timestamps end @@ -13,5 +14,6 @@ def change add_index :rooms, :always_on add_index :rooms, :allow_anonymous add_index :rooms, :start_date + add_index :rooms, :room_type end end diff --git a/db/migrate/20220530004425_create_questions.rb b/db/migrate/20220530004425_create_questions.rb index 1187d540..cfab1d7c 100644 --- a/db/migrate/20220530004425_create_questions.rb +++ b/db/migrate/20220530004425_create_questions.rb @@ -1,16 +1,29 @@ -class CreateQuestions < ActiveRecord::Migration[7.0] +class CreateQuestions < ActiveRecord::Migration[7.1] def change + + # Create table without foreign key constraints + # to minimize locking time on the table create_table :questions, id: :uuid do |t| t.belongs_to :user, null: false, type: :uuid, foreign_key: true - t.belongs_to :room, null: false, type: :uuid, foreign_key: true + t.belongs_to :room, null: false, type: :uuid, foreign_key: false t.string :title, null: false t.integer :status, null: false, default: 0 + t.integer :tone, null: false, default: 0 t.timestamps end + # Add indices add_index :questions, [:user_id, :room_id] add_index :questions, :status add_index :questions, [:user_id, :status] + add_index :questions, :tone + end +end + +# Add additional foreign keys at the end +class AddForeignKeyFromQuestionsToRooms < ActiveRecord::Migration[7.1] + def change + add_foreign_key :questions, :rooms end end diff --git a/db/migrate/20220530022036_create_active_storage_tables.active_storage.rb b/db/migrate/20220530022036_create_active_storage_tables.active_storage.rb index 8a7bfe18..5c1088f5 100644 --- a/db/migrate/20220530022036_create_active_storage_tables.active_storage.rb +++ b/db/migrate/20220530022036_create_active_storage_tables.active_storage.rb @@ -1,5 +1,5 @@ # This migration comes from active_storage (originally 20170806125915) -class CreateActiveStorageTables < ActiveRecord::Migration[5.2] +class CreateActiveStorageTables < ActiveRecord::Migration[7.1] def change # Use Active Record's configured type for primary and foreign keys primary_key_type, foreign_key_type = primary_and_foreign_key_types diff --git a/db/migrate/20220606033225_create_attendances.rb b/db/migrate/20220606033225_create_attendances.rb index 4bd8be19..0999cff8 100644 --- a/db/migrate/20220606033225_create_attendances.rb +++ b/db/migrate/20220606033225_create_attendances.rb @@ -1,8 +1,8 @@ -class CreateAttendances < ActiveRecord::Migration[7.0] +class CreateAttendances < ActiveRecord::Migration[7.1] def change create_table :attendances, id: :uuid do |t| t.references :user, null: false, type: :uuid, foreign_key: true - t.references :event, null: false, type: :uuid, foreign_key: true + t.references :event, null: false, type: :uuid, foreign_key: false t.references :room t.integer :status, null: false, default: 0 t.datetime :start_time, null: false @@ -12,3 +12,10 @@ def change end end end + +# Add additional foreign keys at the end +class AddForeignKeyFromAttendancesToEvents < ActiveRecord::Migration[7.1] + def change + add_foreign_key :attendances, :events + end +end \ No newline at end of file diff --git a/db/migrate/20220607232424_add_uid_and_provider_to_users.rb b/db/migrate/20220607232424_add_uid_and_provider_to_users.rb index c6c95208..60f2ac62 100644 --- a/db/migrate/20220607232424_add_uid_and_provider_to_users.rb +++ b/db/migrate/20220607232424_add_uid_and_provider_to_users.rb @@ -1,9 +1,10 @@ -class AddUidAndProviderToUsers < ActiveRecord::Migration[7.0] +class AddUidAndProviderToUsers < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change add_column :users, :uid, :string add_column :users, :provider, :string - add_index :users, :uid, unique: true - add_index :users, :provider + add_index :users, :uid, unique: true, algorithm: :concurrently + add_index :users, :provider, algorithm: :concurrently end end diff --git a/db/migrate/20220622180927_create_accounts.rb b/db/migrate/20220622180927_create_accounts.rb deleted file mode 100644 index f6f49351..00000000 --- a/db/migrate/20220622180927_create_accounts.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateAccounts < ActiveRecord::Migration[7.0] - def change - create_table :accounts, id: :uuid do |t| - t.string :name - t.string :website - t.string :country - - t.timestamps - end - - add_index :accounts, :country - end -end diff --git a/db/migrate/20220622180927_create_organizations.rb b/db/migrate/20220622180927_create_organizations.rb new file mode 100644 index 00000000..73a9e966 --- /dev/null +++ b/db/migrate/20220622180927_create_organizations.rb @@ -0,0 +1,13 @@ +class CreateOrganizations < ActiveRecord::Migration[7.1] + def change + create_table :organizations, id: :uuid do |t| + t.string :name + t.string :website + t.string :country + + t.timestamps + end + + add_index :organizations, :country + end +end diff --git a/db/migrate/20220622183029_create_members.rb b/db/migrate/20220622183029_create_members.rb index dcd3d625..9432fdbb 100644 --- a/db/migrate/20220622183029_create_members.rb +++ b/db/migrate/20220622183029_create_members.rb @@ -1,8 +1,8 @@ -class CreateMembers < ActiveRecord::Migration[7.0] +class CreateMembers < ActiveRecord::Migration[7.1] def change create_table :members, id: :uuid do |t| t.references :user, null: false, type: :uuid - t.references :account, null: false, type: :uuid + t.references :organization, null: false, type: :uuid t.boolean :owner, null: false, default: false t.timestamps diff --git a/db/migrate/20220627215506_rolify_create_roles.rb b/db/migrate/20220627215506_rolify_create_roles.rb index 5f194ffa..4e384392 100644 --- a/db/migrate/20220627215506_rolify_create_roles.rb +++ b/db/migrate/20220627215506_rolify_create_roles.rb @@ -1,4 +1,4 @@ -class RolifyCreateRoles < ActiveRecord::Migration[7.0] +class RolifyCreateRoles < ActiveRecord::Migration[7.1] def change create_table(:roles) do |t| t.string :name diff --git a/db/migrate/20220629230932_add_anonymous_to_question.rb b/db/migrate/20220629230932_add_anonymous_to_question.rb index 69076163..60b9b052 100644 --- a/db/migrate/20220629230932_add_anonymous_to_question.rb +++ b/db/migrate/20220629230932_add_anonymous_to_question.rb @@ -1,6 +1,7 @@ -class AddAnonymousToQuestion < ActiveRecord::Migration[7.0] +class AddAnonymousToQuestion < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change add_column :questions, :anonymous, :boolean, null: false, default: false - add_index :questions, :anonymous + add_index :questions, :anonymous, algorithm: :concurrently end end diff --git a/db/migrate/20220701215523_create_versions.rb b/db/migrate/20220701215523_create_versions.rb index 63bdc6cd..3e60f6f6 100644 --- a/db/migrate/20220701215523_create_versions.rb +++ b/db/migrate/20220701215523_create_versions.rb @@ -1,6 +1,6 @@ # This migration creates the `versions` table, the only schema PT requires. # All other migrations PT provides are optional. -class CreateVersions < ActiveRecord::Migration[7.0] +class CreateVersions < ActiveRecord::Migration[7.1] # The largest text column available in all supported RDBMS is # 1024^3 - 1 bytes, roughly one gibibyte. We specify a size diff --git a/db/migrate/20220703224559_create_votes.rb b/db/migrate/20220703224559_create_votes.rb index 7fe6113e..afdc4c5e 100644 --- a/db/migrate/20220703224559_create_votes.rb +++ b/db/migrate/20220703224559_create_votes.rb @@ -1,4 +1,4 @@ -class CreateVotes < ActiveRecord::Migration[7.0] +class CreateVotes < ActiveRecord::Migration[7.1] def change create_table :votes do |t| t.belongs_to :user, null: false, type: :uuid, foreign_key: true diff --git a/db/migrate/20220708163651_add_reject_cause_id_to_question.rb b/db/migrate/20220708163651_add_reject_cause_id_to_question.rb index 15ce6a72..1175fc6e 100644 --- a/db/migrate/20220708163651_add_reject_cause_id_to_question.rb +++ b/db/migrate/20220708163651_add_reject_cause_id_to_question.rb @@ -1,6 +1,7 @@ -class AddRejectCauseIdToQuestion < ActiveRecord::Migration[7.0] +class AddRejectCauseIdToQuestion < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change add_column :questions, :rejection_cause, :integer - add_index :questions, :rejection_cause + add_index :questions, :rejection_cause, algorithm: :concurrently end end diff --git a/db/migrate/20220730021732_create_notifications.rb b/db/migrate/20220730021732_create_notifications.rb index 8bf57b00..e93af3f3 100644 --- a/db/migrate/20220730021732_create_notifications.rb +++ b/db/migrate/20220730021732_create_notifications.rb @@ -1,4 +1,4 @@ -class CreateNotifications < ActiveRecord::Migration[7.0] +class CreateNotifications < ActiveRecord::Migration[7.1] def change create_table :notifications, id: :uuid do |t| t.references :recipient, polymorphic: true, null: false diff --git a/db/migrate/20220730203417_create_messages.rb b/db/migrate/20220730203417_create_messages.rb index 7ff2fc6c..c705de70 100644 --- a/db/migrate/20220730203417_create_messages.rb +++ b/db/migrate/20220730203417_create_messages.rb @@ -1,4 +1,4 @@ -class CreateMessages < ActiveRecord::Migration[7.0] +class CreateMessages < ActiveRecord::Migration[7.1] def change create_table :messages, id: :uuid do |t| t.text :content diff --git a/db/migrate/20220811205958_create_ahoy_visits_and_events.rb b/db/migrate/20220811205958_create_ahoy_visits_and_events.rb index 177ea524..82706cd3 100644 --- a/db/migrate/20220811205958_create_ahoy_visits_and_events.rb +++ b/db/migrate/20220811205958_create_ahoy_visits_and_events.rb @@ -1,4 +1,4 @@ -class CreateAhoyVisitsAndEvents < ActiveRecord::Migration[7.0] +class CreateAhoyVisitsAndEvents < ActiveRecord::Migration[7.1] def change create_table :ahoy_visits do |t| t.string :visit_token diff --git a/db/migrate/20220907192723_add_parent_id_to_question.rb b/db/migrate/20220907192723_add_parent_id_to_question.rb index e459297c..6543e0ab 100644 --- a/db/migrate/20220907192723_add_parent_id_to_question.rb +++ b/db/migrate/20220907192723_add_parent_id_to_question.rb @@ -1,6 +1,7 @@ -class AddParentIdToQuestion < ActiveRecord::Migration[7.0] +class AddParentIdToQuestion < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change add_column :questions, :parent_id, :uuid - add_index :questions, :parent_id + add_index :questions, :parent_id, algorithm: :concurrently end end diff --git a/db/migrate/20230105225145_add_account_id_to_tables.rb b/db/migrate/20230105225145_add_account_id_to_tables.rb deleted file mode 100644 index 32655dc5..00000000 --- a/db/migrate/20230105225145_add_account_id_to_tables.rb +++ /dev/null @@ -1,48 +0,0 @@ -class AddAccountIdToTables < ActiveRecord::Migration[7.0] - def up - # Adding the organization_id column to Events, Rooms and Questions - # Events - add_column :events, :organization_id, :uuid - add_index :events, :organization_id - - # Rooms - add_column :rooms, :organization_id, :uuid - add_index :rooms, :organization_id - - # Questions - add_column :questions, :organization_id, :uuid - add_index :questions, :organization_id - - # Filling with proper data - # Events - Event.where(organization_id: nil).each do |event| - event.update(organization_id: Member.where(user_id: event.user_id).first.organization_id) - end - - # Rooms - Room.where(organization_id: nil).each do |room| - room.update(organization_id: Member.where(user_id: room.event.user_id).first.organization_id) - end - - # Questions - Question.where(organization_id: nil).each do |question| - question.update(organization_id: Member.where(user_id: question.room.event.user_id).first.organization_id) - end - - # Making not null the new default - # Events - change_column_null :events, :organization_id, false - - # Rooms - change_column_null :rooms, :organization_id, false - - # Questions - change_column_null :questions, :organization_id, false - end - - def down - remove_column :events, :organization_id, :uuid - remove_column :rooms, :organization_id, :uuid - remove_column :questions, :organization_id, :uuid - end -end \ No newline at end of file diff --git a/db/migrate/20230105225145_add_organization_id_to_tables.rb b/db/migrate/20230105225145_add_organization_id_to_tables.rb new file mode 100644 index 00000000..30b54ffc --- /dev/null +++ b/db/migrate/20230105225145_add_organization_id_to_tables.rb @@ -0,0 +1,49 @@ + class AddOrganizationIdToTables < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + def up + # Adding the organization_id column to Events, Rooms and Questions + # Events + add_column :events, :organization_id, :uuid + add_index :events, :organization_id, algorithm: :concurrently + + # Rooms + add_column :rooms, :organization_id, :uuid + add_index :rooms, :organization_id, algorithm: :concurrently + + # Questions + add_column :questions, :organization_id, :uuid + add_index :questions, :organization_id, algorithm: :concurrently + + # Filling with proper data + # Events + Event.where(organization_id: nil).each do |event| + event.update(organization_id: Member.where(user_id: event.user_id).first.organization_id) + end + + # Rooms + Room.where(organization_id: nil).each do |room| + room.update(organization_id: Member.where(user_id: room.event.user_id).first.organization_id) + end + + # Questions + Question.where(organization_id: nil).each do |question| + question.update(organization_id: Member.where(user_id: question.room.event.user_id).first.organization_id) + end + + # Add NOT NULL constraint + add_not_null_constraint :events, :organization_id, name: "events_organization_id_null", validate: false + add_not_null_constraint :rooms, :organization_id, name: "rooms_organization_id_null", validate: false + add_not_null_constraint :questions, :organization_id, name: "questions_organization_id_null", validate: false + + # Validate the NOT NULL constraint + validate_not_null_constraint :events, :organization_id, name: "events_organization_id_null" + validate_not_null_constraint :rooms, :organization_id, name: "rooms_organization_id_null" + validate_not_null_constraint :questions, :organization_id, name: "questions_organization_id_null" + end + + def down + remove_column :events, :organization_id, :uuid + remove_column :rooms, :organization_id, :uuid + remove_column :questions, :organization_id, :uuid + end + end \ No newline at end of file diff --git a/db/migrate/20230117215006_add_sso_fields_to_account.rb b/db/migrate/20230117215006_add_sso_fields_to_account.rb index 5ed90531..93a66e1b 100644 --- a/db/migrate/20230117215006_add_sso_fields_to_account.rb +++ b/db/migrate/20230117215006_add_sso_fields_to_account.rb @@ -1,14 +1,15 @@ -class AddSsoFieldsToAccount < ActiveRecord::Migration[7.0] +class AddSsoFieldsToAccount < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change - add_column :accounts, :domain, :string - add_column :accounts, :sso, :boolean, null: false, default: false - add_column :accounts, :dns_txt, :string - add_column :accounts, :domain_verified, :boolean, null: false, default: false - add_column :accounts, :domain_verified_at, :timestamp + add_column :organizations, :domain, :string + add_column :organizations, :sso, :boolean, null: false, default: false + add_column :organizations, :dns_txt, :string + add_column :organizations, :domain_verified, :boolean, null: false, default: false + add_column :organizations, :domain_verified_at, :timestamp - add_index :accounts, :domain, unique: true - add_index :accounts, :dns_txt, unique: true - add_index :accounts, :sso - add_index :accounts, :domain_verified + add_index :organizations, :domain, unique: true, algorithm: :concurrently + add_index :organizations, :dns_txt, unique: true, algorithm: :concurrently + add_index :organizations, :sso, algorithm: :concurrently + add_index :organizations, :domain_verified, algorithm: :concurrently end end diff --git a/db/migrate/20230124185308_rename_account_model_to_organization.rb b/db/migrate/20230124185308_rename_account_model_to_organization.rb deleted file mode 100644 index a78a7a0b..00000000 --- a/db/migrate/20230124185308_rename_account_model_to_organization.rb +++ /dev/null @@ -1,23 +0,0 @@ -class RenameAccountModelToOrganization < ActiveRecord::Migration[7.0] - def up - - # Rename the accounts table to organizations ONLY if the old accounts table exists - if table_exists?(:accounts) - rename_table :accounts, :organizations - end - - # Rename the column account_id ONLY if it exists in the relative table. - if Event.attribute_names.include? "account_id" - rename_column :events, :account_id, :organization_id - end - if Member.attribute_names.include? "account_id" - rename_column :members, :account_id, :organization_id - end - if Question.attribute_names.include? "account_id" - rename_column :questions, :account_id, :organization_id - end - if Room.attribute_names.include? "account_id" - rename_column :rooms, :account_id, :organization_id - end - end -end diff --git a/db/migrate/20230316015629_create_topics.rb b/db/migrate/20230316015629_create_topics.rb index f296ee5a..41014dfd 100644 --- a/db/migrate/20230316015629_create_topics.rb +++ b/db/migrate/20230316015629_create_topics.rb @@ -1,4 +1,4 @@ -class CreateTopics < ActiveRecord::Migration[7.0] +class CreateTopics < ActiveRecord::Migration[7.1] def change create_table :topics, id: :uuid do |t| t.uuid :event_id # optional diff --git a/db/migrate/20230317012332_add_tone_to_question.rb b/db/migrate/20230317012332_add_tone_to_question.rb deleted file mode 100644 index bc6d88b3..00000000 --- a/db/migrate/20230317012332_add_tone_to_question.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddToneToQuestion < ActiveRecord::Migration[7.0] - def change - add_column :questions, :tone, :integer, null: false, default: 0 - add_index :questions, :tone - end -end diff --git a/db/migrate/20230320192611_add_timezone_to_user.rb b/db/migrate/20230320192611_add_timezone_to_user.rb index 2e0a3884..b06f1fce 100644 --- a/db/migrate/20230320192611_add_timezone_to_user.rb +++ b/db/migrate/20230320192611_add_timezone_to_user.rb @@ -1,6 +1,7 @@ -class AddTimezoneToUser < ActiveRecord::Migration[7.0] +class AddTimezoneToUser < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change add_column :users, :time_zone, :string - add_index :users, :time_zone + add_index :users, :time_zone, algorithm: :concurrently end end diff --git a/db/migrate/20230322221914_add_ai_response_to_question.rb b/db/migrate/20230322221914_add_ai_response_to_question.rb index 7eb797cd..e54e4f21 100644 --- a/db/migrate/20230322221914_add_ai_response_to_question.rb +++ b/db/migrate/20230322221914_add_ai_response_to_question.rb @@ -1,4 +1,4 @@ -class AddAiResponseToQuestion < ActiveRecord::Migration[7.0] +class AddAiResponseToQuestion < ActiveRecord::Migration[7.1] def change add_column :questions, :ai_response, :jsonb end diff --git a/db/migrate/20230325011418_add_keywords_to_question.rb b/db/migrate/20230325011418_add_keywords_to_question.rb index ef1c3293..07111e27 100644 --- a/db/migrate/20230325011418_add_keywords_to_question.rb +++ b/db/migrate/20230325011418_add_keywords_to_question.rb @@ -1,4 +1,4 @@ -class AddKeywordsToQuestion < ActiveRecord::Migration[7.0] +class AddKeywordsToQuestion < ActiveRecord::Migration[7.1] def change add_column :questions, :keywords, :string, array: true, default: [] end diff --git a/db/migrate/20230331184052_create_merit_actions.rb b/db/migrate/20230331184052_create_merit_actions.rb index c96fab34..9be98254 100644 --- a/db/migrate/20230331184052_create_merit_actions.rb +++ b/db/migrate/20230331184052_create_merit_actions.rb @@ -1,7 +1,7 @@ -class CreateMeritActions < ActiveRecord::Migration[7.0] +class CreateMeritActions < ActiveRecord::Migration[7.1] def change - create_table :merit_actions do |t| - t.integer :user_id + create_table :merit_actions, id: :uuid do |t| + t.uuid :user_id t.string :action_method t.integer :action_value t.boolean :had_errors, default: false diff --git a/db/migrate/20230331184053_create_merit_activity_logs.rb b/db/migrate/20230331184053_create_merit_activity_logs.rb index db71044f..75cafea3 100644 --- a/db/migrate/20230331184053_create_merit_activity_logs.rb +++ b/db/migrate/20230331184053_create_merit_activity_logs.rb @@ -1,6 +1,6 @@ -class CreateMeritActivityLogs < ActiveRecord::Migration[7.0] +class CreateMeritActivityLogs < ActiveRecord::Migration[7.1] def change - create_table :merit_activity_logs do |t| + create_table :merit_activity_logs, id: :uuid do |t| t.integer :action_id t.string :related_change_type t.integer :related_change_id diff --git a/db/migrate/20230331184054_create_sashes.rb b/db/migrate/20230331184054_create_sashes.rb index 2bb33877..c5268c0e 100644 --- a/db/migrate/20230331184054_create_sashes.rb +++ b/db/migrate/20230331184054_create_sashes.rb @@ -1,6 +1,6 @@ -class CreateSashes < ActiveRecord::Migration[7.0] +class CreateSashes < ActiveRecord::Migration[7.1] def change - create_table :sashes do |t| + create_table :sashes, id: :uuid do |t| t.timestamps null: false end end diff --git a/db/migrate/20230331184055_create_badges_sashes.rb b/db/migrate/20230331184055_create_badges_sashes.rb index dcce8684..f33c5200 100644 --- a/db/migrate/20230331184055_create_badges_sashes.rb +++ b/db/migrate/20230331184055_create_badges_sashes.rb @@ -1,7 +1,7 @@ -class CreateBadgesSashes < ActiveRecord::Migration[7.0] +class CreateBadgesSashes < ActiveRecord::Migration[7.1] def self.up - create_table :badges_sashes do |t| - t.integer :badge_id, :sash_id + create_table :badges_sashes, id: :uuid do |t| + t.uuid :badge_id, :sash_id t.boolean :notified_user, default: false t.datetime :created_at end diff --git a/db/migrate/20230331184056_create_scores_and_points.rb b/db/migrate/20230331184056_create_scores_and_points.rb index 6506022b..cdad6de2 100644 --- a/db/migrate/20230331184056_create_scores_and_points.rb +++ b/db/migrate/20230331184056_create_scores_and_points.rb @@ -1,12 +1,12 @@ -class CreateScoresAndPoints < ActiveRecord::Migration[7.0] +class CreateScoresAndPoints < ActiveRecord::Migration[7.1] def change - create_table :merit_scores do |t| - t.references :sash + create_table :merit_scores, id: :uuid do |t| + t.references :sash, type: :uuid t.string :category, default: 'default' end create_table :merit_score_points do |t| - t.references :score + t.references :score, type: :uuid t.bigint :num_points, default: 0 t.string :log t.datetime :created_at diff --git a/db/migrate/20230331184103_add_merit_fields_to_users.rb b/db/migrate/20230331184103_add_merit_fields_to_users.rb index 9a1a014b..e051de82 100644 --- a/db/migrate/20230331184103_add_merit_fields_to_users.rb +++ b/db/migrate/20230331184103_add_merit_fields_to_users.rb @@ -1,9 +1,10 @@ -class AddMeritFieldsToUsers < ActiveRecord::Migration[7.0] +class AddMeritFieldsToUsers < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change - add_column :users, :sash_id, :integer + add_column :users, :sash_id, :uuid add_column :users, :level, :integer, :default => 0 - add_index :users, :level - add_index :users, :sash_id + add_index :users, :level, algorithm: :concurrently + add_index :users, :sash_id, algorithm: :concurrently end end diff --git a/db/migrate/20230405193622_add_invited_to_user.rb b/db/migrate/20230405193622_add_invited_to_user.rb index 4da75cad..ce5e1cbb 100644 --- a/db/migrate/20230405193622_add_invited_to_user.rb +++ b/db/migrate/20230405193622_add_invited_to_user.rb @@ -1,10 +1,11 @@ # Add 3 fields to control how users are invited to join an organization -class AddInvitedToUser < ActiveRecord::Migration[7.0] +class AddInvitedToUser < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change add_column :users, :invited, :boolean, null: false, default: false add_column :users, :invited_at, :timestamp add_column :users, :accepted_invitation_on, :timestamp - add_index :users, :invited + add_index :users, :invited, algorithm: :concurrently end end diff --git a/db/migrate/20230408003310_add_max_failed_attempts_to_organization.rb b/db/migrate/20230408003310_add_max_failed_attempts_to_organization.rb index 0656cfbb..39f666fd 100644 --- a/db/migrate/20230408003310_add_max_failed_attempts_to_organization.rb +++ b/db/migrate/20230408003310_add_max_failed_attempts_to_organization.rb @@ -1,4 +1,4 @@ -class AddMaxFailedAttemptsToOrganization < ActiveRecord::Migration[7.0] +class AddMaxFailedAttemptsToOrganization < ActiveRecord::Migration[7.1] def change add_column :organizations, :max_failed_attempts, :integer, null: false, default: 5 add_column :organizations, :failed_attempts_timeout, :integer, null: false, default: 900 diff --git a/db/migrate/20230420201240_create_import_results.rb b/db/migrate/20230420201240_create_import_results.rb index ea650a27..6aae191d 100644 --- a/db/migrate/20230420201240_create_import_results.rb +++ b/db/migrate/20230420201240_create_import_results.rb @@ -1,4 +1,4 @@ -class CreateImportResults < ActiveRecord::Migration[7.0] +class CreateImportResults < ActiveRecord::Migration[7.1] def change create_table :import_results, id: :uuid do |t| t.references :user, null: false, foreign_key: true, type: :uuid diff --git a/db/migrate/20230427212345_create_polls.rb b/db/migrate/20230427212345_create_polls.rb index 64f32dc0..8264c81b 100644 --- a/db/migrate/20230427212345_create_polls.rb +++ b/db/migrate/20230427212345_create_polls.rb @@ -1,12 +1,14 @@ -class CreatePolls < ActiveRecord::Migration[7.0] +class CreatePolls < ActiveRecord::Migration[7.1] def change create_table :polls, id: :uuid do |t| t.references :organization, null: false, foreign_key: true, type: :uuid - t.references :user, null: false, foreign_key: true, type: :uuid + t.references :user, null: false, foreign_key: false, type: :uuid t.integer :poll_type, null: false t.string :title, null: false t.integer :status, null: false - + + t.boolean :is_anonymous, null: false, default: false + # Rules: # 1. if num_answers AND max_answers are nil or equal to 0: a user can answer for as many poll_option present in the poll # 2. if num_answers OR max_answers is > 0 then we apply the rule assigned to each of these parameter @@ -33,5 +35,13 @@ def change add_index :polls, :poll_type add_index :polls, :status + add_index :polls, :is_anonymous end end + +# Add additional foreign keys at the end +class AddForeignKeyFromPollsToUsers < ActiveRecord::Migration[7.1] + def change + add_foreign_key :polls, :users + end +end \ No newline at end of file diff --git a/db/migrate/20230501024923_create_poll_options.rb b/db/migrate/20230501024923_create_poll_options.rb index 9fd9a570..a2f3472b 100644 --- a/db/migrate/20230501024923_create_poll_options.rb +++ b/db/migrate/20230501024923_create_poll_options.rb @@ -1,4 +1,4 @@ -class CreatePollOptions < ActiveRecord::Migration[7.0] +class CreatePollOptions < ActiveRecord::Migration[7.1] def change create_table :poll_options, id: :uuid do |t| t.references :poll, null: false, foreign_key: true, type: :uuid diff --git a/db/migrate/20230501024948_create_poll_answers.rb b/db/migrate/20230501024948_create_poll_answers.rb index 20a013f8..5c64f6e6 100644 --- a/db/migrate/20230501024948_create_poll_answers.rb +++ b/db/migrate/20230501024948_create_poll_answers.rb @@ -1,9 +1,9 @@ -class CreatePollAnswers < ActiveRecord::Migration[7.0] +class CreatePollAnswers < ActiveRecord::Migration[7.1] def change create_table :poll_answers, id: :uuid do |t| t.references :user, null: false, foreign_key: true, type: :uuid - t.references :poll, null: false, foreign_key: true, type: :uuid - t.references :poll_option, null: false, foreign_key: true, type: :uuid + t.references :poll, null: false, foreign_key: false, type: :uuid + t.references :poll_option, null: false, foreign_key: false, type: :uuid t.string :title # Used when users can enter a free text under 250 chars long @@ -11,3 +11,16 @@ def change end end end + +# Add additional foreign keys at the end +class AddForeignKeyFromPollAnswersToPolld < ActiveRecord::Migration[7.1] + def change + add_foreign_key :poll_answers, :polls + end +end + +class AddForeignKeyFromPollAnswersToPollOptions < ActiveRecord::Migration[7.1] + def change + add_foreign_key :poll_answers, :poll_options + end +end \ No newline at end of file diff --git a/db/migrate/20230514234427_create_prompts.rb b/db/migrate/20230514234427_create_prompts.rb index 80bcd734..0059ece4 100644 --- a/db/migrate/20230514234427_create_prompts.rb +++ b/db/migrate/20230514234427_create_prompts.rb @@ -1,4 +1,4 @@ -class CreatePrompts < ActiveRecord::Migration[7.0] +class CreatePrompts < ActiveRecord::Migration[7.1] def change create_table :prompts, id: :uuid do |t| t.uuid :organization_id diff --git a/db/migrate/20230515175134_create_plans.rb b/db/migrate/20230515175134_create_plans.rb index fd7fe3cd..370259c0 100644 --- a/db/migrate/20230515175134_create_plans.rb +++ b/db/migrate/20230515175134_create_plans.rb @@ -1,4 +1,4 @@ -class CreatePlans < ActiveRecord::Migration[7.0] +class CreatePlans < ActiveRecord::Migration[7.1] def change create_table :plans, id: :uuid do |t| t.string :stripe_product_id, null: false diff --git a/db/migrate/20230515175407_create_subscriptions.rb b/db/migrate/20230515175407_create_subscriptions.rb index 508055db..edcfab06 100644 --- a/db/migrate/20230515175407_create_subscriptions.rb +++ b/db/migrate/20230515175407_create_subscriptions.rb @@ -1,4 +1,4 @@ -class CreateSubscriptions < ActiveRecord::Migration[7.0] +class CreateSubscriptions < ActiveRecord::Migration[7.1] def change create_table :subscriptions, id: :uuid do |t| t.references :organization, null: false, foreign_key: true, type: :uuid diff --git a/db/migrate/20230523222443_add_stripe_customer_id_to_organization.rb b/db/migrate/20230523222443_add_stripe_customer_id_to_organization.rb index 08632b97..f9123b3d 100644 --- a/db/migrate/20230523222443_add_stripe_customer_id_to_organization.rb +++ b/db/migrate/20230523222443_add_stripe_customer_id_to_organization.rb @@ -1,6 +1,7 @@ -class AddStripeCustomerIdToOrganization < ActiveRecord::Migration[7.0] +class AddStripeCustomerIdToOrganization < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change add_column :organizations, :stripe_customer_id, :string - add_index :organizations, :stripe_customer_id, unique: true + add_index :organizations, :stripe_customer_id, unique: true, algorithm: :concurrently end end diff --git a/db/migrate/20230705005152_add_unique_indexe_to_topics.rb b/db/migrate/20230705005152_add_unique_indexe_to_topics.rb index 76347d11..750051a5 100644 --- a/db/migrate/20230705005152_add_unique_indexe_to_topics.rb +++ b/db/migrate/20230705005152_add_unique_indexe_to_topics.rb @@ -1,5 +1,6 @@ -class AddUniqueIndexeToTopics < ActiveRecord::Migration[7.0] +class AddUniqueIndexeToTopics < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change - add_index :topics, [:question_id, :room_id, :user_id], unique: true + add_index :topics, [:question_id, :room_id, :user_id], unique: true, algorithm: :concurrently end end diff --git a/db/migrate/20230705191628_create_food_for_thoughts.rb b/db/migrate/20230705191628_create_food_for_thoughts.rb index 7e7cf179..8eebe472 100644 --- a/db/migrate/20230705191628_create_food_for_thoughts.rb +++ b/db/migrate/20230705191628_create_food_for_thoughts.rb @@ -1,4 +1,4 @@ -class CreateFoodForThoughts < ActiveRecord::Migration[7.0] +class CreateFoodForThoughts < ActiveRecord::Migration[7.1] def change create_table :food_for_thoughts, id: :uuid do |t| t.string :title, null: false diff --git a/db/migrate/20230707190034_add_pew_points_to_profile.rb b/db/migrate/20230707190034_add_pew_points_to_profile.rb index 01355b49..32bd39be 100644 --- a/db/migrate/20230707190034_add_pew_points_to_profile.rb +++ b/db/migrate/20230707190034_add_pew_points_to_profile.rb @@ -1,6 +1,7 @@ -class AddPewPointsToProfile < ActiveRecord::Migration[7.0] +class AddPewPointsToProfile < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change add_column :profiles, :pew_points, :integer, null: false, default: 0 - add_index :profiles, :pew_points + add_index :profiles, :pew_points, algorithm: :concurrently end end diff --git a/db/migrate/20230724181326_add_selector_to_poll.rb b/db/migrate/20230724181326_add_selector_to_poll.rb index 020bc11e..16df2dc5 100644 --- a/db/migrate/20230724181326_add_selector_to_poll.rb +++ b/db/migrate/20230724181326_add_selector_to_poll.rb @@ -1,6 +1,7 @@ -class AddSelectorToPoll < ActiveRecord::Migration[7.0] +class AddSelectorToPoll < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change add_column :polls, :selectors, :string, array: true, default: ["upvote", "downvote", "neutral"] - add_index :polls, :selectors + add_index :polls, :selectors, algorithm: :concurrently end end diff --git a/db/migrate/20230725000820_create_poll_participations.rb b/db/migrate/20230725000820_create_poll_participations.rb index f9226a72..7c892ddf 100644 --- a/db/migrate/20230725000820_create_poll_participations.rb +++ b/db/migrate/20230725000820_create_poll_participations.rb @@ -1,10 +1,17 @@ -class CreatePollParticipations < ActiveRecord::Migration[7.0] +class CreatePollParticipations < ActiveRecord::Migration[7.1] def change create_table :poll_participations, id: :uuid do |t| t.references :user, null: false, foreign_key: true, type: :uuid - t.references :poll, null: false, foreign_key: true, type: :uuid + t.references :poll, null: false, foreign_key: false, type: :uuid t.timestamps end end end + +# Add additional foreign keys at the end +class AddForeignKeyFromPollParticipationsToPolls < ActiveRecord::Migration[7.1] + def change + add_foreign_key :poll_participations, :polls + end +end \ No newline at end of file diff --git a/db/migrate/20230725052107_update_poll.rb b/db/migrate/20230725052107_update_poll.rb deleted file mode 100644 index 55fadb1a..00000000 --- a/db/migrate/20230725052107_update_poll.rb +++ /dev/null @@ -1,6 +0,0 @@ -class UpdatePoll < ActiveRecord::Migration[7.0] - def change - add_column :polls, :is_anonymous, :boolean, null: false, default: false - remove_column :polls, :participants - end -end diff --git a/db/migrate/20230727204155_remove_default_from_choice_in_votes.rb b/db/migrate/20230727204155_remove_default_from_choice_in_votes.rb index 5ecd83fd..4936fa22 100644 --- a/db/migrate/20230727204155_remove_default_from_choice_in_votes.rb +++ b/db/migrate/20230727204155_remove_default_from_choice_in_votes.rb @@ -1,4 +1,4 @@ -class RemoveDefaultFromChoiceInVotes < ActiveRecord::Migration[7.0] +class RemoveDefaultFromChoiceInVotes < ActiveRecord::Migration[7.1] def change change_column_default :votes, :choice, nil end diff --git a/db/migrate/20230728232345_add_status_to_poll_option.rb b/db/migrate/20230728232345_add_status_to_poll_option.rb index 4183fd4b..3ad47ec0 100644 --- a/db/migrate/20230728232345_add_status_to_poll_option.rb +++ b/db/migrate/20230728232345_add_status_to_poll_option.rb @@ -1,6 +1,7 @@ -class AddStatusToPollOption < ActiveRecord::Migration[7.0] +class AddStatusToPollOption < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def change add_column :poll_options, :status, :integer, null: false, default: 0 - add_index :poll_options, :status + add_index :poll_options, :status, algorithm: :concurrently end end diff --git a/db/migrate/20230730193848_create_resource_invites.rb b/db/migrate/20230730193848_create_resource_invites.rb index 9ff4fd10..5e02605a 100644 --- a/db/migrate/20230730193848_create_resource_invites.rb +++ b/db/migrate/20230730193848_create_resource_invites.rb @@ -1,4 +1,4 @@ -class CreateResourceInvites < ActiveRecord::Migration[7.0] +class CreateResourceInvites < ActiveRecord::Migration[7.1] def change create_table :resource_invites, id: :uuid do |t| t.references :sender, null: false, type: :uuid, index: true @@ -17,10 +17,6 @@ def change t.timestamps end - # add foreign keys separately - add_foreign_key :resource_invites, :users, column: :sender_id - add_foreign_key :resource_invites, :users, column: :recipient_id - # Indexes add_index :resource_invites, :status add_index :resource_invites, :email @@ -29,3 +25,16 @@ def change add_index :resource_invites, :token, unique: true end end + +# Add additional foreign keys at the end +class AddForeignKeyFromResourceInvitesToUsersSenderId < ActiveRecord::Migration[7.1] + def change + add_foreign_key :resource_invites, :users, column: :sender_id + end +end + +class AddForeignKeyFromResourceInvitesToUsersRecipientId < ActiveRecord::Migration[7.1] + def change + add_foreign_key :resource_invites, :users, column: :recipient_id + end +end \ No newline at end of file diff --git a/db/migrate/20230802183841_create_groups.rb b/db/migrate/20230802183841_create_groups.rb index 9efdd2f3..44509de7 100644 --- a/db/migrate/20230802183841_create_groups.rb +++ b/db/migrate/20230802183841_create_groups.rb @@ -1,8 +1,8 @@ -class CreateGroups < ActiveRecord::Migration[7.0] +class CreateGroups < ActiveRecord::Migration[7.1] def change create_table :groups, id: :uuid do |t| t.references :user, null: false, foreign_key: true, type: :uuid - t.references :organization, null: false, foreign_key: true, type: :uuid + t.references :organization, null: false, foreign_key: false, type: :uuid t.string :icon t.string :name t.text :description @@ -14,3 +14,10 @@ def change add_index :groups, :group_type end end + +# Add additional foreign keys at the end +class AddForeignKeyFromGroupsToOrganizations < ActiveRecord::Migration[7.1] + def change + add_foreign_key :groups, :organizations + end +end \ No newline at end of file diff --git a/db/migrate/20230802183847_create_group_memberships.rb b/db/migrate/20230802183847_create_group_memberships.rb index b179514b..9db17475 100644 --- a/db/migrate/20230802183847_create_group_memberships.rb +++ b/db/migrate/20230802183847_create_group_memberships.rb @@ -1,8 +1,8 @@ -class CreateGroupMemberships < ActiveRecord::Migration[7.0] +class CreateGroupMemberships < ActiveRecord::Migration[7.1] def change create_table :group_memberships, id: :uuid do |t| t.references :user, null: false, foreign_key: true, type: :uuid - t.references :group, null: false, foreign_key: true, type: :uuid + t.references :group, null: false, foreign_key: false, type: :uuid t.integer :role t.integer :status @@ -10,3 +10,10 @@ def change end end end + +# Add additional foreign keys at the end +class AddForeignKeyFromGroupMembershipsToGroups < ActiveRecord::Migration[7.1] + def change + add_foreign_key :group_memberships, :groups + end +end \ No newline at end of file diff --git a/db/migrate/20230824194117_add_details_to_rooms.rb b/db/migrate/20230824194117_add_details_to_rooms.rb index d076dc9b..18c7ba39 100644 --- a/db/migrate/20230824194117_add_details_to_rooms.rb +++ b/db/migrate/20230824194117_add_details_to_rooms.rb @@ -1,8 +1,6 @@ -class AddDetailsToRooms < ActiveRecord::Migration[7.0] +class AddDetailsToRooms < ActiveRecord::Migration[7.1] + disable_ddl_transaction! def up - # Add the room_type column - add_column :rooms, :room_type, :integer - # Add the end_date column without making it non-nullable yet add_column :rooms, :end_date, :datetime @@ -10,11 +8,14 @@ def up Room.update_all('end_date = start_date') # Now, change the end_date column to be non-nullable + add_not_null_constraint :rooms, :end_date, name: "rooms_end_date_null", validate: false + validate_not_null_constraint :rooms, :end_date, name: "rooms_end_date_null" + change_column_null :rooms, :end_date, false + remove_check_constraint :rooms, name: "rooms_end_date_null" end def down - remove_column :rooms, :room_type remove_column :rooms, :end_date end end diff --git a/db/migrate/20230901073924_create_question_answers.rb b/db/migrate/20230901073924_create_question_answers.rb index a8f09478..a3559b0e 100644 --- a/db/migrate/20230901073924_create_question_answers.rb +++ b/db/migrate/20230901073924_create_question_answers.rb @@ -1,10 +1,17 @@ -class CreateQuestionAnswers < ActiveRecord::Migration[7.0] +class CreateQuestionAnswers < ActiveRecord::Migration[7.1] def change create_table :question_answers, id: :uuid do |t| t.references :user, null: false, foreign_key: true, type: :uuid - t.references :question, null: false, foreign_key: true, type: :uuid + t.references :question, null: false, foreign_key: false, type: :uuid t.timestamps end end end + +# Add additional foreign keys at the end +class AddForeignKeyFromQuestionAnswersToQuestions < ActiveRecord::Migration[7.1] + def change + add_foreign_key :question_answers, :questions + end +end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 25a4ba95..5f5122d6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -162,9 +162,9 @@ t.index ["migration_name", "arguments"], name: "index_background_migrations_on_unique_configuration", unique: true end - create_table "badges_sashes", force: :cascade do |t| - t.integer "badge_id" - t.integer "sash_id" + create_table "badges_sashes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.uuid "badge_id" + t.uuid "sash_id" t.boolean "notified_user", default: false t.datetime "created_at" t.index ["badge_id", "sash_id"], name: "index_badges_sashes_on_badge_id_and_sash_id" @@ -196,7 +196,7 @@ t.string "short_code" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.uuid "organization_id", null: false + t.uuid "organization_id" t.index ["allow_anonymous"], name: "index_events_on_allow_anonymous" t.index ["always_on"], name: "index_events_on_always_on" t.index ["event_type"], name: "index_events_on_event_type" @@ -204,6 +204,7 @@ t.index ["short_code"], name: "index_events_on_short_code" t.index ["status"], name: "index_events_on_status" t.index ["user_id"], name: "index_events_on_user_id" + t.check_constraint "organization_id IS NOT NULL", name: "events_organization_id_null" end create_table "food_for_thoughts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -272,8 +273,8 @@ t.index ["user_id"], name: "index_members_on_user_id" end - create_table "merit_actions", force: :cascade do |t| - t.integer "user_id" + create_table "merit_actions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.uuid "user_id" t.string "action_method" t.integer "action_value" t.boolean "had_errors", default: false @@ -286,7 +287,7 @@ t.index ["processed"], name: "index_merit_actions_on_processed" end - create_table "merit_activity_logs", force: :cascade do |t| + create_table "merit_activity_logs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.integer "action_id" t.string "related_change_type" t.integer "related_change_id" @@ -295,15 +296,15 @@ end create_table "merit_score_points", force: :cascade do |t| - t.bigint "score_id" + t.uuid "score_id" t.bigint "num_points", default: 0 t.string "log" t.datetime "created_at" t.index ["score_id"], name: "index_merit_score_points_on_score_id" end - create_table "merit_scores", force: :cascade do |t| - t.bigint "sash_id" + create_table "merit_scores", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.uuid "sash_id" t.string "category", default: "default" t.index ["sash_id"], name: "index_merit_scores_on_sash_id" end @@ -414,16 +415,18 @@ t.integer "poll_type", null: false t.string "title", null: false t.integer "status", null: false + t.boolean "is_anonymous", default: false, null: false t.integer "num_answers" t.integer "max_answers" t.integer "num_votes" t.integer "max_votes" t.integer "duration" t.boolean "add_option", default: true, null: false + t.integer "participants", default: 0, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "selectors", default: ["upvote", "downvote", "neutral"], array: true - t.boolean "is_anonymous", default: false, null: false + t.index ["is_anonymous"], name: "index_polls_on_is_anonymous" t.index ["organization_id"], name: "index_polls_on_organization_id" t.index ["poll_type"], name: "index_polls_on_poll_type" t.index ["selectors"], name: "index_polls_on_selectors" @@ -472,13 +475,13 @@ t.uuid "room_id", null: false t.string "title", null: false t.integer "status", default: 0, null: false + t.integer "tone", default: 0, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.boolean "anonymous", default: false, null: false t.integer "rejection_cause" t.uuid "parent_id" - t.uuid "organization_id", null: false - t.integer "tone", default: 0, null: false + t.uuid "organization_id" t.jsonb "ai_response" t.string "keywords", default: [], array: true t.index ["anonymous"], name: "index_questions_on_anonymous" @@ -491,6 +494,7 @@ t.index ["user_id", "room_id"], name: "index_questions_on_user_id_and_room_id" t.index ["user_id", "status"], name: "index_questions_on_user_id_and_status" t.index ["user_id"], name: "index_questions_on_user_id" + t.check_constraint "organization_id IS NOT NULL", name: "questions_organization_id_null" end create_table "resource_invites", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -512,7 +516,6 @@ t.index ["email"], name: "index_resource_invites_on_email" t.index ["group_id"], name: "index_resource_invites_on_group_id" t.index ["invitable_type", "invitable_id"], name: "index_resource_invites_on_invitable" - t.index ["invitable_type", "invitable_id"], name: "index_resource_invites_on_invitable_type_and_invitable_id" t.index ["organization_id"], name: "index_resource_invites_on_organization_id" t.index ["recipient_id"], name: "index_resource_invites_on_recipient_id" t.index ["sender_id"], name: "index_resource_invites_on_sender_id" @@ -536,19 +539,21 @@ t.boolean "always_on", default: false, null: false t.boolean "allow_anonymous", default: false, null: false t.datetime "start_date", null: false + t.integer "room_type", default: 10, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.uuid "organization_id", null: false - t.integer "room_type" + t.uuid "organization_id" t.datetime "end_date", null: false t.index ["allow_anonymous"], name: "index_rooms_on_allow_anonymous" t.index ["always_on"], name: "index_rooms_on_always_on" t.index ["event_id"], name: "index_rooms_on_event_id" t.index ["organization_id"], name: "index_rooms_on_organization_id" + t.index ["room_type"], name: "index_rooms_on_room_type" t.index ["start_date"], name: "index_rooms_on_start_date" + t.check_constraint "organization_id IS NOT NULL", name: "rooms_organization_id_null" end - create_table "sashes", force: :cascade do |t| + create_table "sashes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false end @@ -606,7 +611,7 @@ t.string "uid" t.string "provider" t.string "time_zone" - t.integer "sash_id" + t.uuid "sash_id" t.integer "level", default: 0 t.boolean "invited", default: false, null: false t.datetime "invited_at", precision: nil @@ -654,32 +659,21 @@ add_foreign_key "active_sessions", "users", on_delete: :cascade add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" - add_foreign_key "attendances", "events" add_foreign_key "attendances", "users" add_foreign_key "background_migration_jobs", "background_migrations", column: "migration_id", on_delete: :cascade add_foreign_key "events", "users" - add_foreign_key "group_memberships", "groups" add_foreign_key "group_memberships", "users" - add_foreign_key "groups", "organizations" add_foreign_key "groups", "users" add_foreign_key "import_results", "users" add_foreign_key "messages", "users" - add_foreign_key "poll_answers", "poll_options" - add_foreign_key "poll_answers", "polls" add_foreign_key "poll_answers", "users" add_foreign_key "poll_options", "polls" - add_foreign_key "poll_participations", "polls" add_foreign_key "poll_participations", "users" add_foreign_key "polls", "organizations" - add_foreign_key "polls", "users" add_foreign_key "profiles", "users" - add_foreign_key "question_answers", "questions" add_foreign_key "question_answers", "users" - add_foreign_key "questions", "rooms" add_foreign_key "questions", "users" add_foreign_key "resource_invites", "organizations" - add_foreign_key "resource_invites", "users", column: "recipient_id" - add_foreign_key "resource_invites", "users", column: "sender_id" add_foreign_key "rooms", "events" add_foreign_key "subscriptions", "organizations" add_foreign_key "votes", "users" diff --git a/lib/tasks/stripe_sync.rake b/lib/tasks/stripe_sync.rake new file mode 100644 index 00000000..840cf3e9 --- /dev/null +++ b/lib/tasks/stripe_sync.rake @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# lib/tasks/stripe_sync.rake + +# Description: +# A set of tasks to synchronize data from Stripe to the database. + +namespace :stripe_sync do + + # Call rake stripe_sync:sync_plans + # to synchronize plans from Stripe + desc 'Synchronize plans from Stripe' + task sync_plans: :environment do + Stripe::Product.list(active: true).each do |stripe_product| + # puts '=== Product: ' + # puts "#{stripe_product.inspect}" + + # Fetching plans associated with the product + Stripe::Plan.list(product: stripe_product.id, active: true).each do |stripe_plan| + # puts '=== Plan: ' + # puts "#{stripe_plan.inspect}" + + plan = Plan.find_or_initialize_by(stripe_product_id: stripe_product.id) + + stripe_price_mo_id = plan.stripe_price_mo || nil + stripe_price_y_id = plan.stripe_price_y || nil + monthly_price = plan.price_mo + yearly_price = plan.price_y + + case stripe_plan.interval + when 'month' + stripe_price_mo_id = stripe_plan.id + monthly_price = stripe_plan.amount / 100.0 if stripe_plan.amount + when 'year' + stripe_price_y_id = stripe_plan.id + yearly_price = stripe_plan.amount / 100.0 if stripe_plan.amount + else + # Handle unexpected interval value + puts("Warning: Unexpected interval value '#{stripe_plan.interval}' for Stripe plan ID #{stripe_plan.id}") + end + + # Update the plan details + plan.update!( + label: stripe_product.name, + price_mo: monthly_price, + price_y: yearly_price, + stripe_price_mo: stripe_price_mo_id, + stripe_price_y: stripe_price_y_id, + active: stripe_plan.active, + features: { access_support: true } + # Add other attributes as needed + ) + end + end + puts 'Stripe plans synchronized successfully.' + end +end diff --git a/package.json b/package.json index 9392c2c5..028f09d1 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "dependencies": { "@honeybadger-io/js": "6.8.3", "@hotwired/stimulus": "3.2.2", - "@hotwired/turbo-rails": "7.3.0", + "@hotwired/turbo-rails": "8.0.3", "@rails/actiontext": "7.1.3", "@rails/activestorage": "7.1.3", "@rails/request.js": "0.0.9", @@ -13,16 +13,16 @@ "chart.js": "4.4.1", "chartjs-plugin-datalabels": "2.2.0", "chartkick": "5.0.1", - "esbuild": "0.19.11", - "flowbite": "2.2.1", + "esbuild": "0.20.0", + "flowbite": "2.3.0", "flowbite-datepicker": "1.2.6", "js-confetti": "0.12.0", - "postcss": "8.4.33", + "postcss": "8.4.35", "qr-code-styling": "1.6.0-rc.1", "stimulus-autocomplete": "3.1.0", "taggle": "1.15.0", "tailwindcss": "3.4.1", - "trix": "2.0.8" + "trix": "2.0.10" }, "scripts": { "build-old": "node esbuild.config.js", diff --git a/test/fixtures/attendances.yml b/test/fixtures/attendances.yml index 3abac59e..5381d810 100644 --- a/test/fixtures/attendances.yml +++ b/test/fixtures/attendances.yml @@ -20,7 +20,6 @@ # # Foreign Keys # -# fk_rails_... (event_id => events.id) # fk_rails_... (user_id => users.id) # diff --git a/test/fixtures/events.yml b/test/fixtures/events.yml index d960c9fe..9bfa36bb 100644 --- a/test/fixtures/events.yml +++ b/test/fixtures/events.yml @@ -14,7 +14,7 @@ # status :integer default("draft"), not null # created_at :datetime not null # updated_at :datetime not null -# organization_id :uuid not null +# organization_id :uuid # user_id :uuid not null # # Indexes diff --git a/test/fixtures/group_memberships.yml b/test/fixtures/group_memberships.yml index 0a2d8315..5a119018 100644 --- a/test/fixtures/group_memberships.yml +++ b/test/fixtures/group_memberships.yml @@ -17,7 +17,6 @@ # # Foreign Keys # -# fk_rails_... (group_id => groups.id) # fk_rails_... (user_id => users.id) # diff --git a/test/fixtures/groups.yml b/test/fixtures/groups.yml index e08142f1..1a54833d 100644 --- a/test/fixtures/groups.yml +++ b/test/fixtures/groups.yml @@ -20,7 +20,6 @@ # # Foreign Keys # -# fk_rails_... (organization_id => organizations.id) # fk_rails_... (user_id => users.id) # diff --git a/test/fixtures/poll_answers.yml b/test/fixtures/poll_answers.yml index 383458c9..5136f78c 100644 --- a/test/fixtures/poll_answers.yml +++ b/test/fixtures/poll_answers.yml @@ -18,8 +18,6 @@ # # Foreign Keys # -# fk_rails_... (poll_id => polls.id) -# fk_rails_... (poll_option_id => poll_options.id) # fk_rails_... (user_id => users.id) # diff --git a/test/fixtures/poll_participations.yml b/test/fixtures/poll_participations.yml index 05223343..550190a7 100644 --- a/test/fixtures/poll_participations.yml +++ b/test/fixtures/poll_participations.yml @@ -15,7 +15,6 @@ # # Foreign Keys # -# fk_rails_... (poll_id => polls.id) # fk_rails_... (user_id => users.id) # diff --git a/test/fixtures/polls.yml b/test/fixtures/polls.yml index eb10a5ea..6701ef34 100644 --- a/test/fixtures/polls.yml +++ b/test/fixtures/polls.yml @@ -10,6 +10,7 @@ # max_votes :integer # num_answers :integer # num_votes :integer +# participants :integer default(0), not null # poll_type :integer not null # selectors :string default(["\"upvote\"", "\"downvote\"", "\"neutral\""]), is an Array # status :integer not null @@ -21,6 +22,7 @@ # # Indexes # +# index_polls_on_is_anonymous (is_anonymous) # index_polls_on_organization_id (organization_id) # index_polls_on_poll_type (poll_type) # index_polls_on_selectors (selectors) @@ -30,7 +32,6 @@ # Foreign Keys # # fk_rails_... (organization_id => organizations.id) -# fk_rails_... (user_id => users.id) # one: diff --git a/test/fixtures/question_answers.yml b/test/fixtures/question_answers.yml index 61d3217e..7b10be8a 100644 --- a/test/fixtures/question_answers.yml +++ b/test/fixtures/question_answers.yml @@ -15,7 +15,6 @@ # # Foreign Keys # -# fk_rails_... (question_id => questions.id) # fk_rails_... (user_id => users.id) # diff --git a/test/fixtures/questions.yml b/test/fixtures/questions.yml index e8d5b28c..94149585 100644 --- a/test/fixtures/questions.yml +++ b/test/fixtures/questions.yml @@ -12,7 +12,7 @@ # tone :integer default("undefined"), not null # created_at :datetime not null # updated_at :datetime not null -# organization_id :uuid not null +# organization_id :uuid # parent_id :uuid # room_id :uuid not null # user_id :uuid not null @@ -32,7 +32,6 @@ # # Foreign Keys # -# fk_rails_... (room_id => rooms.id) # fk_rails_... (user_id => users.id) # diff --git a/test/fixtures/rooms.yml b/test/fixtures/rooms.yml index d0535ff7..69c9a7b6 100644 --- a/test/fixtures/rooms.yml +++ b/test/fixtures/rooms.yml @@ -7,12 +7,12 @@ # always_on :boolean default(FALSE), not null # end_date :datetime not null # name :string not null -# room_type :integer +# room_type :integer default("universal"), not null # start_date :datetime not null # created_at :datetime not null # updated_at :datetime not null # event_id :uuid not null -# organization_id :uuid not null +# organization_id :uuid # # Indexes # @@ -20,6 +20,7 @@ # index_rooms_on_always_on (always_on) # index_rooms_on_event_id (event_id) # index_rooms_on_organization_id (organization_id) +# index_rooms_on_room_type (room_type) # index_rooms_on_start_date (start_date) # # Foreign Keys diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 7156f171..3ad66046 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -20,7 +20,7 @@ # uid :string # created_at :datetime not null # updated_at :datetime not null -# sash_id :integer +# sash_id :uuid # # Indexes # @@ -68,4 +68,4 @@ mary: confirmed: true confirmed_at: <%= Time.current %> created_at: <%= Time.current %> - updated_at: <%= Time.current %> \ No newline at end of file + updated_at: <%= Time.current %> diff --git a/test/models/attendance_test.rb b/test/models/attendance_test.rb index 81a8db1b..4362d2e1 100644 --- a/test/models/attendance_test.rb +++ b/test/models/attendance_test.rb @@ -20,7 +20,6 @@ # # Foreign Keys # -# fk_rails_... (event_id => events.id) # fk_rails_... (user_id => users.id) # diff --git a/test/models/event_test.rb b/test/models/event_test.rb index 88c78571..7186fb5d 100644 --- a/test/models/event_test.rb +++ b/test/models/event_test.rb @@ -14,7 +14,7 @@ # status :integer default("draft"), not null # created_at :datetime not null # updated_at :datetime not null -# organization_id :uuid not null +# organization_id :uuid # user_id :uuid not null # # Indexes diff --git a/test/models/group_membership_test.rb b/test/models/group_membership_test.rb index 1b493140..8d12f6e9 100644 --- a/test/models/group_membership_test.rb +++ b/test/models/group_membership_test.rb @@ -17,7 +17,6 @@ # # Foreign Keys # -# fk_rails_... (group_id => groups.id) # fk_rails_... (user_id => users.id) # require "test_helper" diff --git a/test/models/group_test.rb b/test/models/group_test.rb index b214bf03..4fd86e2f 100644 --- a/test/models/group_test.rb +++ b/test/models/group_test.rb @@ -20,7 +20,6 @@ # # Foreign Keys # -# fk_rails_... (organization_id => organizations.id) # fk_rails_... (user_id => users.id) # require "test_helper" diff --git a/test/models/member_test.rb b/test/models/member_test.rb index a6b71a61..091049fa 100644 --- a/test/models/member_test.rb +++ b/test/models/member_test.rb @@ -57,4 +57,4 @@ def test_should_have_one_owner_for_each_organization assert_includes organization.members, member2 end -end \ No newline at end of file +end diff --git a/test/models/poll_answer_test.rb b/test/models/poll_answer_test.rb index 69c0f842..539b57db 100644 --- a/test/models/poll_answer_test.rb +++ b/test/models/poll_answer_test.rb @@ -18,8 +18,6 @@ # # Foreign Keys # -# fk_rails_... (poll_id => polls.id) -# fk_rails_... (poll_option_id => poll_options.id) # fk_rails_... (user_id => users.id) # require "test_helper" diff --git a/test/models/poll_participation_test.rb b/test/models/poll_participation_test.rb index b4d978fc..4021d671 100644 --- a/test/models/poll_participation_test.rb +++ b/test/models/poll_participation_test.rb @@ -15,7 +15,6 @@ # # Foreign Keys # -# fk_rails_... (poll_id => polls.id) # fk_rails_... (user_id => users.id) # require "test_helper" diff --git a/test/models/poll_test.rb b/test/models/poll_test.rb index 2e6679a9..809d8db6 100644 --- a/test/models/poll_test.rb +++ b/test/models/poll_test.rb @@ -10,6 +10,7 @@ # max_votes :integer # num_answers :integer # num_votes :integer +# participants :integer default(0), not null # poll_type :integer not null # selectors :string default(["\"upvote\"", "\"downvote\"", "\"neutral\""]), is an Array # status :integer not null @@ -21,6 +22,7 @@ # # Indexes # +# index_polls_on_is_anonymous (is_anonymous) # index_polls_on_organization_id (organization_id) # index_polls_on_poll_type (poll_type) # index_polls_on_selectors (selectors) @@ -30,7 +32,6 @@ # Foreign Keys # # fk_rails_... (organization_id => organizations.id) -# fk_rails_... (user_id => users.id) # require "test_helper" diff --git a/test/models/question_answer_test.rb b/test/models/question_answer_test.rb index 0d600020..474e78d5 100644 --- a/test/models/question_answer_test.rb +++ b/test/models/question_answer_test.rb @@ -15,7 +15,6 @@ # # Foreign Keys # -# fk_rails_... (question_id => questions.id) # fk_rails_... (user_id => users.id) # require "test_helper" diff --git a/test/models/question_test.rb b/test/models/question_test.rb index d7d29049..a3aaac19 100644 --- a/test/models/question_test.rb +++ b/test/models/question_test.rb @@ -12,7 +12,7 @@ # tone :integer default("undefined"), not null # created_at :datetime not null # updated_at :datetime not null -# organization_id :uuid not null +# organization_id :uuid # parent_id :uuid # room_id :uuid not null # user_id :uuid not null @@ -32,7 +32,6 @@ # # Foreign Keys # -# fk_rails_... (room_id => rooms.id) # fk_rails_... (user_id => users.id) # require 'test_helper' diff --git a/test/models/resource_invite_test.rb b/test/models/resource_invite_test.rb index 0e5d898d..be749869 100644 --- a/test/models/resource_invite_test.rb +++ b/test/models/resource_invite_test.rb @@ -21,21 +21,18 @@ # # Indexes # -# index_resource_invites_on_email (email) -# index_resource_invites_on_group_id (group_id) -# index_resource_invites_on_invitable (invitable_type,invitable_id) -# index_resource_invites_on_invitable_type_and_invitable_id (invitable_type,invitable_id) -# index_resource_invites_on_organization_id (organization_id) -# index_resource_invites_on_recipient_id (recipient_id) -# index_resource_invites_on_sender_id (sender_id) -# index_resource_invites_on_status (status) -# index_resource_invites_on_token (token) UNIQUE +# index_resource_invites_on_email (email) +# index_resource_invites_on_group_id (group_id) +# index_resource_invites_on_invitable (invitable_type,invitable_id) +# index_resource_invites_on_organization_id (organization_id) +# index_resource_invites_on_recipient_id (recipient_id) +# index_resource_invites_on_sender_id (sender_id) +# index_resource_invites_on_status (status) +# index_resource_invites_on_token (token) UNIQUE # # Foreign Keys # # fk_rails_... (organization_id => organizations.id) -# fk_rails_... (recipient_id => users.id) -# fk_rails_... (sender_id => users.id) # require "test_helper" diff --git a/test/models/room_test.rb b/test/models/room_test.rb index 8a2a3557..be085b8d 100644 --- a/test/models/room_test.rb +++ b/test/models/room_test.rb @@ -7,12 +7,12 @@ # always_on :boolean default(FALSE), not null # end_date :datetime not null # name :string not null -# room_type :integer +# room_type :integer default("universal"), not null # start_date :datetime not null # created_at :datetime not null # updated_at :datetime not null # event_id :uuid not null -# organization_id :uuid not null +# organization_id :uuid # # Indexes # @@ -20,6 +20,7 @@ # index_rooms_on_always_on (always_on) # index_rooms_on_event_id (event_id) # index_rooms_on_organization_id (organization_id) +# index_rooms_on_room_type (room_type) # index_rooms_on_start_date (start_date) # # Foreign Keys diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 410296ec..d0622d92 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -20,7 +20,7 @@ # uid :string # created_at :datetime not null # updated_at :datetime not null -# sash_id :integer +# sash_id :uuid # # Indexes # diff --git a/yarn.lock b/yarn.lock index 9b7d0e85..16be2e45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14,120 +14,120 @@ dependencies: regenerator-runtime "^0.14.0" -"@esbuild/aix-ppc64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz#2acd20be6d4f0458bc8c784103495ff24f13b1d3" - integrity sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g== - -"@esbuild/android-arm64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz#b45d000017385c9051a4f03e17078abb935be220" - integrity sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q== - -"@esbuild/android-arm@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.11.tgz#f46f55414e1c3614ac682b29977792131238164c" - integrity sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw== - -"@esbuild/android-x64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.11.tgz#bfc01e91740b82011ef503c48f548950824922b2" - integrity sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg== - -"@esbuild/darwin-arm64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz#533fb7f5a08c37121d82c66198263dcc1bed29bf" - integrity sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ== - -"@esbuild/darwin-x64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz#62f3819eff7e4ddc656b7c6815a31cf9a1e7d98e" - integrity sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g== - -"@esbuild/freebsd-arm64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz#d478b4195aa3ca44160272dab85ef8baf4175b4a" - integrity sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA== - -"@esbuild/freebsd-x64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz#7bdcc1917409178257ca6a1a27fe06e797ec18a2" - integrity sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw== - -"@esbuild/linux-arm64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz#58ad4ff11685fcc735d7ff4ca759ab18fcfe4545" - integrity sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg== - -"@esbuild/linux-arm@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz#ce82246d873b5534d34de1e5c1b33026f35e60e3" - integrity sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q== - -"@esbuild/linux-ia32@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz#cbae1f313209affc74b80f4390c4c35c6ab83fa4" - integrity sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA== - -"@esbuild/linux-loong64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz#5f32aead1c3ec8f4cccdb7ed08b166224d4e9121" - integrity sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg== - -"@esbuild/linux-mips64el@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz#38eecf1cbb8c36a616261de858b3c10d03419af9" - integrity sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg== - -"@esbuild/linux-ppc64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz#9c5725a94e6ec15b93195e5a6afb821628afd912" - integrity sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA== - -"@esbuild/linux-riscv64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz#2dc4486d474a2a62bbe5870522a9a600e2acb916" - integrity sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ== - -"@esbuild/linux-s390x@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz#4ad8567df48f7dd4c71ec5b1753b6f37561a65a8" - integrity sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q== - -"@esbuild/linux-x64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz#b7390c4d5184f203ebe7ddaedf073df82a658766" - integrity sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA== - -"@esbuild/netbsd-x64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz#d633c09492a1721377f3bccedb2d821b911e813d" - integrity sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ== - -"@esbuild/openbsd-x64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz#17388c76e2f01125bf831a68c03a7ffccb65d1a2" - integrity sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw== - -"@esbuild/sunos-x64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz#e320636f00bb9f4fdf3a80e548cb743370d41767" - integrity sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ== - -"@esbuild/win32-arm64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz#c778b45a496e90b6fc373e2a2bb072f1441fe0ee" - integrity sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ== - -"@esbuild/win32-ia32@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz#481a65fee2e5cce74ec44823e6b09ecedcc5194c" - integrity sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg== - -"@esbuild/win32-x64@0.19.11": - version "0.19.11" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz#a5d300008960bb39677c46bf16f53ec70d8dee04" - integrity sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw== +"@esbuild/aix-ppc64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.20.0.tgz#509621cca4e67caf0d18561a0c56f8b70237472f" + integrity sha512-fGFDEctNh0CcSwsiRPxiaqX0P5rq+AqE0SRhYGZ4PX46Lg1FNR6oCxJghf8YgY0WQEgQuh3lErUFE4KxLeRmmw== + +"@esbuild/android-arm64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.20.0.tgz#109a6fdc4a2783fc26193d2687827045d8fef5ab" + integrity sha512-aVpnM4lURNkp0D3qPoAzSG92VXStYmoVPOgXveAUoQBWRSuQzt51yvSju29J6AHPmwY1BjH49uR29oyfH1ra8Q== + +"@esbuild/android-arm@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.20.0.tgz#1397a2c54c476c4799f9b9073550ede496c94ba5" + integrity sha512-3bMAfInvByLHfJwYPJRlpTeaQA75n8C/QKpEaiS4HrFWFiJlNI0vzq/zCjBrhAYcPyVPG7Eo9dMrcQXuqmNk5g== + +"@esbuild/android-x64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.20.0.tgz#2b615abefb50dc0a70ac313971102f4ce2fdb3ca" + integrity sha512-uK7wAnlRvjkCPzh8jJ+QejFyrP8ObKuR5cBIsQZ+qbMunwR8sbd8krmMbxTLSrDhiPZaJYKQAU5Y3iMDcZPhyQ== + +"@esbuild/darwin-arm64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.20.0.tgz#5c122ed799eb0c35b9d571097f77254964c276a2" + integrity sha512-AjEcivGAlPs3UAcJedMa9qYg9eSfU6FnGHJjT8s346HSKkrcWlYezGE8VaO2xKfvvlZkgAhyvl06OJOxiMgOYQ== + +"@esbuild/darwin-x64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.20.0.tgz#9561d277002ba8caf1524f209de2b22e93d170c1" + integrity sha512-bsgTPoyYDnPv8ER0HqnJggXK6RyFy4PH4rtsId0V7Efa90u2+EifxytE9pZnsDgExgkARy24WUQGv9irVbTvIw== + +"@esbuild/freebsd-arm64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.0.tgz#84178986a3138e8500d17cc380044868176dd821" + integrity sha512-kQ7jYdlKS335mpGbMW5tEe3IrQFIok9r84EM3PXB8qBFJPSc6dpWfrtsC/y1pyrz82xfUIn5ZrnSHQQsd6jebQ== + +"@esbuild/freebsd-x64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.20.0.tgz#3f9ce53344af2f08d178551cd475629147324a83" + integrity sha512-uG8B0WSepMRsBNVXAQcHf9+Ko/Tr+XqmK7Ptel9HVmnykupXdS4J7ovSQUIi0tQGIndhbqWLaIL/qO/cWhXKyQ== + +"@esbuild/linux-arm64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.20.0.tgz#24efa685515689df4ecbc13031fa0a9dda910a11" + integrity sha512-uTtyYAP5veqi2z9b6Gr0NUoNv9F/rOzI8tOD5jKcCvRUn7T60Bb+42NDBCWNhMjkQzI0qqwXkQGo1SY41G52nw== + +"@esbuild/linux-arm@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.20.0.tgz#6b586a488e02e9b073a75a957f2952b3b6e87b4c" + integrity sha512-2ezuhdiZw8vuHf1HKSf4TIk80naTbP9At7sOqZmdVwvvMyuoDiZB49YZKLsLOfKIr77+I40dWpHVeY5JHpIEIg== + +"@esbuild/linux-ia32@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.20.0.tgz#84ce7864f762708dcebc1b123898a397dea13624" + integrity sha512-c88wwtfs8tTffPaoJ+SQn3y+lKtgTzyjkD8NgsyCtCmtoIC8RDL7PrJU05an/e9VuAke6eJqGkoMhJK1RY6z4w== + +"@esbuild/linux-loong64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.20.0.tgz#1922f571f4cae1958e3ad29439c563f7d4fd9037" + integrity sha512-lR2rr/128/6svngnVta6JN4gxSXle/yZEZL3o4XZ6esOqhyR4wsKyfu6qXAL04S4S5CgGfG+GYZnjFd4YiG3Aw== + +"@esbuild/linux-mips64el@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.20.0.tgz#7ca1bd9df3f874d18dbf46af009aebdb881188fe" + integrity sha512-9Sycc+1uUsDnJCelDf6ZNqgZQoK1mJvFtqf2MUz4ujTxGhvCWw+4chYfDLPepMEvVL9PDwn6HrXad5yOrNzIsQ== + +"@esbuild/linux-ppc64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.20.0.tgz#8f95baf05f9486343bceeb683703875d698708a4" + integrity sha512-CoWSaaAXOZd+CjbUTdXIJE/t7Oz+4g90A3VBCHLbfuc5yUQU/nFDLOzQsN0cdxgXd97lYW/psIIBdjzQIwTBGw== + +"@esbuild/linux-riscv64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.20.0.tgz#ca63b921d5fe315e28610deb0c195e79b1a262ca" + integrity sha512-mlb1hg/eYRJUpv8h/x+4ShgoNLL8wgZ64SUr26KwglTYnwAWjkhR2GpoKftDbPOCnodA9t4Y/b68H4J9XmmPzA== + +"@esbuild/linux-s390x@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.20.0.tgz#cb3d069f47dc202f785c997175f2307531371ef8" + integrity sha512-fgf9ubb53xSnOBqyvWEY6ukBNRl1mVX1srPNu06B6mNsNK20JfH6xV6jECzrQ69/VMiTLvHMicQR/PgTOgqJUQ== + +"@esbuild/linux-x64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.20.0.tgz#ac617e0dc14e9758d3d7efd70288c14122557dc7" + integrity sha512-H9Eu6MGse++204XZcYsse1yFHmRXEWgadk2N58O/xd50P9EvFMLJTQLg+lB4E1cF2xhLZU5luSWtGTb0l9UeSg== + +"@esbuild/netbsd-x64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.20.0.tgz#6cc778567f1513da6e08060e0aeb41f82eb0f53c" + integrity sha512-lCT675rTN1v8Fo+RGrE5KjSnfY0x9Og4RN7t7lVrN3vMSjy34/+3na0q7RIfWDAj0e0rCh0OL+P88lu3Rt21MQ== + +"@esbuild/openbsd-x64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.20.0.tgz#76848bcf76b4372574fb4d06cd0ed1fb29ec0fbe" + integrity sha512-HKoUGXz/TOVXKQ+67NhxyHv+aDSZf44QpWLa3I1lLvAwGq8x1k0T+e2HHSRvxWhfJrFxaaqre1+YyzQ99KixoA== + +"@esbuild/sunos-x64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.20.0.tgz#ea4cd0639bf294ad51bc08ffbb2dac297e9b4706" + integrity sha512-GDwAqgHQm1mVoPppGsoq4WJwT3vhnz/2N62CzhvApFD1eJyTroob30FPpOZabN+FgCjhG+AgcZyOPIkR8dfD7g== + +"@esbuild/win32-arm64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.20.0.tgz#a5c171e4a7f7e4e8be0e9947a65812c1535a7cf0" + integrity sha512-0vYsP8aC4TvMlOQYozoksiaxjlvUcQrac+muDqj1Fxy6jh9l9CZJzj7zmh8JGfiV49cYLTorFLxg7593pGldwQ== + +"@esbuild/win32-ia32@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.20.0.tgz#f8ac5650c412d33ea62d7551e0caf82da52b7f85" + integrity sha512-p98u4rIgfh4gdpV00IqknBD5pC84LCub+4a3MO+zjqvU5MVXOc3hqR2UgT2jI2nh3h8s9EQxmOsVI3tyzv1iFg== + +"@esbuild/win32-x64@0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.20.0.tgz#2efddf82828aac85e64cef62482af61c29561bee" + integrity sha512-NgJnesu1RtWihtTtXGFMU5YSE6JyyHPMxCwBZK7a6/8d31GuSo9l0Ss7w1Jw5QnKUawG6UEehs883kcXf5fYwg== "@honeybadger-io/core@^6.5.1": version "6.5.1" @@ -151,18 +151,18 @@ resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.2.2.tgz#071aab59c600fed95b97939e605ff261a4251608" integrity sha512-eGeIqNOQpXoPAIP7tC1+1Yc1yl1xnwYqg+3mzqxyrbE5pg5YFBZcA6YoTiByJB6DKAEsiWtl6tjTJS4IYtbB7A== -"@hotwired/turbo-rails@7.3.0": - version "7.3.0" - resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-7.3.0.tgz#422c21752509f3edcd6c7b2725bbe9e157815f51" - integrity sha512-fvhO64vp/a2UVQ3jue9WTc2JisMv9XilIC7ViZmXAREVwiQ2S4UC7Go8f9A1j4Xu7DBI6SbFdqILk5ImqVoqyA== +"@hotwired/turbo-rails@8.0.3": + version "8.0.3" + resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-8.0.3.tgz#e60375f4eea4b30ec0cd6d7e3fdb3d6349a2b57b" + integrity sha512-n5B9HdFsNiGJfXFAriCArmvFZyznIh/OriB5ZVAWz4Fsi4oLkpgmJNw5pibBAM7NMQQGN6cfKa/nhZT4LWcqbQ== dependencies: - "@hotwired/turbo" "^7.3.0" + "@hotwired/turbo" "^8.0.3" "@rails/actioncable" "^7.0" -"@hotwired/turbo@^7.3.0": - version "7.3.0" - resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-7.3.0.tgz#2226000fff1aabda9fd9587474565c9929dbf15d" - integrity sha512-Dcu+NaSvHLT7EjrDrkEmH4qET2ZJZ5IcCWmNXxNQTBwlnE5tBZfN6WxZ842n5cHV52DH/AKNirbPBtcEXDLW4g== +"@hotwired/turbo@^8.0.3": + version "8.0.3" + resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-8.0.3.tgz#338e07278f4b3c76921328d3c92dbc4831c209d0" + integrity sha512-qLgp7d6JaegKjMToTJahosrFxV3odfSbiekispQ3soOzE5jnU+iEMWlRvYRe/jvy5Q+JWoywtf9j3RD4ikVjIg== "@jridgewell/gen-mapping@^0.3.2": version "0.3.3" @@ -515,34 +515,34 @@ electron-to-chromium@^1.4.601: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.636.tgz#302cf4c3016d9d714ba246243a7c97b528e22fe7" integrity sha512-NLE0GIy1OL9wRiKL20h9TkctBEYZuc99tquSS9MVdTahnuHputoETHeqDzgqGqyOY9NUH0g9wjfEuw5OD+wRcQ== -esbuild@0.19.11: - version "0.19.11" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.11.tgz#4a02dca031e768b5556606e1b468fe72e3325d96" - integrity sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA== +esbuild@0.20.0: + version "0.20.0" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.20.0.tgz#a7170b63447286cd2ff1f01579f09970e6965da4" + integrity sha512-6iwE3Y2RVYCME1jLpBqq7LQWK3MW6vjV2bZy6gt/WrqkY+WE74Spyc0ThAOYpMtITvnjX09CrC6ym7A/m9mebA== optionalDependencies: - "@esbuild/aix-ppc64" "0.19.11" - "@esbuild/android-arm" "0.19.11" - "@esbuild/android-arm64" "0.19.11" - "@esbuild/android-x64" "0.19.11" - "@esbuild/darwin-arm64" "0.19.11" - "@esbuild/darwin-x64" "0.19.11" - "@esbuild/freebsd-arm64" "0.19.11" - "@esbuild/freebsd-x64" "0.19.11" - "@esbuild/linux-arm" "0.19.11" - "@esbuild/linux-arm64" "0.19.11" - "@esbuild/linux-ia32" "0.19.11" - "@esbuild/linux-loong64" "0.19.11" - "@esbuild/linux-mips64el" "0.19.11" - "@esbuild/linux-ppc64" "0.19.11" - "@esbuild/linux-riscv64" "0.19.11" - "@esbuild/linux-s390x" "0.19.11" - "@esbuild/linux-x64" "0.19.11" - "@esbuild/netbsd-x64" "0.19.11" - "@esbuild/openbsd-x64" "0.19.11" - "@esbuild/sunos-x64" "0.19.11" - "@esbuild/win32-arm64" "0.19.11" - "@esbuild/win32-ia32" "0.19.11" - "@esbuild/win32-x64" "0.19.11" + "@esbuild/aix-ppc64" "0.20.0" + "@esbuild/android-arm" "0.20.0" + "@esbuild/android-arm64" "0.20.0" + "@esbuild/android-x64" "0.20.0" + "@esbuild/darwin-arm64" "0.20.0" + "@esbuild/darwin-x64" "0.20.0" + "@esbuild/freebsd-arm64" "0.20.0" + "@esbuild/freebsd-x64" "0.20.0" + "@esbuild/linux-arm" "0.20.0" + "@esbuild/linux-arm64" "0.20.0" + "@esbuild/linux-ia32" "0.20.0" + "@esbuild/linux-loong64" "0.20.0" + "@esbuild/linux-mips64el" "0.20.0" + "@esbuild/linux-ppc64" "0.20.0" + "@esbuild/linux-riscv64" "0.20.0" + "@esbuild/linux-s390x" "0.20.0" + "@esbuild/linux-x64" "0.20.0" + "@esbuild/netbsd-x64" "0.20.0" + "@esbuild/openbsd-x64" "0.20.0" + "@esbuild/sunos-x64" "0.20.0" + "@esbuild/win32-arm64" "0.20.0" + "@esbuild/win32-ia32" "0.20.0" + "@esbuild/win32-x64" "0.20.0" escalade@^3.1.1: version "3.1.1" @@ -581,10 +581,10 @@ flowbite-datepicker@1.2.6: dependencies: flowbite "^2.0.0" -flowbite@2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/flowbite/-/flowbite-2.2.1.tgz#9e22be9ff746bccb9fcf87979bbc5e41a16eaf7a" - integrity sha512-iiZyBTtriEDRHrqXZgpKHaxl4B2J8HZUP8Yn1RXozUDKszWHDVj4GxQqMMB9AJHRWOgXV/4E/LJZ/zqQgBUhWA== +flowbite@2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/flowbite/-/flowbite-2.3.0.tgz#0730e35d8b0d1dcdea26bb27d848bd9c0141cde1" + integrity sha512-pm3JRo8OIJHGfFYWgaGpPv8E+UdWy0Z3gEAGufw+G/1dusaU/P1zoBLiQpf2/+bYAi+GBQtPVG86KYlV0W+AFQ== dependencies: "@popperjs/core" "^2.9.3" mini-svg-data-uri "^1.4.3" @@ -885,10 +885,10 @@ postcss-value-parser@^4.0.0, postcss-value-parser@^4.2.0: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== -postcss@8.4.33: - version "8.4.33" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.33.tgz#1378e859c9f69bf6f638b990a0212f43e2aaa742" - integrity sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg== +postcss@8.4.35: + version "8.4.35" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.35.tgz#60997775689ce09011edf083a549cea44aabe2f7" + integrity sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA== dependencies: nanoid "^3.3.7" picocolors "^1.0.0" @@ -1054,10 +1054,10 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -trix@2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/trix/-/trix-2.0.8.tgz#6fff81b9e02c4f60a181febb3f6e862fbb98f1c4" - integrity sha512-tPqJl+NjALVUOC8sNfRrY42K7cfp4QBb9svXxmfhxYrspF9fOOzXq+GnDa9l2ZAcfM43msnPpkJ7MrJQA3FgrA== +trix@2.0.10: + version "2.0.10" + resolved "https://registry.yarnpkg.com/trix/-/trix-2.0.10.tgz#43f1ff7a94c42f708bd2bad3a2783147c0583698" + integrity sha512-a24w8rNVL+g9nDDdiDZwQVQ9AEWiXAmk9r0ZbwimczJi/xlaM+m0d6upAi0vysDNu0HsiYDFS1/VrR7HbX0Aig== ts-interface-checker@^0.1.9: version "0.1.13"