From aa59cae9c9686c8a7e9cd8c48f774a4c5409bb00 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 12 Aug 2024 10:02:48 +0000 Subject: [PATCH 001/283] Update docker/build-push-action action to v6 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f7a5815..27314de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . push: ${{ github.event_name != 'pull_request' }} From fe6794ebc61911c99f62a35e78b84c3045ddd290 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 12 Aug 2024 23:03:46 +0000 Subject: [PATCH 002/283] Update dependency rubytree to v2.1.0 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8b9b054..acd4cb2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -275,7 +275,7 @@ GEM rubocop-ast (1.32.0) parser (>= 3.3.1.0) ruby-progressbar (1.13.0) - rubytree (2.0.3) + rubytree (2.1.0) json (~> 2.0, > 2.3.1) sprockets (4.2.1) concurrent-ruby (~> 1.0) From 372bf7457b28fcee0e2dfd0ed4c9324a27d49548 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 17 Aug 2024 00:03:14 +0000 Subject: [PATCH 003/283] Update dependency stimulus-rails to v1.3.4 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index acd4cb2..69aef1a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -284,7 +284,7 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - stimulus-rails (1.3.3) + stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.1) thor (1.3.1) From 55486887b65ad3f66a144b6c2240e4925805db49 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 21 Aug 2024 08:04:18 +0000 Subject: [PATCH 004/283] Update dependency redis to v5.3.0 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 69aef1a..39a1e41 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -236,7 +236,7 @@ GEM execjs railties (>= 3.2) tilt - redis (5.2.0) + redis (5.3.0) redis-client (>= 0.22.0) redis-client (0.22.2) connection_pool From c2a1aa51869d70c7435a22e8b2dc576b55636a30 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 23 Aug 2024 10:02:21 +0000 Subject: [PATCH 005/283] Update dependency acts-as-taggable-on to v11 --- Gemfile.lock | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 39a1e41..b9861f7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,8 +75,9 @@ GEM minitest (>= 5.1) mutex_m tzinfo (~> 2.0) - acts-as-taggable-on (10.0.0) - activerecord (>= 6.1, < 7.2) + acts-as-taggable-on (11.0.0) + activerecord (>= 7.0, < 8.0) + zeitwerk (>= 2.4, < 3.0) ast (2.4.2) babel-source (5.8.35) babel-transpiler (0.7.0) @@ -147,7 +148,7 @@ GEM marcel (1.0.4) method_source (1.0.0) mini_mime (1.1.5) - minitest (5.24.1) + minitest (5.25.1) money (6.19.0) i18n (>= 0.6.4, <= 2) msgpack (1.7.2) From 4078b50cacd8ed72c3a4bc5873a35e425a89ac74 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 29 Aug 2024 18:02:30 +0000 Subject: [PATCH 006/283] Update dependency rspec-rails to v6.1.4 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index b9861f7..2042efe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -288,7 +288,7 @@ GEM stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.1) - thor (1.3.1) + thor (1.3.2) tilt (2.4.0) timeout (0.4.1) turbo-rails (2.0.6) From 0fa00b8521d87b1e6ec0212c338ce467180a7c0a Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 31 Aug 2024 09:02:52 +0000 Subject: [PATCH 007/283] Update dependency rails to '~> 7.2.0', '>= 7.2.1' --- Gemfile | 2 +- Gemfile.lock | 136 +++++++++++++++++++++++++-------------------------- 2 files changed, 68 insertions(+), 70 deletions(-) diff --git a/Gemfile b/Gemfile index 6f53d2e..33dcc4d 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,7 @@ gem 'jbuilder' gem 'money' gem 'pg', '~> 1.1' gem 'puma', '>= 5.0' -gem 'rails', '~> 7.1.3', '>= 7.1.3.2' +gem 'rails', '~> 7.2.0', '>= 7.2.1' gem 'redis', '>= 4.0.1' gem 'sprockets-rails' gem 'stimulus-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 2042efe..6e07a18 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,80 +1,76 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) + actioncable (7.2.1) + actionpack (= 7.2.1) + activesupport (= 7.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.3.4) - actionpack (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activesupport (= 7.1.3.4) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailbox (7.2.1) + actionpack (= 7.2.1) + activejob (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) + mail (>= 2.8.0) + actionmailer (7.2.1) + actionpack (= 7.2.1) + actionview (= 7.2.1) + activejob (= 7.2.1) + activesupport (= 7.2.1) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.3.4) - actionview (= 7.1.3.4) - activesupport (= 7.1.3.4) + actionpack (7.2.1) + actionview (= 7.2.1) + activesupport (= 7.2.1) nokogiri (>= 1.8.5) racc - rack (>= 2.2.4) + rack (>= 2.2.4, < 3.2) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3.4) - actionpack (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + useragent (~> 0.16) + actiontext (7.2.1) + actionpack (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3.4) - activesupport (= 7.1.3.4) + actionview (7.2.1) + activesupport (= 7.2.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.3.4) - activesupport (= 7.1.3.4) + activejob (7.2.1) + activesupport (= 7.2.1) globalid (>= 0.3.6) - activemodel (7.1.3.4) - activesupport (= 7.1.3.4) - activerecord (7.1.3.4) - activemodel (= 7.1.3.4) - activesupport (= 7.1.3.4) + activemodel (7.2.1) + activesupport (= 7.2.1) + activerecord (7.2.1) + activemodel (= 7.2.1) + activesupport (= 7.2.1) timeout (>= 0.4.0) - activestorage (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activesupport (= 7.1.3.4) + activestorage (7.2.1) + actionpack (= 7.2.1) + activejob (= 7.2.1) + activerecord (= 7.2.1) + activesupport (= 7.2.1) marcel (~> 1.0) - activesupport (7.1.3.4) + activesupport (7.2.1) base64 bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) acts-as-taggable-on (11.0.0) activerecord (>= 7.0, < 8.0) zeitwerk (>= 2.4, < 3.0) @@ -137,6 +133,7 @@ GEM jsonapi-serializable (0.3.1) jsonapi-renderer (~> 0.2.0) language_server-protocol (3.17.0.3) + logger (1.6.0) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -152,8 +149,7 @@ GEM money (6.19.0) i18n (>= 0.6.4, <= 2) msgpack (1.7.2) - mutex_m (0.2.0) - net-imap (0.4.14) + net-imap (0.4.15) date net-protocol net-pop (0.1.2) @@ -198,20 +194,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.1.3.4) - actioncable (= 7.1.3.4) - actionmailbox (= 7.1.3.4) - actionmailer (= 7.1.3.4) - actionpack (= 7.1.3.4) - actiontext (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activemodel (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + rails (7.2.1) + actioncable (= 7.2.1) + actionmailbox (= 7.2.1) + actionmailer (= 7.2.1) + actionpack (= 7.2.1) + actiontext (= 7.2.1) + actionview (= 7.2.1) + activejob (= 7.2.1) + activemodel (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) bundler (>= 1.15.0) - railties (= 7.1.3.4) + railties (= 7.2.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -219,10 +215,10 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) - irb + railties (7.2.1) + actionpack (= 7.2.1) + activesupport (= 7.2.1) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) @@ -278,6 +274,7 @@ GEM ruby-progressbar (1.13.0) rubytree (2.1.0) json (~> 2.0, > 2.3.1) + securerandom (0.3.1) sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) @@ -298,6 +295,7 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) + useragent (0.16.10) web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) @@ -332,7 +330,7 @@ DEPENDENCIES pry puma (>= 5.0) rack-cors - rails (~> 7.1.3, >= 7.1.3.2) + rails (~> 7.2.0, >= 7.2.1) react-rails redis (>= 4.0.1) rspec-rails (~> 6.1.0) From b4d80deeac5cfe8fe9663947e7929d6857d0da54 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 7 Sep 2024 15:57:37 +0200 Subject: [PATCH 008/283] Match image name with repo name --- .github/workflows/build.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27314de..16e72bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build docker image +name: Build Nginx-based docker image on: push: branches: @@ -15,17 +15,19 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub + - name: Login to the private Docker registry uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ${{ secrets.PRIVATE_REGISTRY_HOST }} + username: ${{ secrets.PRIVATE_REGISTRY_USERNAME }} + password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }} - name: Build and push uses: docker/build-push-action@v6 with: context: . push: ${{ github.event_name != 'pull_request' }} - tags: bustikiller/wedding-planner:latest + tags: | + ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest cache-from: type=registry,ref=user/app:latest cache-to: type=inline \ No newline at end of file From 613344790b3943102345d7ec24cfe688ead4998e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 20 Sep 2024 20:13:39 +0000 Subject: [PATCH 009/283] Update dependency turbo-rails to v2.0.9 --- Gemfile.lock | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6e07a18..8364110 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -107,7 +107,7 @@ GEM i18n (>= 1.8.11, < 2) globalid (1.2.1) activesupport (>= 6.1) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) importmap-rails (2.0.1) actionpack (>= 6.0.0) @@ -133,7 +133,7 @@ GEM jsonapi-serializable (0.3.1) jsonapi-renderer (~> 0.2.0) language_server-protocol (3.17.0.3) - logger (1.6.0) + logger (1.6.1) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -238,7 +238,7 @@ GEM redis-client (0.22.2) connection_pool regexp_parser (2.9.2) - reline (0.5.9) + reline (0.5.10) io-console (~> 0.5) rexml (3.2.8) rspec-core (3.12.3) @@ -288,9 +288,8 @@ GEM thor (1.3.2) tilt (2.4.0) timeout (0.4.1) - turbo-rails (2.0.6) + turbo-rails (2.0.9) actionpack (>= 6.0.0) - activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -305,7 +304,7 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.17) + zeitwerk (2.6.18) PLATFORMS aarch64-linux From ecab72dc6f1e8ed34056021be7a6bfb29017c52a Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 20 Sep 2024 22:21:02 +0000 Subject: [PATCH 010/283] Update dependency jbuilder to v2.13.0 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8364110..0629040 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -117,7 +117,7 @@ GEM irb (1.14.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - jbuilder (2.12.0) + jbuilder (2.13.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) json (2.7.2) From c233b4bb275c1089f486756804b91edd80c38df0 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 20 Sep 2024 22:21:21 +0000 Subject: [PATCH 011/283] Update dependency rubocop to v1.66.1 --- Gemfile.lock | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0629040..9f5bcbc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -171,8 +171,8 @@ GEM racc (~> 1.4) nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) - parallel (1.26.2) - parser (3.3.4.2) + parallel (1.26.3) + parser (3.3.5.0) ast (~> 2.4.1) racc pg (1.5.7) @@ -240,7 +240,6 @@ GEM regexp_parser (2.9.2) reline (0.5.10) io-console (~> 0.5) - rexml (3.2.8) rspec-core (3.12.3) rspec-support (~> 3.12.0) rspec-expectations (3.12.4) @@ -258,18 +257,17 @@ GEM rspec-mocks (~> 3.12) rspec-support (~> 3.12) rspec-support (3.12.2) - rubocop (1.65.1) + rubocop (1.66.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.4, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.0) + rubocop-ast (1.32.3) parser (>= 3.3.1.0) ruby-progressbar (1.13.0) rubytree (2.1.0) @@ -293,7 +291,7 @@ GEM railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) useragent (0.16.10) web-console (4.2.1) actionview (>= 6.0.0) From da05d24e7b6acfb93d0b062e69cea582f9d15d5e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 21 Sep 2024 22:08:43 +0000 Subject: [PATCH 012/283] Update dependency pg to v1.5.8 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9f5bcbc..4007fa6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -175,7 +175,7 @@ GEM parser (3.3.5.0) ast (~> 2.4.1) racc - pg (1.5.7) + pg (1.5.8) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) From c4fea2c928930f63fbf91be43733efaa494d8425 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 6 Oct 2024 22:08:26 +0000 Subject: [PATCH 013/283] Update dependency importmap-rails to v2.0.2 --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4007fa6..63182d9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -109,12 +109,12 @@ GEM activesupport (>= 6.1) i18n (1.14.6) concurrent-ruby (~> 1.0) - importmap-rails (2.0.1) + importmap-rails (2.0.2) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.7.2) - irb (1.14.0) + irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) jbuilder (2.13.0) @@ -298,7 +298,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webrick (1.8.1) + webrick (1.8.2) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) From 1ffb884e164f2b05d227ef8b9408be9567e6ae93 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 7 Oct 2024 22:05:08 +0000 Subject: [PATCH 014/283] Update dependency puma to v6.4.3 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 63182d9..47f7f8e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -181,7 +181,7 @@ GEM method_source (~> 1.0) psych (5.1.2) stringio - puma (6.4.2) + puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) rack (3.1.7) From 2ac0d53d58b791d2f8f592b9411a1858e3241f50 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 15 Oct 2024 22:07:02 +0000 Subject: [PATCH 015/283] Update dependency rails to v7.2.1.1 --- Gemfile.lock | 110 +++++++++++++++++++++++++-------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 47f7f8e..451cd31 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,29 +1,29 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.2.1) - actionpack (= 7.2.1) - activesupport (= 7.2.1) + actioncable (7.2.1.1) + actionpack (= 7.2.1.1) + activesupport (= 7.2.1.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.1) - actionpack (= 7.2.1) - activejob (= 7.2.1) - activerecord (= 7.2.1) - activestorage (= 7.2.1) - activesupport (= 7.2.1) + actionmailbox (7.2.1.1) + actionpack (= 7.2.1.1) + activejob (= 7.2.1.1) + activerecord (= 7.2.1.1) + activestorage (= 7.2.1.1) + activesupport (= 7.2.1.1) mail (>= 2.8.0) - actionmailer (7.2.1) - actionpack (= 7.2.1) - actionview (= 7.2.1) - activejob (= 7.2.1) - activesupport (= 7.2.1) + actionmailer (7.2.1.1) + actionpack (= 7.2.1.1) + actionview (= 7.2.1.1) + activejob (= 7.2.1.1) + activesupport (= 7.2.1.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.1) - actionview (= 7.2.1) - activesupport (= 7.2.1) + actionpack (7.2.1.1) + actionview (= 7.2.1.1) + activesupport (= 7.2.1.1) nokogiri (>= 1.8.5) racc rack (>= 2.2.4, < 3.2) @@ -32,35 +32,35 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.1) - actionpack (= 7.2.1) - activerecord (= 7.2.1) - activestorage (= 7.2.1) - activesupport (= 7.2.1) + actiontext (7.2.1.1) + actionpack (= 7.2.1.1) + activerecord (= 7.2.1.1) + activestorage (= 7.2.1.1) + activesupport (= 7.2.1.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.1) - activesupport (= 7.2.1) + actionview (7.2.1.1) + activesupport (= 7.2.1.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.1) - activesupport (= 7.2.1) + activejob (7.2.1.1) + activesupport (= 7.2.1.1) globalid (>= 0.3.6) - activemodel (7.2.1) - activesupport (= 7.2.1) - activerecord (7.2.1) - activemodel (= 7.2.1) - activesupport (= 7.2.1) + activemodel (7.2.1.1) + activesupport (= 7.2.1.1) + activerecord (7.2.1.1) + activemodel (= 7.2.1.1) + activesupport (= 7.2.1.1) timeout (>= 0.4.0) - activestorage (7.2.1) - actionpack (= 7.2.1) - activejob (= 7.2.1) - activerecord (= 7.2.1) - activesupport (= 7.2.1) + activestorage (7.2.1.1) + actionpack (= 7.2.1.1) + activejob (= 7.2.1.1) + activerecord (= 7.2.1.1) + activesupport (= 7.2.1.1) marcel (~> 1.0) - activesupport (7.2.1) + activesupport (7.2.1.1) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) @@ -149,7 +149,7 @@ GEM money (6.19.0) i18n (>= 0.6.4, <= 2) msgpack (1.7.2) - net-imap (0.4.15) + net-imap (0.4.17) date net-protocol net-pop (0.1.2) @@ -184,7 +184,7 @@ GEM puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.7) + rack (3.1.8) rack-cors (2.0.2) rack (>= 2.0.0) rack-session (2.0.0) @@ -194,20 +194,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.2.1) - actioncable (= 7.2.1) - actionmailbox (= 7.2.1) - actionmailer (= 7.2.1) - actionpack (= 7.2.1) - actiontext (= 7.2.1) - actionview (= 7.2.1) - activejob (= 7.2.1) - activemodel (= 7.2.1) - activerecord (= 7.2.1) - activestorage (= 7.2.1) - activesupport (= 7.2.1) + rails (7.2.1.1) + actioncable (= 7.2.1.1) + actionmailbox (= 7.2.1.1) + actionmailer (= 7.2.1.1) + actionpack (= 7.2.1.1) + actiontext (= 7.2.1.1) + actionview (= 7.2.1.1) + activejob (= 7.2.1.1) + activemodel (= 7.2.1.1) + activerecord (= 7.2.1.1) + activestorage (= 7.2.1.1) + activesupport (= 7.2.1.1) bundler (>= 1.15.0) - railties (= 7.2.1) + railties (= 7.2.1.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -215,9 +215,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.2.1) - actionpack (= 7.2.1) - activesupport (= 7.2.1) + railties (7.2.1.1) + actionpack (= 7.2.1.1) + activesupport (= 7.2.1.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) From 26dc4d1d160257ef8616d7eb46c24f23b8e374c7 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 15 Oct 2024 22:07:32 +0000 Subject: [PATCH 016/283] Update dependency rubocop to v1.67.0 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 451cd31..890f9e0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -257,7 +257,7 @@ GEM rspec-mocks (~> 3.12) rspec-support (~> 3.12) rspec-support (3.12.2) - rubocop (1.66.1) + rubocop (1.67.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) From c017e12ccef0b05708404f1568ca087e780b974d Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 16 Oct 2024 22:04:49 +0000 Subject: [PATCH 017/283] Update dependency importmap-rails to v2.0.3 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 890f9e0..d263582 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -109,7 +109,7 @@ GEM activesupport (>= 6.1) i18n (1.14.6) concurrent-ruby (~> 1.0) - importmap-rails (2.0.2) + importmap-rails (2.0.3) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) From b076f8423b0e967afca20be9dd04dd3e49bcfa95 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 18 Oct 2024 22:08:39 +0000 Subject: [PATCH 018/283] Update dependency turbo-rails to v2.0.11 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index d263582..452df09 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -286,7 +286,7 @@ GEM thor (1.3.2) tilt (2.4.0) timeout (0.4.1) - turbo-rails (2.0.9) + turbo-rails (2.0.11) actionpack (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) From 1c25cc536368d2d26969d72f38ea8019aaa6eb92 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 19 Oct 2024 22:10:25 +0000 Subject: [PATCH 019/283] Update dependency faker to v3.5.1 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 452df09..d01ecec 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -103,7 +103,7 @@ GEM factory_bot_rails (6.4.3) factory_bot (~> 6.4) railties (>= 5.0.0) - faker (3.4.2) + faker (3.5.1) i18n (>= 1.8.11, < 2) globalid (1.2.1) activesupport (>= 6.1) From 94a232ebb474503fef16fcd14da032f1c29726a3 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 20 Oct 2024 22:10:18 +0000 Subject: [PATCH 020/283] Update dependency rspec-rails to v7 --- Gemfile | 2 +- Gemfile.lock | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Gemfile b/Gemfile index 33dcc4d..f28dd68 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ group :development, :test do gem 'factory_bot_rails' gem 'faker' gem 'pry' - gem 'rspec-rails', '~> 6.1.0' + gem 'rspec-rails', '~> 7.0.0' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index d01ecec..0b88232 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -240,23 +240,23 @@ GEM regexp_parser (2.9.2) reline (0.5.10) io-console (~> 0.5) - rspec-core (3.12.3) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.4) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.7) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-rails (6.1.1) - actionpack (>= 6.1) - activesupport (>= 6.1) - railties (>= 6.1) - rspec-core (~> 3.12) - rspec-expectations (~> 3.12) - rspec-mocks (~> 3.12) - rspec-support (~> 3.12) - rspec-support (3.12.2) + rspec-support (~> 3.13.0) + rspec-rails (7.0.1) + actionpack (>= 7.0) + activesupport (>= 7.0) + railties (>= 7.0) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.1) rubocop (1.67.0) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -302,7 +302,7 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.18) + zeitwerk (2.7.1) PLATFORMS aarch64-linux @@ -330,7 +330,7 @@ DEPENDENCIES rails (~> 7.2.0, >= 7.2.1) react-rails redis (>= 4.0.1) - rspec-rails (~> 6.1.0) + rspec-rails (~> 7.0.0) rubocop rubytree sprockets-rails From 36d79b26f5e07bb76b287f3129e8035ef6ca8a71 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 24 Oct 2024 22:07:40 +0000 Subject: [PATCH 021/283] Update dependency rails to v7.2.1.2 --- Gemfile.lock | 106 +++++++++++++++++++++++++-------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0b88232..781605d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,29 +1,29 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.2.1.1) - actionpack (= 7.2.1.1) - activesupport (= 7.2.1.1) + actioncable (7.2.1.2) + actionpack (= 7.2.1.2) + activesupport (= 7.2.1.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.1.1) - actionpack (= 7.2.1.1) - activejob (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) + actionmailbox (7.2.1.2) + actionpack (= 7.2.1.2) + activejob (= 7.2.1.2) + activerecord (= 7.2.1.2) + activestorage (= 7.2.1.2) + activesupport (= 7.2.1.2) mail (>= 2.8.0) - actionmailer (7.2.1.1) - actionpack (= 7.2.1.1) - actionview (= 7.2.1.1) - activejob (= 7.2.1.1) - activesupport (= 7.2.1.1) + actionmailer (7.2.1.2) + actionpack (= 7.2.1.2) + actionview (= 7.2.1.2) + activejob (= 7.2.1.2) + activesupport (= 7.2.1.2) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.1.1) - actionview (= 7.2.1.1) - activesupport (= 7.2.1.1) + actionpack (7.2.1.2) + actionview (= 7.2.1.2) + activesupport (= 7.2.1.2) nokogiri (>= 1.8.5) racc rack (>= 2.2.4, < 3.2) @@ -32,35 +32,35 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.1.1) - actionpack (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) + actiontext (7.2.1.2) + actionpack (= 7.2.1.2) + activerecord (= 7.2.1.2) + activestorage (= 7.2.1.2) + activesupport (= 7.2.1.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.1.1) - activesupport (= 7.2.1.1) + actionview (7.2.1.2) + activesupport (= 7.2.1.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.1.1) - activesupport (= 7.2.1.1) + activejob (7.2.1.2) + activesupport (= 7.2.1.2) globalid (>= 0.3.6) - activemodel (7.2.1.1) - activesupport (= 7.2.1.1) - activerecord (7.2.1.1) - activemodel (= 7.2.1.1) - activesupport (= 7.2.1.1) + activemodel (7.2.1.2) + activesupport (= 7.2.1.2) + activerecord (7.2.1.2) + activemodel (= 7.2.1.2) + activesupport (= 7.2.1.2) timeout (>= 0.4.0) - activestorage (7.2.1.1) - actionpack (= 7.2.1.1) - activejob (= 7.2.1.1) - activerecord (= 7.2.1.1) - activesupport (= 7.2.1.1) + activestorage (7.2.1.2) + actionpack (= 7.2.1.2) + activejob (= 7.2.1.2) + activerecord (= 7.2.1.2) + activesupport (= 7.2.1.2) marcel (~> 1.0) - activesupport (7.2.1.1) + activesupport (7.2.1.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) @@ -194,20 +194,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.2.1.1) - actioncable (= 7.2.1.1) - actionmailbox (= 7.2.1.1) - actionmailer (= 7.2.1.1) - actionpack (= 7.2.1.1) - actiontext (= 7.2.1.1) - actionview (= 7.2.1.1) - activejob (= 7.2.1.1) - activemodel (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) + rails (7.2.1.2) + actioncable (= 7.2.1.2) + actionmailbox (= 7.2.1.2) + actionmailer (= 7.2.1.2) + actionpack (= 7.2.1.2) + actiontext (= 7.2.1.2) + actionview (= 7.2.1.2) + activejob (= 7.2.1.2) + activemodel (= 7.2.1.2) + activerecord (= 7.2.1.2) + activestorage (= 7.2.1.2) + activesupport (= 7.2.1.2) bundler (>= 1.15.0) - railties (= 7.2.1.1) + railties (= 7.2.1.2) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -215,9 +215,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.2.1.1) - actionpack (= 7.2.1.1) - activesupport (= 7.2.1.1) + railties (7.2.1.2) + actionpack (= 7.2.1.2) + activesupport (= 7.2.1.2) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) From 50cc31a3cd973c93b5116ae2c52107547c486015 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 25 Oct 2024 22:12:26 +0000 Subject: [PATCH 022/283] Update dependency pg to v1.5.9 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 781605d..ae994c8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -175,7 +175,7 @@ GEM parser (3.3.5.0) ast (~> 2.4.1) racc - pg (1.5.8) + pg (1.5.9) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) From 507d06845949d8e3ce691598443a0b376bd981a2 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 14:03:13 +0100 Subject: [PATCH 023/283] Configure endpoint to support bulk updates --- app/controllers/application_controller.rb | 11 +++++++++++ app/controllers/guests_controller.rb | 4 ++++ config/environments/development.rb | 2 ++ config/routes.rb | 1 + 4 files changed, 18 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 09705d1..7d14012 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,2 +1,13 @@ class ApplicationController < ActionController::Base + after_action :set_csrf_cookie + + private + + def set_csrf_cookie + cookies["csrf-token"] = { + value: form_authenticity_token, + secure: Rails.env.production?, + same_site: :strict, + } + end end diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 925770f..53ef565 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -75,6 +75,10 @@ class GuestsController < ApplicationController redirect_to guests_url end + def bulk_update + render json: {}, status: :ok + end + private # Use callbacks to share common setup or constraints between actions. diff --git a/config/environments/development.rb b/config/environments/development.rb index 794f390..f39246f 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -73,4 +73,6 @@ Rails.application.configure do # Raise error when a before_action's only/except options reference missing actions config.action_controller.raise_on_missing_callback_actions = true + + config.hosts << "libre-wedding-planner.app.localhost" end diff --git a/config/routes.rb b/config/routes.rb index 6e4d17b..d1697bc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,6 +2,7 @@ Rails.application.routes.draw do resources :groups, only: :index resources :guests do post :import, on: :collection + post :bulk_update, on: :collection end resources :expenses resources :tables_arrangements, only: [:index, :show] From a0de5eb6631e81e0d0fa08e59471e103e39f81ca Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 17:10:11 +0000 Subject: [PATCH 024/283] Define nginx configuration file (#70) Reviewed-on: https://gitea.bustikiller.com/bustikiller/wedding-planner/pulls/70 Co-authored-by: Manuel Bustillo Co-committed-by: Manuel Bustillo --- nginx.conf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 nginx.conf diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..9fb17cc --- /dev/null +++ b/nginx.conf @@ -0,0 +1,15 @@ +server { + listen 80; + server_name libre-wedding-planner.app.localhost; + + location /api/ { + proxy_pass http://localhost:3001/; + proxy_set_header Host $http_host; + } + + location / { + proxy_pass http://localhost:3000; + proxy_set_header Host $http_host; + } +} + From 9dc6dd398321945dddfa49cca9abb9faa3d717e7 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 17:36:40 +0000 Subject: [PATCH 025/283] Update dependency ruby to v3.3.5 (#56) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Update | Change | |---|---|---| | [ruby](https://www.ruby-lang.org) ([source](https://github.com/ruby/ruby)) | patch | `3.3.4` -> `3.3.5` | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Co-authored-by: Renovate Bot Reviewed-on: https://gitea.bustikiller.com/bustikiller/wedding-planner/pulls/56 Co-authored-by: Manuel Bustillo Co-committed-by: Manuel Bustillo --- .ruby-version | 2 +- Dockerfile | 2 +- Gemfile | 2 +- Gemfile.lock | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.ruby-version b/.ruby-version index 6d5369b..f13c6f4 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.3.4 +ruby-3.3.5 diff --git a/Dockerfile b/Dockerfile index 80ee039..b155a9d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax = docker/dockerfile:1 # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.3.4 +ARG RUBY_VERSION=3.3.5 FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base # Rails app lives here diff --git a/Gemfile b/Gemfile index f28dd68..cb3135b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -ruby '3.3.4' +ruby '3.3.5' gem 'acts-as-taggable-on' gem 'bootsnap', require: false gem 'csv' diff --git a/Gemfile.lock b/Gemfile.lock index ae994c8..831d9a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -340,7 +340,7 @@ DEPENDENCIES web-console RUBY VERSION - ruby 3.3.4p94 + ruby 3.3.5p100 BUNDLED WITH 2.5.17 From b8dfcf326f237dfbad77886b694f0fd6f3ed0087 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 19:01:12 +0100 Subject: [PATCH 026/283] Implement the actual status update --- app/controllers/guests_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 53ef565..76bfda4 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -76,6 +76,7 @@ class GuestsController < ApplicationController end def bulk_update + Guest.where(id: params[:guest_ids]).update!(params.require(:properties).permit(:status)) render json: {}, status: :ok end From 6219b74cb7ea993dc3e704206df749cb92b653c6 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 19:13:32 +0100 Subject: [PATCH 027/283] Order guests consistently within the same group --- app/controllers/guests_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 925770f..aa23e4b 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -7,7 +7,7 @@ class GuestsController < ApplicationController def index @guests = Guest.all .joins(:group) - .order('groups.name' => :asc) + .order('groups.name' => :asc, first_name: :asc, last_name: :asc) render jsonapi: @guests end From 7338bbf0a8ab873adbb443fdc0cc9123221a148b Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 19:25:24 +0100 Subject: [PATCH 028/283] Include an additional tentative status --- app/models/guest.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/guest.rb b/app/models/guest.rb index cc4f615..4e8bcce 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -6,7 +6,8 @@ class Guest < ApplicationRecord considered: 0, invited: 10, confirmed: 20, - declined: 30 + declined: 30, + tentative: 40, } def full_name From f3172bb38f522532a6a9d1ba5e9d2b2e9ecd60d0 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 22:30:04 +0100 Subject: [PATCH 029/283] Configure license and automated copyright notices --- .github/workflows/copyright_notice.yml | 36 ++ COPYING.md | 660 +++++++++++++++++++++++++ 2 files changed, 696 insertions(+) create mode 100644 .github/workflows/copyright_notice.yml create mode 100644 COPYING.md diff --git a/.github/workflows/copyright_notice.yml b/.github/workflows/copyright_notice.yml new file mode 100644 index 0000000..b6c398e --- /dev/null +++ b/.github/workflows/copyright_notice.yml @@ -0,0 +1,36 @@ +name: Add copyright notice +on: + pull_request: +permissions: + contents: write +jobs: + copyright_notice: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.ACTIONS_TOKEN }} + ref: ${{ github.head_ref }} + - uses: VinnyBabuManjaly/copyright-action@v1.0.0 + with: + CopyrightString: '# Copyright (C) 2024 Manuel Bustillo\n\n' + FileType: '.rb' + Path: 'app/, config/, db/' + - uses: VinnyBabuManjaly/copyright-action@v1.0.0 + with: + CopyrightString: '<%# Copyright (C) 2024 Manuel Bustillo %>\n\n' + FileType: '.erb' + Path: 'app/' + - name: Commit changes + run: | + git config --local user.email "bustikiller@bustikiller.com" + git config --local user.name "Manuel Bustillo" + git add . + + if [ -n "$(git status --porcelain)" ]; then + echo "there are changes"; + git commit -m "Add copyright notice" + git push + else + echo "no changes"; + fi diff --git a/COPYING.md b/COPYING.md new file mode 100644 index 0000000..c6f01c6 --- /dev/null +++ b/COPYING.md @@ -0,0 +1,660 @@ +# GNU AFFERO GENERAL PUBLIC LICENSE + +Version 3, 19 November 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +## Preamble + +The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains +free software for all its users. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + +A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + +The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + +An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing +under this license. + +The precise terms and conditions for copying, distribution and +modification follow. + +## TERMS AND CONDITIONS + +### 0. Definitions. + +"This License" refers to version 3 of the GNU Affero General Public +License. + +"Copyright" also means copyright-like laws that apply to other kinds +of works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of +an exact copy. The resulting work is called a "modified version" of +the earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user +through a computer network, with no transfer of a copy, is not +conveying. + +An interactive user interface displays "Appropriate Legal Notices" to +the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +### 1. Source Code. + +The "source code" for a work means the preferred form of the work for +making modifications to it. "Object code" means any non-source form of +a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can +regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same +work. + +### 2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, +without conditions so long as your license otherwise remains in force. +You may convey covered works to others for the sole purpose of having +them make modifications exclusively for you, or provide you with +facilities for running those works, provided that you comply with the +terms of this License in conveying all material for which you do not +control copyright. Those thus making or running the covered works for +you must do so exclusively on your behalf, under your direction and +control, on terms that prohibit them from making any copies of your +copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the +conditions stated below. Sublicensing is not allowed; section 10 makes +it unnecessary. + +### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such +circumvention is effected by exercising rights under this License with +respect to the covered work, and you disclaim any intention to limit +operation or modification of the work as a means of enforcing, against +the work's users, your or third parties' legal rights to forbid +circumvention of technological measures. + +### 4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +### 5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these +conditions: + +- a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. +- b) The work must carry prominent notices stating that it is + released under this License and any conditions added under + section 7. This requirement modifies the requirement in section 4 + to "keep intact all notices". +- c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. +- d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +### 6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of +sections 4 and 5, provided that you also convey the machine-readable +Corresponding Source under the terms of this License, in one of these +ways: + +- a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. +- b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the Corresponding + Source from a network server at no charge. +- c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. +- d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. +- e) Convey the object code using peer-to-peer transmission, + provided you inform other peers where the object code and + Corresponding Source of the work are being offered to the general + public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, +family, or household purposes, or (2) anything designed or sold for +incorporation into a dwelling. In determining whether a product is a +consumer product, doubtful cases shall be resolved in favor of +coverage. For a particular product received by a particular user, +"normally used" refers to a typical or common use of that class of +product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected +to use, the product. A product is a consumer product regardless of +whether the product has substantial commercial, industrial or +non-consumer uses, unless such uses represent the only significant +mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to +install and execute modified versions of a covered work in that User +Product from a modified version of its Corresponding Source. The +information must suffice to ensure that the continued functioning of +the modified object code is in no case prevented or interfered with +solely because modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or +updates for a work that has been modified or installed by the +recipient, or for the User Product in which it has been modified or +installed. Access to a network may be denied when the modification +itself materially and adversely affects the operation of the network +or violates the rules and protocols for communication across the +network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +### 7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders +of that material) supplement the terms of this License with terms: + +- a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or +- b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or +- c) Prohibiting misrepresentation of the origin of that material, + or requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or +- d) Limiting the use for publicity purposes of names of licensors + or authors of the material; or +- e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or +- f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions + of it) with contractual assumptions of liability to the recipient, + for any liability that these contractual assumptions directly + impose on those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; the +above requirements apply either way. + +### 8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +### 9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run +a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +### 10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +### 11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims owned +or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within the +scope of its coverage, prohibits the exercise of, or is conditioned on +the non-exercise of one or more of the rights that are specifically +granted under this License. You may not convey a covered work if you +are a party to an arrangement with a third party that is in the +business of distributing software, under which you make payment to the +third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties +who would receive the covered work from you, a discriminatory patent +license (a) in connection with copies of the covered work conveyed by +you (or copies made from those copies), or (b) primarily for and in +connection with specific products or compilations that contain the +covered work, unless you entered into that arrangement, or that patent +license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +### 12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under +this License and any other pertinent obligations, then as a +consequence you may not convey it at all. For example, if you agree to +terms that obligate you to collect a royalty for further conveying +from those to whom you convey the Program, the only way you could +satisfy both those terms and this License would be to refrain entirely +from conveying the Program. + +### 13. Remote Network Interaction; Use with the GNU General Public License. + +Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your +version supports such interaction) an opportunity to receive the +Corresponding Source of your version by providing access to the +Corresponding Source from a network server at no charge, through some +standard or customary means of facilitating copying of software. This +Corresponding Source shall include the Corresponding Source for any +work covered by version 3 of the GNU General Public License that is +incorporated pursuant to the following paragraph. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + +### 14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU Affero General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever +published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions +of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +### 15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT +WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR +CORRECTION. + +### 16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR +CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT +NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR +LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM +TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER +PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +### 17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +## How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively state +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper +mail. + +If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for +the specific requirements. + +You should also get your employer (if you work as a programmer) or +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. For more information on this, and how to apply and follow +the GNU AGPL, see . From b7cabc16615392c8dd87e5145d6464e74ce7ac47 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 21:42:45 +0000 Subject: [PATCH 030/283] Add copyright notice --- app/channels/application_cable/channel.rb | 2 ++ app/channels/application_cable/connection.rb | 2 ++ app/controllers/application_controller.rb | 2 ++ app/controllers/expenses_controller.rb | 2 ++ app/controllers/groups_controller.rb | 2 ++ app/controllers/guests_controller.rb | 2 ++ app/controllers/tables_arrangements_controller.rb | 2 ++ app/extensions/tree_node_extension.rb | 2 ++ app/helpers/application_helper.rb | 2 ++ app/helpers/expenses_helper.rb | 2 ++ app/helpers/groups_helper.rb | 2 ++ app/helpers/guests_helper.rb | 2 ++ app/helpers/tables_arrangements_helper.rb | 2 ++ app/jobs/application_job.rb | 2 ++ app/mailers/application_mailer.rb | 2 ++ app/models/application_record.rb | 2 ++ app/models/expense.rb | 2 ++ app/models/group.rb | 2 ++ app/models/guest.rb | 2 ++ app/models/seat.rb | 2 ++ app/models/tables_arrangement.rb | 2 ++ app/serializers/serializable_group.rb | 2 ++ app/serializers/serializable_guest.rb | 2 ++ app/services/affinity_groups_hierarchy.rb | 2 ++ app/services/tables/discomfort_calculator.rb | 2 ++ app/services/tables/distribution.rb | 2 ++ app/services/tables/swap.rb | 2 ++ app/services/tables/table.rb | 2 ++ app/services/vns/engine.rb | 2 ++ app/views/expenses/_expense.html.erb | 2 ++ app/views/expenses/_form.html.erb | 2 ++ app/views/expenses/edit.html.erb | 2 ++ app/views/expenses/index.html.erb | 2 ++ app/views/expenses/new.html.erb | 2 ++ app/views/expenses/show.html.erb | 2 ++ app/views/guests/_form.html.erb | 2 ++ app/views/guests/_guest.html.erb | 2 ++ app/views/guests/edit.html.erb | 2 ++ app/views/guests/index.html.erb | 2 ++ app/views/guests/new.html.erb | 2 ++ app/views/guests/show.html.erb | 2 ++ app/views/layouts/application.html.erb | 2 ++ app/views/layouts/mailer.html.erb | 2 ++ app/views/layouts/mailer.text.erb | 2 ++ app/views/tables_arrangements/index.html.erb | 2 ++ app/views/tables_arrangements/show.html.erb | 2 ++ config/application.rb | 2 ++ config/boot.rb | 2 ++ config/environment.rb | 2 ++ config/environments/development.rb | 2 ++ config/environments/production.rb | 2 ++ config/environments/test.rb | 2 ++ config/importmap.rb | 2 ++ config/initializers/affinity_groups.rb | 2 ++ config/initializers/assets.rb | 2 ++ config/initializers/content_security_policy.rb | 2 ++ config/initializers/cors.rb | 2 ++ config/initializers/filter_parameter_logging.rb | 2 ++ config/initializers/inflections.rb | 2 ++ config/initializers/permissions_policy.rb | 2 ++ config/initializers/ruby_extensions.rb | 2 ++ config/puma.rb | 2 ++ config/routes.rb | 2 ++ db/migrate/20240711175425_create_expenses.rb | 2 ++ db/migrate/20240711180753_create_guests.rb | 2 ++ ..._acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb | 2 ++ ...627_add_missing_unique_indices.acts_as_taggable_on_engine.rb | 2 ++ ...taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb | 2 ++ ...629_add_missing_taggable_index.acts_as_taggable_on_engine.rb | 2 ++ ...change_collation_for_tag_names.acts_as_taggable_on_engine.rb | 2 ++ ...dd_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb | 2 ++ ...1181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb | 2 ++ db/migrate/20240724181756_create_tables_arrangements.rb | 2 ++ db/migrate/20240724181853_create_seats.rb | 2 ++ db/migrate/20240811142121_create_groups.rb | 2 ++ db/migrate/20240811143801_add_parent_to_group.rb | 2 ++ db/migrate/20240811154115_add_group_to_guest.rb | 2 ++ db/migrate/20240811170021_add_status_to_guest.rb | 2 ++ db/schema.rb | 2 ++ db/seeds.rb | 2 ++ 80 files changed, 160 insertions(+) diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index d672697..3073f1e 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module ApplicationCable class Channel < ActionCable::Channel::Base end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 0ff5442..1cc97c6 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module ApplicationCable class Connection < ActionCable::Connection::Base end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7d14012..eda95cc 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class ApplicationController < ActionController::Base after_action :set_csrf_cookie diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 2692f74..774b87f 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class ExpensesController < ApplicationController before_action :set_expense, only: %i[ show edit update destroy ] diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 0f489fb..232ac85 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class GroupsController < ApplicationController def index roots = Group.where(parent_id: nil) diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 6272dd9..5a1dbb2 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'csv' class GuestsController < ApplicationController diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index 7d3c371..8523f5a 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class TablesArrangementsController < ApplicationController def index @tables_arrangements = TablesArrangement.all.order(discomfort: :asc).limit(10) diff --git a/app/extensions/tree_node_extension.rb b/app/extensions/tree_node_extension.rb index fe4f720..630b011 100644 --- a/app/extensions/tree_node_extension.rb +++ b/app/extensions/tree_node_extension.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module TreeNodeExtension def distance_to_common_ancestor(another_node) return 0 if self == another_node diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..5e869ad 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,4 @@ +# Copyright (C) 2024 Manuel Bustillo + module ApplicationHelper end diff --git a/app/helpers/expenses_helper.rb b/app/helpers/expenses_helper.rb index 1d50062..af8a78e 100644 --- a/app/helpers/expenses_helper.rb +++ b/app/helpers/expenses_helper.rb @@ -1,2 +1,4 @@ +# Copyright (C) 2024 Manuel Bustillo + module ExpensesHelper end diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index c091b2f..311c1a2 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -1,2 +1,4 @@ +# Copyright (C) 2024 Manuel Bustillo + module GroupsHelper end diff --git a/app/helpers/guests_helper.rb b/app/helpers/guests_helper.rb index 00317bf..ca740f6 100644 --- a/app/helpers/guests_helper.rb +++ b/app/helpers/guests_helper.rb @@ -1,2 +1,4 @@ +# Copyright (C) 2024 Manuel Bustillo + module GuestsHelper end diff --git a/app/helpers/tables_arrangements_helper.rb b/app/helpers/tables_arrangements_helper.rb index c066a2e..637e079 100644 --- a/app/helpers/tables_arrangements_helper.rb +++ b/app/helpers/tables_arrangements_helper.rb @@ -1,2 +1,4 @@ +# Copyright (C) 2024 Manuel Bustillo + module TablesArrangementsHelper end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index d394c3d..3498a49 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 3c34c81..94e1656 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class ApplicationMailer < ActionMailer::Base default from: "from@example.com" layout "mailer" diff --git a/app/models/application_record.rb b/app/models/application_record.rb index b63caeb..e93781d 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class ApplicationRecord < ActiveRecord::Base primary_abstract_class end diff --git a/app/models/expense.rb b/app/models/expense.rb index 15a9560..34e2e33 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -1,2 +1,4 @@ +# Copyright (C) 2024 Manuel Bustillo + class Expense < ApplicationRecord end diff --git a/app/models/group.rb b/app/models/group.rb index afcadaa..4e12aed 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class Group < ApplicationRecord validates :name, uniqueness: true validates :name, :order, presence: true diff --git a/app/models/guest.rb b/app/models/guest.rb index 4e8bcce..412f01c 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class Guest < ApplicationRecord acts_as_taggable_on :affinity_groups, :unbreakable_bonds belongs_to :group diff --git a/app/models/seat.rb b/app/models/seat.rb index e909587..8395b9c 100644 --- a/app/models/seat.rb +++ b/app/models/seat.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class Seat < ApplicationRecord belongs_to :guest belongs_to :table_arrangement diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index 1be3ec3..c3c0797 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class TablesArrangement < ApplicationRecord has_many :seats end diff --git a/app/serializers/serializable_group.rb b/app/serializers/serializable_group.rb index f832475..f7cc103 100644 --- a/app/serializers/serializable_group.rb +++ b/app/serializers/serializable_group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class SerializableGroup < JSONAPI::Serializable::Resource type 'group' diff --git a/app/serializers/serializable_guest.rb b/app/serializers/serializable_guest.rb index 647c106..b8d9347 100644 --- a/app/serializers/serializable_guest.rb +++ b/app/serializers/serializable_guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class SerializableGuest < JSONAPI::Serializable::Resource type 'guest' diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index af6c62a..7c87ed9 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class AffinityGroupsHierarchy < Array include Singleton diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index 69214bb..d6907e8 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module Tables class DiscomfortCalculator private attr_reader :table diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 33cb130..b361c70 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require_relative '../../extensions/tree_node_extension' module Tables diff --git a/app/services/tables/swap.rb b/app/services/tables/swap.rb index 631b49b..9668efb 100644 --- a/app/services/tables/swap.rb +++ b/app/services/tables/swap.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module Tables class Swap private attr_reader :initial_solution diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index 1dde7f6..92b0f08 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module Tables class Table < Array attr_accessor :discomfort diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index 5c260aa..00f2c80 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module VNS class Engine def target_function(&function) diff --git a/app/views/expenses/_expense.html.erb b/app/views/expenses/_expense.html.erb index 6581cb7..5bac9f6 100644 --- a/app/views/expenses/_expense.html.erb +++ b/app/views/expenses/_expense.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

Name: diff --git a/app/views/expenses/_form.html.erb b/app/views/expenses/_form.html.erb index 543a3ef..8d9cd9c 100644 --- a/app/views/expenses/_form.html.erb +++ b/app/views/expenses/_form.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + <%= form_with(model: expense) do |form| %> <% if expense.errors.any? %>

diff --git a/app/views/expenses/edit.html.erb b/app/views/expenses/edit.html.erb index 75bab6f..032aba0 100644 --- a/app/views/expenses/edit.html.erb +++ b/app/views/expenses/edit.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

Editing expense

<%= render "form", expense: @expense %> diff --git a/app/views/expenses/index.html.erb b/app/views/expenses/index.html.erb index e63f662..6e4fd28 100644 --- a/app/views/expenses/index.html.erb +++ b/app/views/expenses/index.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

<%= notice %>

Expenses

diff --git a/app/views/expenses/new.html.erb b/app/views/expenses/new.html.erb index 17d6299..a7b9844 100644 --- a/app/views/expenses/new.html.erb +++ b/app/views/expenses/new.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

New expense

<%= render "form", expense: @expense %> diff --git a/app/views/expenses/show.html.erb b/app/views/expenses/show.html.erb index 2262a0e..b2bec00 100644 --- a/app/views/expenses/show.html.erb +++ b/app/views/expenses/show.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

<%= notice %>

<%= render @expense %> diff --git a/app/views/guests/_form.html.erb b/app/views/guests/_form.html.erb index eaea454..e2daaf5 100644 --- a/app/views/guests/_form.html.erb +++ b/app/views/guests/_form.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + <%= form_with(model: guest) do |form| %> <% if guest.errors.any? %>
diff --git a/app/views/guests/_guest.html.erb b/app/views/guests/_guest.html.erb index dfd51e9..ed160f9 100644 --- a/app/views/guests/_guest.html.erb +++ b/app/views/guests/_guest.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

First name: diff --git a/app/views/guests/edit.html.erb b/app/views/guests/edit.html.erb index a024444..d59a8e7 100644 --- a/app/views/guests/edit.html.erb +++ b/app/views/guests/edit.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

Editing guest

<%= render "form", guest: @guest %> diff --git a/app/views/guests/index.html.erb b/app/views/guests/index.html.erb index d71cfa8..3ef84c4 100644 --- a/app/views/guests/index.html.erb +++ b/app/views/guests/index.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

<%= notice %>

Guests

diff --git a/app/views/guests/new.html.erb b/app/views/guests/new.html.erb index d05ae72..8405d09 100644 --- a/app/views/guests/new.html.erb +++ b/app/views/guests/new.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

New guest

<%= render "form", guest: @guest %> diff --git a/app/views/guests/show.html.erb b/app/views/guests/show.html.erb index bcfad6e..6976007 100644 --- a/app/views/guests/show.html.erb +++ b/app/views/guests/show.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

<%= notice %>

<%= render @guest %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index d68b671..4c8aeb2 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 3aac900..ca6bd25 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb index 37f0bdd..0b40d6b 100644 --- a/app/views/layouts/mailer.text.erb +++ b/app/views/layouts/mailer.text.erb @@ -1 +1,3 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + <%= yield %> diff --git a/app/views/tables_arrangements/index.html.erb b/app/views/tables_arrangements/index.html.erb index 260e144..b24f7da 100644 --- a/app/views/tables_arrangements/index.html.erb +++ b/app/views/tables_arrangements/index.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

Tables arrangements

    diff --git a/app/views/tables_arrangements/show.html.erb b/app/views/tables_arrangements/show.html.erb index a2b9aae..cc90581 100644 --- a/app/views/tables_arrangements/show.html.erb +++ b/app/views/tables_arrangements/show.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

    ID: <%= @tables_arrangement.id %>

    Discomfort: <%= @tables_arrangement.discomfort %>

    diff --git a/config/application.rb b/config/application.rb index e21736e..2c1fa72 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require_relative 'boot' require 'rails' diff --git a/config/boot.rb b/config/boot.rb index 988a5dd..b7afb85 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/config/environment.rb b/config/environment.rb index cac5315..6cec499 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Load the Rails application. require_relative "application" diff --git a/config/environments/development.rb b/config/environments/development.rb index f39246f..49b67a2 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require "active_support/core_ext/integer/time" Rails.application.configure do diff --git a/config/environments/production.rb b/config/environments/production.rb index c39bd29..eb6e7fa 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require "active_support/core_ext/integer/time" Rails.application.configure do diff --git a/config/environments/test.rb b/config/environments/test.rb index 3ada93b..ef2b3a4 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's diff --git a/config/importmap.rb b/config/importmap.rb index 909dfc5..f84aa44 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Pin npm packages by running ./bin/importmap pin "application" diff --git a/config/initializers/affinity_groups.rb b/config/initializers/affinity_groups.rb index f52c1d4..1415e8d 100644 --- a/config/initializers/affinity_groups.rb +++ b/config/initializers/affinity_groups.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require_relative '../../app/services/affinity_groups_hierarchy' hierarchy = AffinityGroupsHierarchy.instance diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 2eeef96..f67fe73 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index b3076b3..9004631 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Be sure to restart your server when you modify this file. # Define an application-wide content security policy. diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index a908920..f4b450f 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # config/initializers/cors.rb Rails.application.config.middleware.insert_before 0, Rack::Cors do diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index c2d89e2..b5bfef2 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Be sure to restart your server when you modify this file. # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 157a851..6633bb9 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index 7db3b95..57547a3 100644 --- a/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Be sure to restart your server when you modify this file. # Define an application-wide HTTP permissions policy. For further diff --git a/config/initializers/ruby_extensions.rb b/config/initializers/ruby_extensions.rb index f25093d..e515905 100644 --- a/config/initializers/ruby_extensions.rb +++ b/config/initializers/ruby_extensions.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class Numeric def to_currency Money.from_amount(self, "EUR").format diff --git a/config/puma.rb b/config/puma.rb index afa809b..0e947b4 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This configuration file will be evaluated by Puma. The top-level methods that # are invoked here are part of Puma's configuration DSL. For more information # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. diff --git a/config/routes.rb b/config/routes.rb index d1697bc..d96c9c9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + Rails.application.routes.draw do resources :groups, only: :index resources :guests do diff --git a/db/migrate/20240711175425_create_expenses.rb b/db/migrate/20240711175425_create_expenses.rb index 63d0f2b..cdac7d0 100644 --- a/db/migrate/20240711175425_create_expenses.rb +++ b/db/migrate/20240711175425_create_expenses.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class CreateExpenses < ActiveRecord::Migration[7.1] def change create_enum :pricing_types, ["fixed", "per_person"] diff --git a/db/migrate/20240711180753_create_guests.rb b/db/migrate/20240711180753_create_guests.rb index 1280006..ca3f85b 100644 --- a/db/migrate/20240711180753_create_guests.rb +++ b/db/migrate/20240711180753_create_guests.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class CreateGuests < ActiveRecord::Migration[7.1] def change create_table :guests, id: :uuid do |t| diff --git a/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb index 8b97ba6..803f800 100644 --- a/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 1) diff --git a/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb index ebd46fd..7fe34a2 100644 --- a/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 2) diff --git a/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb index d17afe8..a329d5d 100644 --- a/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 3) diff --git a/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb index 52f696b..4548054 100644 --- a/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 4) diff --git a/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb index 47fd928..d0ff9c4 100644 --- a/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 5) diff --git a/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb index f5aaaf9..194dea4 100644 --- a/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 6) diff --git a/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb index b62b660..23cb9f8 100644 --- a/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 7) diff --git a/db/migrate/20240724181756_create_tables_arrangements.rb b/db/migrate/20240724181756_create_tables_arrangements.rb index c05f6dc..ac69487 100644 --- a/db/migrate/20240724181756_create_tables_arrangements.rb +++ b/db/migrate/20240724181756_create_tables_arrangements.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class CreateTablesArrangements < ActiveRecord::Migration[7.1] def change create_table :tables_arrangements, id: :uuid do |t| diff --git a/db/migrate/20240724181853_create_seats.rb b/db/migrate/20240724181853_create_seats.rb index 74f5b7b..b28c9d0 100644 --- a/db/migrate/20240724181853_create_seats.rb +++ b/db/migrate/20240724181853_create_seats.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class CreateSeats < ActiveRecord::Migration[7.1] def change create_table :seats, id: :uuid do |t| diff --git a/db/migrate/20240811142121_create_groups.rb b/db/migrate/20240811142121_create_groups.rb index 0246978..b21f067 100644 --- a/db/migrate/20240811142121_create_groups.rb +++ b/db/migrate/20240811142121_create_groups.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class CreateGroups < ActiveRecord::Migration[7.1] def change create_table :groups, id: :uuid do |t| diff --git a/db/migrate/20240811143801_add_parent_to_group.rb b/db/migrate/20240811143801_add_parent_to_group.rb index 575af38..c8a3a14 100644 --- a/db/migrate/20240811143801_add_parent_to_group.rb +++ b/db/migrate/20240811143801_add_parent_to_group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class AddParentToGroup < ActiveRecord::Migration[7.1] def change add_reference :groups, :parent, type: :uuid, index: true, foreign_key: { to_table: :groups } diff --git a/db/migrate/20240811154115_add_group_to_guest.rb b/db/migrate/20240811154115_add_group_to_guest.rb index d4e2bd4..f1fcdaf 100644 --- a/db/migrate/20240811154115_add_group_to_guest.rb +++ b/db/migrate/20240811154115_add_group_to_guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class AddGroupToGuest < ActiveRecord::Migration[7.1] def change add_reference :guests, :group, null: false, foreign_key: true, type: :uuid diff --git a/db/migrate/20240811170021_add_status_to_guest.rb b/db/migrate/20240811170021_add_status_to_guest.rb index cd7be5b..de51170 100644 --- a/db/migrate/20240811170021_add_status_to_guest.rb +++ b/db/migrate/20240811170021_add_status_to_guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class AddStatusToGuest < ActiveRecord::Migration[7.1] def change add_column :guests, :status, :integer, default: 0 diff --git a/db/schema.rb b/db/schema.rb index c4145db..1c81149 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. diff --git a/db/seeds.rb b/db/seeds.rb index 391d6e1..09d33f7 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + NUMBER_OF_GUESTS = 50 TablesArrangement.delete_all From 6eb2f858a3341cea5c55b001a552875247466030 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 28 Oct 2024 22:38:47 +0100 Subject: [PATCH 031/283] Write tests for the totals query --- app/queries/expenses/total_query.rb | 24 +++++++ spec/factories/expense.rb | 16 +++++ spec/queries/expenses/total_query_spec.rb | 84 +++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 app/queries/expenses/total_query.rb create mode 100644 spec/factories/expense.rb create mode 100644 spec/queries/expenses/total_query_spec.rb diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb new file mode 100644 index 0000000..b0b72c7 --- /dev/null +++ b/app/queries/expenses/total_query.rb @@ -0,0 +1,24 @@ +module Expenses + class TotalQuery + def call + ActiveRecord::Base.connection.execute(query).first + end + + private + + def query + <<~SQL + SELECT count(amount) as fixed, + 0 as fixed_count, + 0 as variable, + 0 as variable_count, + 0 as total, + 0 as total_count, + 0 as max_projected, + 0 as per_person + FROM EXPENSES + LIMIT 1; + SQL + end + end +end \ No newline at end of file diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb new file mode 100644 index 0000000..f9bf6c3 --- /dev/null +++ b/spec/factories/expense.rb @@ -0,0 +1,16 @@ +FactoryBot.define do + factory :expense do + sequence(:name) { |i| "Expense #{i}" } + pricing_type { "fixed" } + amount { 100 } + end + + trait :fixed do + pricing_type { "fixed" } + end + + trait :per_person do + pricing_type { "per_person" } + end + end + \ No newline at end of file diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb new file mode 100644 index 0000000..65da11e --- /dev/null +++ b/spec/queries/expenses/total_query_spec.rb @@ -0,0 +1,84 @@ +require 'rails_helper' + +module Expenses + RSpec.describe TotalQuery do + describe '#call' do + let(:response) { described_class.new.call } + + before do + create_list(:guest, 2, status: :confirmed) + create_list(:guest, 3, status: :considered) + create_list(:guest, 4, status: :invited) + create_list(:guest, 5, status: :tentative) + create_list(:guest, 6, status: :declined) + end + + context "when there is no expense" do + it "returns zero in all values", :aggregate_failures do + expect(response["fixed"]).to be_zero + expect(response["fixed_count"]).to be_zero + expect(response["variable"]).to be_zero + expect(response["variable_count"]).to be_zero + expect(response["total"]).to be_zero + expect(response["total_count"]).to be_zero + expect(response["max_projected"]).to be_zero + expect(response["per_person"]).to be_zero + end + end + + context "when there are only fixed expenses" do + before do + create(:expense, :fixed, amount: 100) + create(:expense, :fixed, amount: 200) + end + + it "returns the sum of fixed expenses" do + expect(response["fixed"]).to eq(300) + expect(response["fixed_count"]).to eq(2) + expect(response["variable"]).to be_zero + expect(response["variable_count"]).to be_zero + expect(response["total"]).to eq(300) + expect(response["total_count"]).to eq(2) + expect(response["max_projected"]).to eq(300) + expect(response["per_person"]).to eq(150) + end + end + + context "when there are only variable expenses" do + before do + create(:expense, :per_person, amount: 100) + create(:expense, :per_person, amount: 200) + end + + it "returns zero in the values and nonzero in the count", :aggregate_failures do + expect(response["fixed"]).to be_zero + expect(response["fixed_count"]).to be_zero + expect(response["variable"]).to eq(300) + expect(response["variable_count"]).to eq(2) + expect(response["total"]).to eq(2*300) + expect(response["total_count"]).to eq(2) + expect(response["max_projected"]).to eq(11*300) + end + end + + context "when there are both fixed and variable expenses" do + before do + create(:expense, :fixed, amount: 100) + create(:expense, :fixed, amount: 200) + create(:expense, :per_person, amount: 50) + end + + it "returns the sum of fixed and variable expenses", :aggregate_failures do + expect(response["fixed"]).to eq(300) + expect(response["fixed_count"]).to eq(2) + expect(response["variable"]).to eq(50) + expect(response["variable_count"]).to eq(1) + expect(response["total"]).to eq(100 + 200 + 50 * 2) + expect(response["total_count"]).to eq(3) + expect(response["max_projected"]).to eq(100 + 200 + 11*50) + expect(response["per_person"]).to eq(200) + end + end + end + end +end From d8884704d88dfe18056f6057cc8a6f8484c99cd0 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 28 Oct 2024 22:57:03 +0100 Subject: [PATCH 032/283] Implement query to get total expense summary --- app/queries/expenses/total_query.rb | 40 +++++++++++++++++------ spec/queries/expenses/total_query_spec.rb | 2 +- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index b0b72c7..677dc30 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -8,16 +8,36 @@ module Expenses def query <<~SQL - SELECT count(amount) as fixed, - 0 as fixed_count, - 0 as variable, - 0 as variable_count, - 0 as total, - 0 as total_count, - 0 as max_projected, - 0 as per_person - FROM EXPENSES - LIMIT 1; + WITH guest_count AS (#{guest_count_per_status}), + expense_summary AS (#{expense_summary}) + SELECT expense_summary.fixed, + expense_summary.fixed_count, + expense_summary.variable, + expense_summary.variable_count, + expense_summary.total_count, + expense_summary.fixed + expense_summary.variable * guest_count.confirmed as total, + expense_summary.fixed + expense_summary.variable * guest_count.projected as max_projected, + (expense_summary.fixed + expense_summary.variable * guest_count.confirmed) / guest_count.confirmed as per_person + FROM guest_count, expense_summary; + SQL + end + + def expense_summary + <<~SQL + SELECT coalesce(sum(amount) filter (where pricing_type = 'fixed'), 0) as fixed, + coalesce(count(amount) filter (where pricing_type = 'fixed'), 0) as fixed_count, + coalesce(sum(amount) filter (where pricing_type = 'per_person'), 0) as variable, + coalesce(count(amount) filter (where pricing_type = 'per_person'), 0) as variable_count, + count(*) as total_count + FROM expenses + SQL + end + + def guest_count_per_status + <<~SQL + SELECT COALESCE(count(*) filter(where status = #{Guest.statuses["confirmed"]}), 0) as confirmed, + COALESCE(count(*) filter(where status IN (#{Guest.statuses.values_at("confirmed", "invited", "tentative").join(",")})), 0) as projected + FROM guests SQL end end diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index 65da11e..7510e17 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -32,7 +32,7 @@ module Expenses create(:expense, :fixed, amount: 200) end - it "returns the sum of fixed expenses" do + it "returns the sum of fixed expenses", :aggregate_failures do expect(response["fixed"]).to eq(300) expect(response["fixed_count"]).to eq(2) expect(response["variable"]).to be_zero From 6c1bf75db85fc05f4208ac7cc308aff13aae717f Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 28 Oct 2024 23:01:00 +0100 Subject: [PATCH 033/283] Include guest count in the summary --- app/queries/expenses/total_query.rb | 2 ++ spec/queries/expenses/total_query_spec.rb | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index 677dc30..09bf30b 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -15,6 +15,8 @@ module Expenses expense_summary.variable, expense_summary.variable_count, expense_summary.total_count, + guest_count.confirmed as confirmed_guests, + guest_count.projected as projected_guests, expense_summary.fixed + expense_summary.variable * guest_count.confirmed as total, expense_summary.fixed + expense_summary.variable * guest_count.projected as max_projected, (expense_summary.fixed + expense_summary.variable * guest_count.confirmed) / guest_count.confirmed as per_person diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index 7510e17..9e32716 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -23,6 +23,8 @@ module Expenses expect(response["total_count"]).to be_zero expect(response["max_projected"]).to be_zero expect(response["per_person"]).to be_zero + expect(response["confirmed_guests"]).to eq(2) + expect(response["projected_guests"]).to eq(2 + 4 + 5) end end @@ -41,6 +43,8 @@ module Expenses expect(response["total_count"]).to eq(2) expect(response["max_projected"]).to eq(300) expect(response["per_person"]).to eq(150) + expect(response["confirmed_guests"]).to eq(2) + expect(response["projected_guests"]).to eq(2 + 4 + 5) end end @@ -58,6 +62,8 @@ module Expenses expect(response["total"]).to eq(2*300) expect(response["total_count"]).to eq(2) expect(response["max_projected"]).to eq(11*300) + expect(response["confirmed_guests"]).to eq(2) + expect(response["projected_guests"]).to eq(2 + 4 + 5) end end @@ -77,6 +83,8 @@ module Expenses expect(response["total_count"]).to eq(3) expect(response["max_projected"]).to eq(100 + 200 + 11*50) expect(response["per_person"]).to eq(200) + expect(response["confirmed_guests"]).to eq(2) + expect(response["projected_guests"]).to eq(2 + 4 + 5) end end end From 0fb50ea59bf8bd189155db550c63d23b4aa16ed1 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 28 Oct 2024 23:01:46 +0100 Subject: [PATCH 034/283] Expose expense summary endpoint --- app/controllers/expenses_controller.rb | 4 ++++ config/routes.rb | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 774b87f..3d38733 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -8,6 +8,10 @@ class ExpensesController < ApplicationController @expenses = Expense.all end + def summary + render json: Expenses::TotalQuery.new.call + end + # GET /expenses/1 or /expenses/1.json def show end diff --git a/config/routes.rb b/config/routes.rb index d96c9c9..a7b4d0c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,9 @@ Rails.application.routes.draw do post :import, on: :collection post :bulk_update, on: :collection end - resources :expenses + resources :expenses do + get :summary, on: :collection + end resources :tables_arrangements, only: [:index, :show] get 'up' => 'rails/health#show', as: :rails_health_check From 253d6b0591979ac2cfffdc9edc76158830ba96a0 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 28 Oct 2024 22:02:49 +0000 Subject: [PATCH 035/283] Add copyright notice --- app/queries/expenses/total_query.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index 09bf30b..5ed4ca9 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module Expenses class TotalQuery def call From ace03a6654d1120b4b83b184bb78d836d4417647 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 28 Oct 2024 23:04:10 +0100 Subject: [PATCH 036/283] Include the copyright notice in spec files --- .github/workflows/copyright_notice.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/copyright_notice.yml b/.github/workflows/copyright_notice.yml index b6c398e..c97e035 100644 --- a/.github/workflows/copyright_notice.yml +++ b/.github/workflows/copyright_notice.yml @@ -15,7 +15,7 @@ jobs: with: CopyrightString: '# Copyright (C) 2024 Manuel Bustillo\n\n' FileType: '.rb' - Path: 'app/, config/, db/' + Path: 'app/, config/, db/, spec/' - uses: VinnyBabuManjaly/copyright-action@v1.0.0 with: CopyrightString: '<%# Copyright (C) 2024 Manuel Bustillo %>\n\n' From 658c2331ca20d32980f5781089d2512fac418044 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 28 Oct 2024 22:07:35 +0000 Subject: [PATCH 037/283] Add copyright notice --- spec/extensions/tree_spec.rb | 2 ++ spec/factories/groups.rb | 2 ++ spec/factories/guest.rb | 2 ++ spec/models/expense_spec.rb | 2 ++ spec/models/group_spec.rb | 2 ++ spec/models/guest_spec.rb | 2 ++ spec/models/seat_spec.rb | 2 ++ spec/models/tables_arrangement_spec.rb | 2 ++ spec/rails_helper.rb | 2 ++ spec/services/tables/discomfort_calculator_spec.rb | 2 ++ spec/services/tables/swap_spec.rb | 2 ++ spec/spec_helper.rb | 2 ++ 12 files changed, 24 insertions(+) diff --git a/spec/extensions/tree_spec.rb b/spec/extensions/tree_spec.rb index cbefba4..6629197 100644 --- a/spec/extensions/tree_spec.rb +++ b/spec/extensions/tree_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' module Tree diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 9bfade0..4ebce4e 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + FactoryBot.define do factory :group do sequence(:name) { |i| "Group #{i}" } diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index 7ff9066..688cdea 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + FactoryBot.define do factory :guest do association :group diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index 5ad50a3..a6592fe 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' RSpec.describe Expense, type: :model do diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index be100cf..c31cd69 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' RSpec.describe Group, type: :model do diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index 1e6abc7..1d3e530 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' RSpec.describe Guest, type: :model do diff --git a/spec/models/seat_spec.rb b/spec/models/seat_spec.rb index bdcd95d..2020f33 100644 --- a/spec/models/seat_spec.rb +++ b/spec/models/seat_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' RSpec.describe Seat, type: :model do diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index 71a09f5..ab4677c 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' RSpec.describe TablesArrangement, type: :model do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index c10abff..233f83a 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index 3764e7e..c2426ba 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' module Tables RSpec.describe DiscomfortCalculator do diff --git a/spec/services/tables/swap_spec.rb b/spec/services/tables/swap_spec.rb index fff181f..3022af2 100644 --- a/spec/services/tables/swap_spec.rb +++ b/spec/services/tables/swap_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' module Tables diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 327b58e..25cfd37 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause From d8ef1f179c5444ad46dfab5c1d4ca760a892ce33 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 31 Oct 2024 23:08:25 +0000 Subject: [PATCH 038/283] Update dependency rails to v7.2.2 --- Gemfile.lock | 110 ++++++++++++++++++++++++++------------------------- 1 file changed, 56 insertions(+), 54 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 831d9a3..3d50334 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,29 +1,29 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.2.1.2) - actionpack (= 7.2.1.2) - activesupport (= 7.2.1.2) + actioncable (7.2.2) + actionpack (= 7.2.2) + activesupport (= 7.2.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.1.2) - actionpack (= 7.2.1.2) - activejob (= 7.2.1.2) - activerecord (= 7.2.1.2) - activestorage (= 7.2.1.2) - activesupport (= 7.2.1.2) + actionmailbox (7.2.2) + actionpack (= 7.2.2) + activejob (= 7.2.2) + activerecord (= 7.2.2) + activestorage (= 7.2.2) + activesupport (= 7.2.2) mail (>= 2.8.0) - actionmailer (7.2.1.2) - actionpack (= 7.2.1.2) - actionview (= 7.2.1.2) - activejob (= 7.2.1.2) - activesupport (= 7.2.1.2) + actionmailer (7.2.2) + actionpack (= 7.2.2) + actionview (= 7.2.2) + activejob (= 7.2.2) + activesupport (= 7.2.2) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.1.2) - actionview (= 7.2.1.2) - activesupport (= 7.2.1.2) + actionpack (7.2.2) + actionview (= 7.2.2) + activesupport (= 7.2.2) nokogiri (>= 1.8.5) racc rack (>= 2.2.4, < 3.2) @@ -32,36 +32,37 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.1.2) - actionpack (= 7.2.1.2) - activerecord (= 7.2.1.2) - activestorage (= 7.2.1.2) - activesupport (= 7.2.1.2) + actiontext (7.2.2) + actionpack (= 7.2.2) + activerecord (= 7.2.2) + activestorage (= 7.2.2) + activesupport (= 7.2.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.1.2) - activesupport (= 7.2.1.2) + actionview (7.2.2) + activesupport (= 7.2.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.1.2) - activesupport (= 7.2.1.2) + activejob (7.2.2) + activesupport (= 7.2.2) globalid (>= 0.3.6) - activemodel (7.2.1.2) - activesupport (= 7.2.1.2) - activerecord (7.2.1.2) - activemodel (= 7.2.1.2) - activesupport (= 7.2.1.2) + activemodel (7.2.2) + activesupport (= 7.2.2) + activerecord (7.2.2) + activemodel (= 7.2.2) + activesupport (= 7.2.2) timeout (>= 0.4.0) - activestorage (7.2.1.2) - actionpack (= 7.2.1.2) - activejob (= 7.2.1.2) - activerecord (= 7.2.1.2) - activesupport (= 7.2.1.2) + activestorage (7.2.2) + actionpack (= 7.2.2) + activejob (= 7.2.2) + activerecord (= 7.2.2) + activesupport (= 7.2.2) marcel (~> 1.0) - activesupport (7.2.1.2) + activesupport (7.2.2) base64 + benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) @@ -80,6 +81,7 @@ GEM babel-source (>= 4.0, < 6) execjs (~> 2.0) base64 (0.2.0) + benchmark (0.3.0) bigdecimal (3.1.8) bindex (0.8.1) bootsnap (1.18.4) @@ -158,7 +160,7 @@ GEM timeout net-smtp (0.5.0) net-protocol - nio4r (2.7.3) + nio4r (2.7.4) nokogiri (1.16.7-aarch64-linux) racc (~> 1.4) nokogiri (1.16.7-arm-linux) @@ -194,20 +196,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.2.1.2) - actioncable (= 7.2.1.2) - actionmailbox (= 7.2.1.2) - actionmailer (= 7.2.1.2) - actionpack (= 7.2.1.2) - actiontext (= 7.2.1.2) - actionview (= 7.2.1.2) - activejob (= 7.2.1.2) - activemodel (= 7.2.1.2) - activerecord (= 7.2.1.2) - activestorage (= 7.2.1.2) - activesupport (= 7.2.1.2) + rails (7.2.2) + actioncable (= 7.2.2) + actionmailbox (= 7.2.2) + actionmailer (= 7.2.2) + actionpack (= 7.2.2) + actiontext (= 7.2.2) + actionview (= 7.2.2) + activejob (= 7.2.2) + activemodel (= 7.2.2) + activerecord (= 7.2.2) + activestorage (= 7.2.2) + activesupport (= 7.2.2) bundler (>= 1.15.0) - railties (= 7.2.1.2) + railties (= 7.2.2) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -215,9 +217,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.2.1.2) - actionpack (= 7.2.1.2) - activesupport (= 7.2.1.2) + railties (7.2.2) + actionpack (= 7.2.2) + activesupport (= 7.2.2) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) From 7c0a525c64d53fb061e0d438ea894885be2097c8 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Thu, 31 Oct 2024 23:34:15 +0000 Subject: [PATCH 039/283] Add copyright notice --- spec/factories/expense.rb | 2 ++ spec/queries/expenses/total_query_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index f9bf6c3..9670768 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + FactoryBot.define do factory :expense do sequence(:name) { |i| "Expense #{i}" } diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index 9e32716..46cffdf 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' module Expenses From c1575bb7e170ffc7a7c36d4debfa7e41dba697f8 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 31 Oct 2024 23:08:34 +0000 Subject: [PATCH 040/283] Update dependency rubocop to v1.68.0 --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3d50334..35e8250 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -122,7 +122,7 @@ GEM jbuilder (2.13.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) - json (2.7.2) + json (2.7.5) jsonapi-deserializable (0.2.0) jsonapi-parser (0.1.1) jsonapi-rails (0.4.1) @@ -174,7 +174,7 @@ GEM nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) parallel (1.26.3) - parser (3.3.5.0) + parser (3.3.5.1) ast (~> 2.4.1) racc pg (1.5.9) @@ -259,7 +259,7 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.1) - rubocop (1.67.0) + rubocop (1.68.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -269,7 +269,7 @@ GEM rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.3) + rubocop-ast (1.33.0) parser (>= 3.3.1.0) ruby-progressbar (1.13.0) rubytree (2.1.0) From b5693f549ec7d8f05f06b1fdbd2e3fdd06d960a0 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 1 Nov 2024 11:55:32 +0100 Subject: [PATCH 041/283] Load groups hierarchy from data in DB --- app/models/group.rb | 2 ++ app/services/affinity_groups_hierarchy.rb | 16 +++++++++ config/initializers/affinity_groups.rb | 41 ----------------------- 3 files changed, 18 insertions(+), 41 deletions(-) delete mode 100644 config/initializers/affinity_groups.rb diff --git a/app/models/group.rb b/app/models/group.rb index 4e12aed..316295e 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -7,5 +7,7 @@ class Group < ApplicationRecord has_many :children, class_name: 'Group', foreign_key: 'parent_id' belongs_to :parent, class_name: 'Group', optional: true + scope :roots, -> { where(parent_id: nil) } + has_many :guests end diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index 7c87ed9..48db7fc 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -6,6 +6,12 @@ class AffinityGroupsHierarchy < Array def initialize super @references = {} + + Group.roots.each do |group| + self << group.id + + hydrate(group) + end end def find(name) @@ -26,4 +32,14 @@ class AffinityGroupsHierarchy < Array @references[name_a].distance_to_common_ancestor(@references[name_b]) end + + private + + def hydrate(group) + group.children.each do |child| + register_child(group.id, child.id) + + hydrate(child) + end + end end diff --git a/config/initializers/affinity_groups.rb b/config/initializers/affinity_groups.rb deleted file mode 100644 index 1415e8d..0000000 --- a/config/initializers/affinity_groups.rb +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -require_relative '../../app/services/affinity_groups_hierarchy' - -hierarchy = AffinityGroupsHierarchy.instance - -hierarchy << 'guests_a' -hierarchy << 'guests_b' -hierarchy << 'common_guests' - -hierarchy.register_child('guests_a', 'family_a') -hierarchy.register_child('family_a', 'close_family_a') -hierarchy.register_child('family_a', 'cousins_a') -hierarchy.register_child('family_a', 'relatives_a') - -hierarchy.register_child('guests_a', 'work_a') -hierarchy.register_child('work_a', 'besties_work_a') - -hierarchy.register_child('guests_a', 'friends_a') -hierarchy.register_child('friends_a', 'college_friends_a') -hierarchy.register_child('friends_a', 'high_school_friends_a') -hierarchy.register_child('friends_a', 'childhood_friends_a') - -hierarchy.register_child('guests_a', 'sports_a') -hierarchy.register_child('sports_a', 'basket_team_a') -hierarchy.register_child('sports_a', 'football_team_a') - -hierarchy.register_child('guests_b', 'family_b') -hierarchy.register_child('family_b', 'close_family_b') -hierarchy.register_child('family_b', 'cousins_b') -hierarchy.register_child('family_b', 'relatives_b') - -hierarchy.register_child('guests_b', 'work_b') -hierarchy.register_child('work_b', 'besties_work_b') - -hierarchy.register_child('guests_b', 'friends_b') -hierarchy.register_child('friends_b', 'college_friends_b') -hierarchy.register_child('friends_b', 'high_school_friends_b') -hierarchy.register_child('friends_b', 'childhood_friends_b') - -hierarchy.register_child('common_guests', 'dance_club') \ No newline at end of file From d37dd44cd39992fe85f2f7e03479151391f6f070 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 1 Nov 2024 12:04:15 +0100 Subject: [PATCH 042/283] Update discomfort calculator to use group ids --- app/services/affinity_groups_hierarchy.rb | 20 +++--- app/services/tables/discomfort_calculator.rb | 2 +- .../tables/discomfort_calculator_spec.rb | 69 ++++++++++--------- 3 files changed, 48 insertions(+), 43 deletions(-) diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index 48db7fc..e20de97 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -14,23 +14,23 @@ class AffinityGroupsHierarchy < Array end end - def find(name) - @references[name] + def find(id) + @references[id] end - def <<(name) - new_node = Tree::TreeNode.new(name) - super(new_node).tap { @references[name] = new_node } + def <<(id) + new_node = Tree::TreeNode.new(id) + super(new_node).tap { @references[id] = new_node } end - def register_child(parent_name, child_name) - @references[parent_name] << Tree::TreeNode.new(child_name).tap { |child_node| @references[child_name] = child_node } + def register_child(parent_id, child_id) + @references[parent_id] << Tree::TreeNode.new(child_id).tap { |child_node| @references[child_id] = child_node } end - def distance(name_a, name_b) - return nil if @references[name_a].nil? || @references[name_b].nil? + def distance(id_a, id_b) + return nil if @references[id_a].nil? || @references[id_b].nil? - @references[name_a].distance_to_common_ancestor(@references[name_b]) + @references[id_a].distance_to_common_ancestor(@references[id_b]) end private diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index d6907e8..09b5356 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -14,7 +14,7 @@ module Tables private def cohesion_penalty - table.map { |guest| guest.affinity_group_list.first }.tally.to_a.combination(2).sum do |(a, count_a), (b, count_b)| + table.map(&:group_id).tally.to_a.combination(2).sum do |(a, count_a), (b, count_b)| distance = AffinityGroupsHierarchy.instance.distance(a, b) next count_a * count_b if distance.nil? diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index c2426ba..0e22602 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -5,6 +5,11 @@ module Tables RSpec.describe DiscomfortCalculator do let(:calculator) { described_class.new(table) } + let(:family) { create(:group, name: 'family') } + let(:friends) { create(:group, name: 'friends') } + let(:work) { create(:group, name: 'work') } + let(:school) { create(:group, name: 'school') } + describe '#cohesion_penalty' do before do # Overridden in each test except trivial cases @@ -14,16 +19,16 @@ module Tables allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(group, group).and_return(0) end - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with('family', 'friends').and_return(nil) - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with('friends', 'work').and_return(1) - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with('family', 'work').and_return(2) - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with('family', 'school').and_return(3) - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with('friends', 'school').and_return(4) - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with('work', 'school').and_return(5) + allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(family.id, friends.id).and_return(nil) + allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(friends.id, work.id).and_return(1) + allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(family.id, work.id).and_return(2) + allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(family.id, school.id).and_return(3) + allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(friends.id, school.id).and_return(4) + allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(work.id, school.id).and_return(5) end context 'when the table contains just two guests' do context 'when they belong to the same group' do - let(:table) { create_list(:guest, 2, affinity_group_list: ['family']) } + let(:table) { create_list(:guest, 2, group: family) } it { expect(calculator.send(:cohesion_penalty)).to eq(0) } end @@ -31,8 +36,8 @@ module Tables context 'when they belong to completely unrelated groups' do let(:table) do [ - create(:guest, affinity_group_list: ['family']), - create(:guest, affinity_group_list: ['friends']) + create(:guest, group: family), + create(:guest, group: friends) ] end it { expect(calculator.send(:cohesion_penalty)).to eq(1) } @@ -41,8 +46,8 @@ module Tables context 'when they belong to groups at a distance of 1' do let(:table) do [ - create(:guest, affinity_group_list: ['friends']), - create(:guest, affinity_group_list: ['work']) + create(:guest, group: friends), + create(:guest, group: work) ] end @@ -52,8 +57,8 @@ module Tables context 'when they belong to groups at a distance of 2' do let(:table) do [ - create(:guest, affinity_group_list: ['family']), - create(:guest, affinity_group_list: ['work']) + create(:guest, group: family), + create(:guest, group: work) ] end @@ -63,8 +68,8 @@ module Tables context 'when they belong to groups at a distance of 3' do let(:table) do [ - create(:guest, affinity_group_list: ['family']), - create(:guest, affinity_group_list: ['school']) + create(:guest, group: family), + create(:guest, group: school) ] end @@ -75,9 +80,9 @@ module Tables context 'when the table contains three guests' do let(:table) do [ - create(:guest, affinity_group_list: ['family']), - create(:guest, affinity_group_list: ['friends']), - create(:guest, affinity_group_list: ['work']) + create(:guest, group: family), + create(:guest, group: friends), + create(:guest, group: work) ] end @@ -89,10 +94,10 @@ module Tables context 'when the table contains four guests of different groups' do let(:table) do [ - create(:guest, affinity_group_list: ['family']), - create(:guest, affinity_group_list: ['friends']), - create(:guest, affinity_group_list: ['work']), - create(:guest, affinity_group_list: ['school']) + create(:guest, group: family), + create(:guest, group: friends), + create(:guest, group: work), + create(:guest, group: school) ] end @@ -105,8 +110,8 @@ module Tables context 'when the table contains four guests of two evenly split groups' do let(:table) do [ - create_list(:guest, 2, affinity_group_list: ['family']), - create_list(:guest, 2, affinity_group_list: ['friends']) + create_list(:guest, 2, group: family), + create_list(:guest, 2, group: friends) ].flatten end @@ -118,8 +123,8 @@ module Tables context 'when the table contains six guests of two unevenly split groups' do let(:table) do [ - create_list(:guest, 2, affinity_group_list: ['family']), - create_list(:guest, 4, affinity_group_list: ['friends']) + create_list(:guest, 2, group: family), + create_list(:guest, 4, group: friends) ].flatten end @@ -131,9 +136,9 @@ module Tables context 'when the table contains six guests of three evenly split groups' do let(:table) do [ - create_list(:guest, 2, affinity_group_list: ['family']), - create_list(:guest, 2, affinity_group_list: ['friends']), - create_list(:guest, 2, affinity_group_list: ['work']) + create_list(:guest, 2, group: family), + create_list(:guest, 2, group: friends), + create_list(:guest, 2, group: work) ].flatten end @@ -145,9 +150,9 @@ module Tables context 'when the table contains six guests of three unevenly split groups' do let(:table) do [ - create_list(:guest, 3, affinity_group_list: ['family']), - create_list(:guest, 2, affinity_group_list: ['friends']), - create_list(:guest, 1, affinity_group_list: ['work']) + create_list(:guest, 3, group: family), + create_list(:guest, 2, group: friends), + create_list(:guest, 1, group: work) ].flatten end From 1f93fe42c5b1bf9e15dff35c0917ea215e476f11 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 1 Nov 2024 19:07:12 +0100 Subject: [PATCH 043/283] Clean up unused methods and non-API endpoints from controllers --- app/controllers/expenses_controller.rb | 69 ------------------- app/controllers/guests_controller.rb | 68 +----------------- .../tables_arrangements_controller.rb | 7 +- 3 files changed, 4 insertions(+), 140 deletions(-) diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 3d38733..e208a12 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -1,76 +1,7 @@ # Copyright (C) 2024 Manuel Bustillo class ExpensesController < ApplicationController - before_action :set_expense, only: %i[ show edit update destroy ] - - # GET /expenses or /expenses.json - def index - @expenses = Expense.all - end - def summary render json: Expenses::TotalQuery.new.call end - - # GET /expenses/1 or /expenses/1.json - def show - end - - # GET /expenses/new - def new - @expense = Expense.new - end - - # GET /expenses/1/edit - def edit - end - - # POST /expenses or /expenses.json - def create - @expense = Expense.new(expense_params) - - respond_to do |format| - if @expense.save - format.html { redirect_to expense_url(@expense), notice: "Expense was successfully created." } - format.json { render :show, status: :created, location: @expense } - else - format.html { render :new, status: :unprocessable_entity } - format.json { render json: @expense.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /expenses/1 or /expenses/1.json - def update - respond_to do |format| - if @expense.update(expense_params) - format.html { redirect_to expense_url(@expense), notice: "Expense was successfully updated." } - format.json { render :show, status: :ok, location: @expense } - else - format.html { render :edit, status: :unprocessable_entity } - format.json { render json: @expense.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /expenses/1 or /expenses/1.json - def destroy - @expense.destroy! - - respond_to do |format| - format.html { redirect_to expenses_url, notice: "Expense was successfully destroyed." } - format.json { head :no_content } - end - end - - private - # Use callbacks to share common setup or constraints between actions. - def set_expense - @expense = Expense.find(params[:id]) - end - - # Only allow a list of trusted parameters through. - def expense_params - params.require(:expense).permit(:name, :amount, :pricing_type) - end end diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 5a1dbb2..ecf5d34 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -3,64 +3,12 @@ require 'csv' class GuestsController < ApplicationController - before_action :set_guest, only: %i[show edit update destroy] - - # GET /guests or /guests.json def index - @guests = Guest.all + @guests = Guest.all.includes(:group) .joins(:group) .order('groups.name' => :asc, first_name: :asc, last_name: :asc) - render jsonapi: @guests - end - - # GET /guests/1 or /guests/1.json - def show; end - - # GET /guests/new - def new - @guest = Guest.new - end - - # GET /guests/1/edit - def edit; end - - # POST /guests or /guests.json - def create - @guest = Guest.new(guest_params) - - respond_to do |format| - if @guest.save - format.html { redirect_to guest_url(@guest), notice: 'Guest was successfully created.' } - format.json { render :show, status: :created, location: @guest } - else - format.html { render :new, status: :unprocessable_entity } - format.json { render json: @guest.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /guests/1 or /guests/1.json - def update - respond_to do |format| - if @guest.update(guest_params) - format.html { redirect_to guest_url(@guest), notice: 'Guest was successfully updated.' } - format.json { render :show, status: :ok, location: @guest } - else - format.html { render :edit, status: :unprocessable_entity } - format.json { render json: @guest.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /guests/1 or /guests/1.json - def destroy - @guest.destroy! - - respond_to do |format| - format.html { redirect_to guests_url, notice: 'Guest was successfully destroyed.' } - format.json { head :no_content } - end + render jsonapi: @guests end def import @@ -81,16 +29,4 @@ class GuestsController < ApplicationController Guest.where(id: params[:guest_ids]).update!(params.require(:properties).permit(:status)) render json: {}, status: :ok end - - private - - # Use callbacks to share common setup or constraints between actions. - def set_guest - @guest = Guest.find(params[:id]) - end - - # Only allow a list of trusted parameters through. - def guest_params - params.require(:guest).permit(:first_name, :last_name, :email, :phone) - end end diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index 8523f5a..75451ca 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -2,13 +2,10 @@ class TablesArrangementsController < ApplicationController def index - @tables_arrangements = TablesArrangement.all.order(discomfort: :asc).limit(10) + render json: TablesArrangement.all.order(discomfort: :asc).limit(10) end def show - @tables_arrangement = TablesArrangement.find(params[:id]) - @seats = @tables_arrangement.seats - .includes(guest: %i[affinity_groups unbreakable_bonds]) - .group_by(&:table_number) + render json: TablesArrangement.find(params[:id]) end end From db644c85be3aff0022b645a5819b4495ccac90aa Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 1 Nov 2024 19:08:01 +0100 Subject: [PATCH 044/283] Remove HTML views --- app/views/expenses/_expense.html.erb | 19 ---------- app/views/expenses/_form.html.erb | 34 ----------------- app/views/expenses/edit.html.erb | 12 ------ app/views/expenses/index.html.erb | 30 --------------- app/views/expenses/new.html.erb | 11 ------ app/views/expenses/show.html.erb | 12 ------ app/views/guests/_form.html.erb | 39 -------------------- app/views/guests/_guest.html.erb | 24 ------------ app/views/guests/edit.html.erb | 12 ------ app/views/guests/index.html.erb | 39 -------------------- app/views/guests/new.html.erb | 11 ------ app/views/guests/show.html.erb | 12 ------ app/views/layouts/application.html.erb | 18 --------- app/views/tables_arrangements/index.html.erb | 11 ------ app/views/tables_arrangements/show.html.erb | 18 --------- 15 files changed, 302 deletions(-) delete mode 100644 app/views/expenses/_expense.html.erb delete mode 100644 app/views/expenses/_form.html.erb delete mode 100644 app/views/expenses/edit.html.erb delete mode 100644 app/views/expenses/index.html.erb delete mode 100644 app/views/expenses/new.html.erb delete mode 100644 app/views/expenses/show.html.erb delete mode 100644 app/views/guests/_form.html.erb delete mode 100644 app/views/guests/_guest.html.erb delete mode 100644 app/views/guests/edit.html.erb delete mode 100644 app/views/guests/index.html.erb delete mode 100644 app/views/guests/new.html.erb delete mode 100644 app/views/guests/show.html.erb delete mode 100644 app/views/layouts/application.html.erb delete mode 100644 app/views/tables_arrangements/index.html.erb delete mode 100644 app/views/tables_arrangements/show.html.erb diff --git a/app/views/expenses/_expense.html.erb b/app/views/expenses/_expense.html.erb deleted file mode 100644 index 5bac9f6..0000000 --- a/app/views/expenses/_expense.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -
    -

    - Name: - <%= expense.name %> -

    - -

    - Amount: - <%= expense.amount %> -

    - -

    - Pricing type: - <%= expense.pricing_type %> -

    - -
    diff --git a/app/views/expenses/_form.html.erb b/app/views/expenses/_form.html.erb deleted file mode 100644 index 8d9cd9c..0000000 --- a/app/views/expenses/_form.html.erb +++ /dev/null @@ -1,34 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -<%= form_with(model: expense) do |form| %> - <% if expense.errors.any? %> -
    -

    <%= pluralize(expense.errors.count, "error") %> prohibited this expense from being saved:

    - -
      - <% expense.errors.each do |error| %> -
    • <%= error.full_message %>
    • - <% end %> -
    -
    - <% end %> - -
    - <%= form.label :name, style: "display: block" %> - <%= form.text_field :name %> -
    - -
    - <%= form.label :amount, style: "display: block" %> - <%= form.text_field :amount %> -
    - -
    - <%= form.label :pricing_type, style: "display: block" %> - <%= form.text_field :pricing_type %> -
    - -
    - <%= form.submit %> -
    -<% end %> diff --git a/app/views/expenses/edit.html.erb b/app/views/expenses/edit.html.erb deleted file mode 100644 index 032aba0..0000000 --- a/app/views/expenses/edit.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    Editing expense

    - -<%= render "form", expense: @expense %> - -
    - -
    - <%= link_to "Show this expense", @expense %> | - <%= link_to "Back to expenses", expenses_path %> -
    diff --git a/app/views/expenses/index.html.erb b/app/views/expenses/index.html.erb deleted file mode 100644 index 6e4fd28..0000000 --- a/app/views/expenses/index.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    <%= notice %>

    - -

    Expenses

    - -
    - - - - - - - <% @expenses.each do |expense| %> - - - - - - - <% end %> - - - - - -
    NameAmount
    <%= expense.name %><%= expense.amount.to_currency %><%= link_to "Show", expense %><%= link_to "Edit", edit_expense_path(expense) %>
    Total<%= @expenses.sum(&:amount).to_currency %>
    -
    - -<%= link_to "New expense", new_expense_path %> diff --git a/app/views/expenses/new.html.erb b/app/views/expenses/new.html.erb deleted file mode 100644 index a7b9844..0000000 --- a/app/views/expenses/new.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    New expense

    - -<%= render "form", expense: @expense %> - -
    - -
    - <%= link_to "Back to expenses", expenses_path %> -
    diff --git a/app/views/expenses/show.html.erb b/app/views/expenses/show.html.erb deleted file mode 100644 index b2bec00..0000000 --- a/app/views/expenses/show.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    <%= notice %>

    - -<%= render @expense %> - -
    - <%= link_to "Edit this expense", edit_expense_path(@expense) %> | - <%= link_to "Back to expenses", expenses_path %> - - <%= button_to "Destroy this expense", @expense, method: :delete %> -
    diff --git a/app/views/guests/_form.html.erb b/app/views/guests/_form.html.erb deleted file mode 100644 index e2daaf5..0000000 --- a/app/views/guests/_form.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -<%= form_with(model: guest) do |form| %> - <% if guest.errors.any? %> -
    -

    <%= pluralize(guest.errors.count, "error") %> prohibited this guest from being saved:

    - -
      - <% guest.errors.each do |error| %> -
    • <%= error.full_message %>
    • - <% end %> -
    -
    - <% end %> - -
    - <%= form.label :first_name, style: "display: block" %> - <%= form.text_field :first_name %> -
    - -
    - <%= form.label :last_name, style: "display: block" %> - <%= form.text_field :last_name %> -
    - -
    - <%= form.label :email, style: "display: block" %> - <%= form.text_field :email %> -
    - -
    - <%= form.label :phone, style: "display: block" %> - <%= form.text_field :phone %> -
    - -
    - <%= form.submit %> -
    -<% end %> diff --git a/app/views/guests/_guest.html.erb b/app/views/guests/_guest.html.erb deleted file mode 100644 index ed160f9..0000000 --- a/app/views/guests/_guest.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -
    -

    - First name: - <%= guest.first_name %> -

    - -

    - Last name: - <%= guest.last_name %> -

    - -

    - Email: - <%= guest.email %> -

    - -

    - Phone: - <%= guest.phone %> -

    - -
    diff --git a/app/views/guests/edit.html.erb b/app/views/guests/edit.html.erb deleted file mode 100644 index d59a8e7..0000000 --- a/app/views/guests/edit.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    Editing guest

    - -<%= render "form", guest: @guest %> - -
    - -
    - <%= link_to "Show this guest", @guest %> | - <%= link_to "Back to guests", guests_path %> -
    diff --git a/app/views/guests/index.html.erb b/app/views/guests/index.html.erb deleted file mode 100644 index 3ef84c4..0000000 --- a/app/views/guests/index.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    <%= notice %>

    - -

    Guests

    - -
    - - - - - - - - - - - <% @guests.each_with_index do |guest, i| %> - - - - - - - - - - - <% end %> -
    Row #NameEmailPhoneAffinity groupsUnbreakable bonds
    <%= i + 1 %><%= guest.full_name %><%= guest.email %><%= guest.phone %><%= guest.affinity_groups.pluck(:name).join(", ") %><%= guest.unbreakable_bonds.pluck(:name).join(", ") %><%= link_to "Show", guest %><%= link_to "Edit", edit_guest_path(guest) %>
    -
    - -<%= link_to "New guest", new_guest_path %> - -<%= form_with url: import_guests_path, method: :post do |form| %> - <%= form.label :file %> - <%= form.file_field :file %> - <%= form.submit "Import" %> -<% end %> diff --git a/app/views/guests/new.html.erb b/app/views/guests/new.html.erb deleted file mode 100644 index 8405d09..0000000 --- a/app/views/guests/new.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    New guest

    - -<%= render "form", guest: @guest %> - -
    - -
    - <%= link_to "Back to guests", guests_path %> -
    diff --git a/app/views/guests/show.html.erb b/app/views/guests/show.html.erb deleted file mode 100644 index 6976007..0000000 --- a/app/views/guests/show.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    <%= notice %>

    - -<%= render @guest %> - -
    - <%= link_to "Edit this guest", edit_guest_path(@guest) %> | - <%= link_to "Back to guests", guests_path %> - - <%= button_to "Destroy this guest", @guest, method: :delete %> -
    diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb deleted file mode 100644 index 4c8aeb2..0000000 --- a/app/views/layouts/application.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - - - - - WeddingPlanner - - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - - <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> - <%= javascript_importmap_tags %> - - - - <%= yield %> - - diff --git a/app/views/tables_arrangements/index.html.erb b/app/views/tables_arrangements/index.html.erb deleted file mode 100644 index b24f7da..0000000 --- a/app/views/tables_arrangements/index.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    Tables arrangements

    - -
      - <% @tables_arrangements.each_with_index do |tables_arrangement, i| %> -
    1. -

      <%= link_to "Arrangement ##{i+1}", tables_arrangement_path(tables_arrangement) %> Discomfort: <%= tables_arrangement.discomfort %>

      -
    2. - <% end %> -
    \ No newline at end of file diff --git a/app/views/tables_arrangements/show.html.erb b/app/views/tables_arrangements/show.html.erb deleted file mode 100644 index cc90581..0000000 --- a/app/views/tables_arrangements/show.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    ID: <%= @tables_arrangement.id %>

    - -

    Discomfort: <%= @tables_arrangement.discomfort %>

    - -

    Seats

    - -<% @seats.each do |table_number, seats| %> - -

    Table <%= table_number %>

    - -
      - <% seats.each do |seat| %> -
    • <%= seat.guest.full_name %> (<%= seat.guest.affinity_groups.pluck(:name).join(", ") %>)
    • - <% end %> -
    -<% end %> \ No newline at end of file From ea129602b5186178049aff3eff7e8d4076ccaa29 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 1 Nov 2024 19:10:11 +0100 Subject: [PATCH 045/283] Uninstall acts as taggable on gem --- Gemfile | 1 - Gemfile.lock | 4 ---- 2 files changed, 5 deletions(-) diff --git a/Gemfile b/Gemfile index cb3135b..b02355a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,6 @@ source 'https://rubygems.org' ruby '3.3.5' -gem 'acts-as-taggable-on' gem 'bootsnap', require: false gem 'csv' gem 'importmap-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 35e8250..34cdc5f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -72,9 +72,6 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) - acts-as-taggable-on (11.0.0) - activerecord (>= 7.0, < 8.0) - zeitwerk (>= 2.4, < 3.0) ast (2.4.2) babel-source (5.8.35) babel-transpiler (0.7.0) @@ -315,7 +312,6 @@ PLATFORMS x86_64-linux DEPENDENCIES - acts-as-taggable-on bootsnap csv debug From 5fef6f1011cbcd6345d39246bd09bf3eb1c940c8 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 1 Nov 2024 19:12:34 +0100 Subject: [PATCH 046/283] Remove references to acts_as_taggable_on gem --- app/models/guest.rb | 1 - .../20241101181052_drop_taggable_tables.rb | 27 ++++++++++++++++++ db/schema.rb | 28 +------------------ db/seeds.rb | 2 -- 4 files changed, 28 insertions(+), 30 deletions(-) create mode 100644 db/migrate/20241101181052_drop_taggable_tables.rb diff --git a/app/models/guest.rb b/app/models/guest.rb index 412f01c..39d27b3 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,7 +1,6 @@ # Copyright (C) 2024 Manuel Bustillo class Guest < ApplicationRecord - acts_as_taggable_on :affinity_groups, :unbreakable_bonds belongs_to :group enum status: { diff --git a/db/migrate/20241101181052_drop_taggable_tables.rb b/db/migrate/20241101181052_drop_taggable_tables.rb new file mode 100644 index 0000000..73191e8 --- /dev/null +++ b/db/migrate/20241101181052_drop_taggable_tables.rb @@ -0,0 +1,27 @@ +class DropTaggableTables < ActiveRecord::Migration[7.2] + def change + drop_table 'taggings', force: :cascade do |t| + t.bigint 'tag_id' + t.string 'taggable_type' + t.uuid 'taggable_id' + t.string 'tagger_type' + t.bigint 'tagger_id' + t.string 'context', limit: 128 + t.datetime 'created_at', precision: nil + t.string 'tenant', limit: 128 + t.index ['context'], name: 'index_taggings_on_context' + t.index %w[tag_id taggable_id taggable_type context tagger_id tagger_type], name: 'taggings_idx', + unique: true + t.index ['tag_id'], name: 'index_taggings_on_tag_id' + t.index %w[taggable_id taggable_type context], name: 'taggings_taggable_context_idx' + t.index %w[taggable_id taggable_type tagger_id context], name: 'taggings_idy' + t.index ['taggable_id'], name: 'index_taggings_on_taggable_id' + t.index %w[taggable_type taggable_id], name: 'index_taggings_on_taggable_type_and_taggable_id' + t.index ['taggable_type'], name: 'index_taggings_on_taggable_type' + t.index %w[tagger_id tagger_type], name: 'index_taggings_on_tagger_id_and_tagger_type' + t.index ['tagger_id'], name: 'index_taggings_on_tagger_id' + t.index %w[tagger_type tagger_id], name: 'index_taggings_on_tagger_type_and_tagger_id' + t.index ['tenant'], name: 'index_taggings_on_tenant' + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 1c81149..c6de811 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_08_11_170021) do +ActiveRecord::Schema[7.2].define(version: 2024_11_01_181052) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -67,29 +65,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_08_11_170021) do t.datetime "updated_at", null: false end - create_table "taggings", force: :cascade do |t| - t.bigint "tag_id" - t.string "taggable_type" - t.uuid "taggable_id" - t.string "tagger_type" - t.bigint "tagger_id" - t.string "context", limit: 128 - t.datetime "created_at", precision: nil - t.string "tenant", limit: 128 - t.index ["context"], name: "index_taggings_on_context" - t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true - t.index ["tag_id"], name: "index_taggings_on_tag_id" - t.index ["taggable_id", "taggable_type", "context"], name: "taggings_taggable_context_idx" - t.index ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy" - t.index ["taggable_id"], name: "index_taggings_on_taggable_id" - t.index ["taggable_type", "taggable_id"], name: "index_taggings_on_taggable_type_and_taggable_id" - t.index ["taggable_type"], name: "index_taggings_on_taggable_type" - t.index ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type" - t.index ["tagger_id"], name: "index_taggings_on_tagger_id" - t.index ["tagger_type", "tagger_id"], name: "index_taggings_on_tagger_type_and_tagger_id" - t.index ["tenant"], name: "index_taggings_on_tenant" - end - create_table "tags", force: :cascade do |t| t.string "name" t.datetime "created_at", null: false @@ -102,5 +77,4 @@ ActiveRecord::Schema[7.1].define(version: 2024_08_11_170021) do add_foreign_key "guests", "groups" add_foreign_key "seats", "guests" add_foreign_key "seats", "tables_arrangements", on_delete: :cascade - add_foreign_key "taggings", "tags" end diff --git a/db/seeds.rb b/db/seeds.rb index 09d33f7..71b2a31 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,8 +5,6 @@ NUMBER_OF_GUESTS = 50 TablesArrangement.delete_all Expense.delete_all Guest.delete_all -ActsAsTaggableOn::Tagging.delete_all -ActsAsTaggableOn::Tag.delete_all Group.delete_all Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed') From eb85028eeabc55788e54793f2ef7630cd16205e3 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 1 Nov 2024 18:14:32 +0000 Subject: [PATCH 047/283] Add copyright notice --- db/migrate/20241101181052_drop_taggable_tables.rb | 2 ++ db/schema.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/db/migrate/20241101181052_drop_taggable_tables.rb b/db/migrate/20241101181052_drop_taggable_tables.rb index 73191e8..95b7cd1 100644 --- a/db/migrate/20241101181052_drop_taggable_tables.rb +++ b/db/migrate/20241101181052_drop_taggable_tables.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class DropTaggableTables < ActiveRecord::Migration[7.2] def change drop_table 'taggings', force: :cascade do |t| diff --git a/db/schema.rb b/db/schema.rb index c6de811..b2706f2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From bf970af2c503d163cf6fcd52368409c08d7fdb7b Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 1 Nov 2024 19:15:08 +0100 Subject: [PATCH 048/283] Remove tags table as well --- db/migrate/20241101181052_drop_taggable_tables.rb | 8 ++++++++ db/schema.rb | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/db/migrate/20241101181052_drop_taggable_tables.rb b/db/migrate/20241101181052_drop_taggable_tables.rb index 95b7cd1..cce88c7 100644 --- a/db/migrate/20241101181052_drop_taggable_tables.rb +++ b/db/migrate/20241101181052_drop_taggable_tables.rb @@ -25,5 +25,13 @@ class DropTaggableTables < ActiveRecord::Migration[7.2] t.index %w[tagger_type tagger_id], name: 'index_taggings_on_tagger_type_and_tagger_id' t.index ['tenant'], name: 'index_taggings_on_tenant' end + + drop_table "tags", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "taggings_count", default: 0 + t.index ["name"], name: "index_tags_on_name", unique: true + end end end diff --git a/db/schema.rb b/db/schema.rb index b2706f2..172be0b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -67,14 +67,6 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_01_181052) do t.datetime "updated_at", null: false end - create_table "tags", force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "taggings_count", default: 0 - t.index ["name"], name: "index_tags_on_name", unique: true - end - add_foreign_key "groups", "groups", column: "parent_id" add_foreign_key "guests", "groups" add_foreign_key "seats", "guests" From d4c1e5aab07314e0aeba04d6dc0e3c226fff2b03 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 2 Nov 2024 10:40:43 +0100 Subject: [PATCH 049/283] Rewrite table arrangements endpoints --- app/controllers/tables_arrangements_controller.rb | 7 +++++-- app/models/tables_arrangement.rb | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index 75451ca..c10e912 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -2,10 +2,13 @@ class TablesArrangementsController < ApplicationController def index - render json: TablesArrangement.all.order(discomfort: :asc).limit(10) + render json: TablesArrangement.all.order(discomfort: :asc).limit(10).as_json(only: %i[id discomfort]) end def show - render json: TablesArrangement.find(params[:id]) + Seat.joins(:guest).where(tables_arrangement_id: params[:id]) + .pluck(:table_number, Arel.sql("guests.first_name || ' ' ||guests.last_name ")) + .group_by(&:first).transform_values { |table| table.map(&:last) } + .then { |result| render json: result } end end diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index c3c0797..0ceb0cd 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -2,4 +2,5 @@ class TablesArrangement < ApplicationRecord has_many :seats + has_many :guests, through: :seats end From 612cb9a789df7face36bc0e738b3920e81604492 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 2 Nov 2024 11:23:00 +0100 Subject: [PATCH 050/283] Refine arrangement detail endpoint --- app/controllers/tables_arrangements_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index c10e912..8260feb 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -7,8 +7,10 @@ class TablesArrangementsController < ApplicationController def show Seat.joins(:guest).where(tables_arrangement_id: params[:id]) - .pluck(:table_number, Arel.sql("guests.first_name || ' ' ||guests.last_name ")) - .group_by(&:first).transform_values { |table| table.map(&:last) } + .pluck(:table_number, Arel.sql("guests.first_name || ' ' || guests.last_name "), 'guests.id') + .group_by(&:first) + .transform_values { |table| table.map { |(_, name, id)| { id:, name: } } } + .map { |number, guests| { number:, guests: } } .then { |result| render json: result } end end From d6182392f61ad779e2e5a5bee8cac44df12ecd5c Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 2 Nov 2024 12:50:45 +0100 Subject: [PATCH 051/283] Return only the top 3 arrangements --- app/controllers/tables_arrangements_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index 8260feb..a1d7420 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -2,7 +2,7 @@ class TablesArrangementsController < ApplicationController def index - render json: TablesArrangement.all.order(discomfort: :asc).limit(10).as_json(only: %i[id discomfort]) + render json: TablesArrangement.all.order(discomfort: :asc).limit(3).as_json(only: %i[id discomfort]) end def show From 066fdea5042f73ee959e2c39b0487b1b59dd5029 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 08:44:31 +0100 Subject: [PATCH 052/283] Assign a name to every tables arrangement --- Gemfile | 2 +- app/controllers/tables_arrangements_controller.rb | 2 +- app/models/tables_arrangement.rb | 8 ++++++++ .../20241103072808_add_name_to_tables_arrangements.rb | 5 +++++ db/schema.rb | 5 ++--- spec/models/tables_arrangement_spec.rb | 6 +++++- 6 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20241103072808_add_name_to_tables_arrangements.rb diff --git a/Gemfile b/Gemfile index b02355a..2724b02 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,7 @@ gem 'stimulus-rails' gem 'turbo-rails' gem 'tzinfo-data', platforms: %i[windows jruby] +gem 'faker' gem 'jsonapi-rails' gem 'rack-cors' gem 'react-rails' @@ -23,7 +24,6 @@ gem 'rubytree' group :development, :test do gem 'debug', platforms: %i[mri windows] gem 'factory_bot_rails' - gem 'faker' gem 'pry' gem 'rspec-rails', '~> 7.0.0' end diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index a1d7420..80935fd 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -2,7 +2,7 @@ class TablesArrangementsController < ApplicationController def index - render json: TablesArrangement.all.order(discomfort: :asc).limit(3).as_json(only: %i[id discomfort]) + render json: TablesArrangement.all.order(discomfort: :asc).limit(3).as_json(only: %i[id name discomfort]) end def show diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index 0ceb0cd..d1eba03 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -3,4 +3,12 @@ class TablesArrangement < ApplicationRecord has_many :seats has_many :guests, through: :seats + + before_create :assign_name + + private + + def assign_name + self.name = "#{Faker::Adjective.positive} #{Faker::Creature::Animal.name}".capitalize + end end diff --git a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb new file mode 100644 index 0000000..7f38f58 --- /dev/null +++ b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb @@ -0,0 +1,5 @@ +class AddNameToTablesArrangements < ActiveRecord::Migration[7.2] + def change + add_column :tables_arrangements, :name, :string, null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 172be0b..2655c6c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_11_01_181052) do +ActiveRecord::Schema[7.2].define(version: 2024_11_03_072808) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -65,6 +63,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_01_181052) do t.integer "discomfort" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "name", null: false end add_foreign_key "groups", "groups", column: "parent_id" diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index ab4677c..c15971a 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -3,5 +3,9 @@ require 'rails_helper' RSpec.describe TablesArrangement, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + describe 'callbacks' do + it 'assigns a name before creation' do + expect(described_class.create!.name).to be_present + end + end end From a1b5e55b390254a3ff9c5faf2a4a46ed3378efb0 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 08:59:56 +0100 Subject: [PATCH 053/283] Install solid queues framework --- Gemfile | 2 + Gemfile.lock | 14 ++ bin/jobs | 6 + config/application.rb | 3 + config/environments/production.rb | 2 - config/queue.yml | 18 +++ config/recurring.yml | 10 ++ .../20241103075705_solid_queue_install.rb | 132 ++++++++++++++++++ db/queue_schema.rb | 2 + db/schema.rb | 131 ++++++++++++++++- 10 files changed, 315 insertions(+), 5 deletions(-) create mode 100755 bin/jobs create mode 100644 config/queue.yml create mode 100644 config/recurring.yml create mode 100644 db/migrate/20241103075705_solid_queue_install.rb create mode 100644 db/queue_schema.rb diff --git a/Gemfile b/Gemfile index b02355a..3e3ace6 100644 --- a/Gemfile +++ b/Gemfile @@ -32,3 +32,5 @@ group :development do gem 'rubocop' gem 'web-console' end + +gem "solid_queue", "~> 1.0" diff --git a/Gemfile.lock b/Gemfile.lock index 34cdc5f..05575bf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,6 +96,8 @@ GEM diff-lcs (1.5.1) drb (2.2.1) erubi (1.13.0) + et-orbi (1.2.11) + tzinfo execjs (2.9.1) factory_bot (6.4.6) activesupport (>= 5.0.0) @@ -104,6 +106,9 @@ GEM railties (>= 5.0.0) faker (3.5.1) i18n (>= 1.8.11, < 2) + fugit (1.11.1) + et-orbi (~> 1, >= 1.2.11) + raabro (~> 1.4) globalid (1.2.1) activesupport (>= 6.1) i18n (1.14.6) @@ -182,6 +187,7 @@ GEM stringio puma (6.4.3) nio4r (~> 2.0) + raabro (1.4.0) racc (1.8.1) rack (3.1.8) rack-cors (2.0.2) @@ -272,6 +278,13 @@ GEM rubytree (2.1.0) json (~> 2.0, > 2.3.1) securerandom (0.3.1) + solid_queue (1.0.0) + activejob (>= 7.1) + activerecord (>= 7.1) + concurrent-ruby (>= 1.3.1) + fugit (~> 1.11.0) + railties (>= 7.1) + thor (~> 1.3.1) sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) @@ -331,6 +344,7 @@ DEPENDENCIES rspec-rails (~> 7.0.0) rubocop rubytree + solid_queue (~> 1.0) sprockets-rails stimulus-rails turbo-rails diff --git a/bin/jobs b/bin/jobs new file mode 100755 index 0000000..dcf59f3 --- /dev/null +++ b/bin/jobs @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby + +require_relative "../config/environment" +require "solid_queue/cli" + +SolidQueue::Cli.start(ARGV) diff --git a/config/application.rb b/config/application.rb index 2c1fa72..8233705 100644 --- a/config/application.rb +++ b/config/application.rb @@ -30,6 +30,9 @@ module WeddingPlanner # Common ones are `templates`, `generators`, or `middleware`, for example. config.autoload_lib(ignore: %w[assets tasks]) + # Use a real queuing backend for Active Job (and separate queues per environment). + config.active_job.queue_adapter = :solid_queue + # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files diff --git a/config/environments/production.rb b/config/environments/production.rb index eb6e7fa..94a2257 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -69,8 +69,6 @@ Rails.application.configure do # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Use a real queuing backend for Active Job (and separate queues per environment). - # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "wedding_planner_production" config.action_mailer.perform_caching = false diff --git a/config/queue.yml b/config/queue.yml new file mode 100644 index 0000000..9eace59 --- /dev/null +++ b/config/queue.yml @@ -0,0 +1,18 @@ +default: &default + dispatchers: + - polling_interval: 1 + batch_size: 500 + workers: + - queues: "*" + threads: 3 + processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %> + polling_interval: 0.1 + +development: + <<: *default + +test: + <<: *default + +production: + <<: *default diff --git a/config/recurring.yml b/config/recurring.yml new file mode 100644 index 0000000..d045b19 --- /dev/null +++ b/config/recurring.yml @@ -0,0 +1,10 @@ +# production: +# periodic_cleanup: +# class: CleanSoftDeletedRecordsJob +# queue: background +# args: [ 1000, { batch_size: 500 } ] +# schedule: every hour +# periodic_command: +# command: "SoftDeletedRecord.due.delete_all" +# priority: 2 +# schedule: at 5am every day diff --git a/db/migrate/20241103075705_solid_queue_install.rb b/db/migrate/20241103075705_solid_queue_install.rb new file mode 100644 index 0000000..4dfb4d0 --- /dev/null +++ b/db/migrate/20241103075705_solid_queue_install.rb @@ -0,0 +1,132 @@ +class SolidQueueInstall < ActiveRecord::Migration[7.2] + def change + create_table 'solid_queue_blocked_executions', force: :cascade do |t| + t.bigint 'job_id', null: false + t.string 'queue_name', null: false + t.integer 'priority', default: 0, null: false + t.string 'concurrency_key', null: false + t.datetime 'expires_at', null: false + t.datetime 'created_at', null: false + t.index %w[concurrency_key priority job_id], name: 'index_solid_queue_blocked_executions_for_release' + t.index %w[expires_at concurrency_key], name: 'index_solid_queue_blocked_executions_for_maintenance' + t.index ['job_id'], name: 'index_solid_queue_blocked_executions_on_job_id', unique: true + end + + create_table 'solid_queue_claimed_executions', force: :cascade do |t| + t.bigint 'job_id', null: false + t.bigint 'process_id' + t.datetime 'created_at', null: false + t.index ['job_id'], name: 'index_solid_queue_claimed_executions_on_job_id', unique: true + t.index %w[process_id job_id], name: 'index_solid_queue_claimed_executions_on_process_id_and_job_id' + end + + create_table 'solid_queue_failed_executions', force: :cascade do |t| + t.bigint 'job_id', null: false + t.text 'error' + t.datetime 'created_at', null: false + t.index ['job_id'], name: 'index_solid_queue_failed_executions_on_job_id', unique: true + end + + create_table 'solid_queue_jobs', force: :cascade do |t| + t.string 'queue_name', null: false + t.string 'class_name', null: false + t.text 'arguments' + t.integer 'priority', default: 0, null: false + t.string 'active_job_id' + t.datetime 'scheduled_at' + t.datetime 'finished_at' + t.string 'concurrency_key' + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.index ['active_job_id'], name: 'index_solid_queue_jobs_on_active_job_id' + t.index ['class_name'], name: 'index_solid_queue_jobs_on_class_name' + t.index ['finished_at'], name: 'index_solid_queue_jobs_on_finished_at' + t.index %w[queue_name finished_at], name: 'index_solid_queue_jobs_for_filtering' + t.index %w[scheduled_at finished_at], name: 'index_solid_queue_jobs_for_alerting' + end + + create_table 'solid_queue_pauses', force: :cascade do |t| + t.string 'queue_name', null: false + t.datetime 'created_at', null: false + t.index ['queue_name'], name: 'index_solid_queue_pauses_on_queue_name', unique: true + end + + create_table 'solid_queue_processes', force: :cascade do |t| + t.string 'kind', null: false + t.datetime 'last_heartbeat_at', null: false + t.bigint 'supervisor_id' + t.integer 'pid', null: false + t.string 'hostname' + t.text 'metadata' + t.datetime 'created_at', null: false + t.string 'name', null: false + t.index ['last_heartbeat_at'], name: 'index_solid_queue_processes_on_last_heartbeat_at' + t.index %w[name supervisor_id], name: 'index_solid_queue_processes_on_name_and_supervisor_id', unique: true + t.index ['supervisor_id'], name: 'index_solid_queue_processes_on_supervisor_id' + end + + create_table 'solid_queue_ready_executions', force: :cascade do |t| + t.bigint 'job_id', null: false + t.string 'queue_name', null: false + t.integer 'priority', default: 0, null: false + t.datetime 'created_at', null: false + t.index ['job_id'], name: 'index_solid_queue_ready_executions_on_job_id', unique: true + t.index %w[priority job_id], name: 'index_solid_queue_poll_all' + t.index %w[queue_name priority job_id], name: 'index_solid_queue_poll_by_queue' + end + + create_table 'solid_queue_recurring_executions', force: :cascade do |t| + t.bigint 'job_id', null: false + t.string 'task_key', null: false + t.datetime 'run_at', null: false + t.datetime 'created_at', null: false + t.index ['job_id'], name: 'index_solid_queue_recurring_executions_on_job_id', unique: true + t.index %w[task_key run_at], name: 'index_solid_queue_recurring_executions_on_task_key_and_run_at', + unique: true + end + + create_table 'solid_queue_recurring_tasks', force: :cascade do |t| + t.string 'key', null: false + t.string 'schedule', null: false + t.string 'command', limit: 2048 + t.string 'class_name' + t.text 'arguments' + t.string 'queue_name' + t.integer 'priority', default: 0 + t.boolean 'static', default: true, null: false + t.text 'description' + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.index ['key'], name: 'index_solid_queue_recurring_tasks_on_key', unique: true + t.index ['static'], name: 'index_solid_queue_recurring_tasks_on_static' + end + + create_table 'solid_queue_scheduled_executions', force: :cascade do |t| + t.bigint 'job_id', null: false + t.string 'queue_name', null: false + t.integer 'priority', default: 0, null: false + t.datetime 'scheduled_at', null: false + t.datetime 'created_at', null: false + t.index ['job_id'], name: 'index_solid_queue_scheduled_executions_on_job_id', unique: true + t.index %w[scheduled_at priority job_id], name: 'index_solid_queue_dispatch_all' + end + + create_table 'solid_queue_semaphores', force: :cascade do |t| + t.string 'key', null: false + t.integer 'value', default: 1, null: false + t.datetime 'expires_at', null: false + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.index ['expires_at'], name: 'index_solid_queue_semaphores_on_expires_at' + t.index %w[key value], name: 'index_solid_queue_semaphores_on_key_and_value' + t.index ['key'], name: 'index_solid_queue_semaphores_on_key', unique: true + end + + add_foreign_key 'solid_queue_blocked_executions', 'solid_queue_jobs', column: 'job_id', on_delete: :cascade + add_foreign_key 'solid_queue_claimed_executions', 'solid_queue_jobs', column: 'job_id', on_delete: :cascade + add_foreign_key 'solid_queue_failed_executions', 'solid_queue_jobs', column: 'job_id', on_delete: :cascade + add_foreign_key 'solid_queue_ready_executions', 'solid_queue_jobs', column: 'job_id', on_delete: :cascade + add_foreign_key 'solid_queue_recurring_executions', 'solid_queue_jobs', column: 'job_id', on_delete: :cascade + add_foreign_key 'solid_queue_scheduled_executions', 'solid_queue_jobs', column: 'job_id', on_delete: :cascade + end +end diff --git a/db/queue_schema.rb b/db/queue_schema.rb new file mode 100644 index 0000000..0cc657e --- /dev/null +++ b/db/queue_schema.rb @@ -0,0 +1,2 @@ +ActiveRecord::Schema[7.1].define(version: 1) do + end diff --git a/db/schema.rb b/db/schema.rb index 172be0b..c62ad16 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_11_01_181052) do +ActiveRecord::Schema[7.2].define(version: 2024_11_03_075705) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -61,6 +59,127 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_01_181052) do t.index ["tables_arrangement_id"], name: "index_seats_on_tables_arrangement_id" end + create_table "solid_queue_blocked_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.string "queue_name", null: false + t.integer "priority", default: 0, null: false + t.string "concurrency_key", null: false + t.datetime "expires_at", null: false + t.datetime "created_at", null: false + t.index ["concurrency_key", "priority", "job_id"], name: "index_solid_queue_blocked_executions_for_release" + t.index ["expires_at", "concurrency_key"], name: "index_solid_queue_blocked_executions_for_maintenance" + t.index ["job_id"], name: "index_solid_queue_blocked_executions_on_job_id", unique: true + end + + create_table "solid_queue_claimed_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.bigint "process_id" + t.datetime "created_at", null: false + t.index ["job_id"], name: "index_solid_queue_claimed_executions_on_job_id", unique: true + t.index ["process_id", "job_id"], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id" + end + + create_table "solid_queue_failed_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.text "error" + t.datetime "created_at", null: false + t.index ["job_id"], name: "index_solid_queue_failed_executions_on_job_id", unique: true + end + + create_table "solid_queue_jobs", force: :cascade do |t| + t.string "queue_name", null: false + t.string "class_name", null: false + t.text "arguments" + t.integer "priority", default: 0, null: false + t.string "active_job_id" + t.datetime "scheduled_at" + t.datetime "finished_at" + t.string "concurrency_key" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["active_job_id"], name: "index_solid_queue_jobs_on_active_job_id" + t.index ["class_name"], name: "index_solid_queue_jobs_on_class_name" + t.index ["finished_at"], name: "index_solid_queue_jobs_on_finished_at" + t.index ["queue_name", "finished_at"], name: "index_solid_queue_jobs_for_filtering" + t.index ["scheduled_at", "finished_at"], name: "index_solid_queue_jobs_for_alerting" + end + + create_table "solid_queue_pauses", force: :cascade do |t| + t.string "queue_name", null: false + t.datetime "created_at", null: false + t.index ["queue_name"], name: "index_solid_queue_pauses_on_queue_name", unique: true + end + + create_table "solid_queue_processes", force: :cascade do |t| + t.string "kind", null: false + t.datetime "last_heartbeat_at", null: false + t.bigint "supervisor_id" + t.integer "pid", null: false + t.string "hostname" + t.text "metadata" + t.datetime "created_at", null: false + t.string "name", null: false + t.index ["last_heartbeat_at"], name: "index_solid_queue_processes_on_last_heartbeat_at" + t.index ["name", "supervisor_id"], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true + t.index ["supervisor_id"], name: "index_solid_queue_processes_on_supervisor_id" + end + + create_table "solid_queue_ready_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.string "queue_name", null: false + t.integer "priority", default: 0, null: false + t.datetime "created_at", null: false + t.index ["job_id"], name: "index_solid_queue_ready_executions_on_job_id", unique: true + t.index ["priority", "job_id"], name: "index_solid_queue_poll_all" + t.index ["queue_name", "priority", "job_id"], name: "index_solid_queue_poll_by_queue" + end + + create_table "solid_queue_recurring_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.string "task_key", null: false + t.datetime "run_at", null: false + t.datetime "created_at", null: false + t.index ["job_id"], name: "index_solid_queue_recurring_executions_on_job_id", unique: true + t.index ["task_key", "run_at"], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true + end + + create_table "solid_queue_recurring_tasks", force: :cascade do |t| + t.string "key", null: false + t.string "schedule", null: false + t.string "command", limit: 2048 + t.string "class_name" + t.text "arguments" + t.string "queue_name" + t.integer "priority", default: 0 + t.boolean "static", default: true, null: false + t.text "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["key"], name: "index_solid_queue_recurring_tasks_on_key", unique: true + t.index ["static"], name: "index_solid_queue_recurring_tasks_on_static" + end + + create_table "solid_queue_scheduled_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.string "queue_name", null: false + t.integer "priority", default: 0, null: false + t.datetime "scheduled_at", null: false + t.datetime "created_at", null: false + t.index ["job_id"], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true + t.index ["scheduled_at", "priority", "job_id"], name: "index_solid_queue_dispatch_all" + end + + create_table "solid_queue_semaphores", force: :cascade do |t| + t.string "key", null: false + t.integer "value", default: 1, null: false + t.datetime "expires_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["expires_at"], name: "index_solid_queue_semaphores_on_expires_at" + t.index ["key", "value"], name: "index_solid_queue_semaphores_on_key_and_value" + t.index ["key"], name: "index_solid_queue_semaphores_on_key", unique: true + end + create_table "tables_arrangements", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.integer "discomfort" t.datetime "created_at", null: false @@ -71,4 +190,10 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_01_181052) do add_foreign_key "guests", "groups" add_foreign_key "seats", "guests" add_foreign_key "seats", "tables_arrangements", on_delete: :cascade + add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade end From 8d83c63fa680e6bce3d53386f47d0912a7cbee83 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 08:01:59 +0000 Subject: [PATCH 054/283] Add copyright notice --- db/migrate/20241103075705_solid_queue_install.rb | 2 ++ db/queue_schema.rb | 2 ++ db/schema.rb | 2 ++ 3 files changed, 6 insertions(+) diff --git a/db/migrate/20241103075705_solid_queue_install.rb b/db/migrate/20241103075705_solid_queue_install.rb index 4dfb4d0..3a0b744 100644 --- a/db/migrate/20241103075705_solid_queue_install.rb +++ b/db/migrate/20241103075705_solid_queue_install.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class SolidQueueInstall < ActiveRecord::Migration[7.2] def change create_table 'solid_queue_blocked_executions', force: :cascade do |t| diff --git a/db/queue_schema.rb b/db/queue_schema.rb index 0cc657e..24748f4 100644 --- a/db/queue_schema.rb +++ b/db/queue_schema.rb @@ -1,2 +1,4 @@ +# Copyright (C) 2024 Manuel Bustillo + ActiveRecord::Schema[7.1].define(version: 1) do end diff --git a/db/schema.rb b/db/schema.rb index c62ad16..c4f1c20 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From 1f919644a3f207246016aeba7ca5fc58fd4c13de Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 09:05:51 +0100 Subject: [PATCH 055/283] Define a job to generate table simulations --- app/jobs/table_simulator_job.rb | 20 ++++++++++++++++++++ lib/tasks/vns.rake | 15 +-------------- 2 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 app/jobs/table_simulator_job.rb diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb new file mode 100644 index 0000000..574c4a5 --- /dev/null +++ b/app/jobs/table_simulator_job.rb @@ -0,0 +1,20 @@ +class TableSimulatorJob < ApplicationJob + queue_as :default + + def perform(*_args) + engine = VNS::Engine.new + + engine.add_perturbation(Tables::Swap) + + initial_solution = Tables::Distribution.new(min_per_table: 8, max_per_table: 10) + initial_solution.random_distribution(Guest.all.shuffle) + + engine.initial_solution = initial_solution + + engine.target_function(&:discomfort) + + best_solution = engine.run + + best_solution.save! + end +end diff --git a/lib/tasks/vns.rake b/lib/tasks/vns.rake index c8e6b50..d3a31d0 100644 --- a/lib/tasks/vns.rake +++ b/lib/tasks/vns.rake @@ -1,18 +1,5 @@ namespace :vns do task distribute_tables: :environment do - engine = VNS::Engine.new - - engine.add_perturbation(Tables::Swap) - - initial_solution = Tables::Distribution.new(min_per_table: 8, max_per_table: 10) - initial_solution.random_distribution(Guest.all.shuffle) - - engine.initial_solution = initial_solution - - engine.target_function(&:discomfort) - - best_solution = engine.run - - best_solution.save! + end end From d15096b3a7a048733f4e36f8ad362b29256707f1 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 08:59:56 +0100 Subject: [PATCH 056/283] Install solid queues framework --- Gemfile | 2 + Gemfile.lock | 14 ++ bin/jobs | 6 + config/application.rb | 3 + config/environments/production.rb | 2 - config/queue.yml | 18 +++ config/recurring.yml | 10 ++ .../20241103075705_solid_queue_install.rb | 132 ++++++++++++++++++ db/queue_schema.rb | 2 + db/schema.rb | 129 ++++++++++++++++- 10 files changed, 315 insertions(+), 3 deletions(-) create mode 100755 bin/jobs create mode 100644 config/queue.yml create mode 100644 config/recurring.yml create mode 100644 db/migrate/20241103075705_solid_queue_install.rb create mode 100644 db/queue_schema.rb diff --git a/Gemfile b/Gemfile index 2724b02..f61ed2f 100644 --- a/Gemfile +++ b/Gemfile @@ -32,3 +32,5 @@ group :development do gem 'rubocop' gem 'web-console' end + +gem "solid_queue", "~> 1.0" diff --git a/Gemfile.lock b/Gemfile.lock index 34cdc5f..05575bf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,6 +96,8 @@ GEM diff-lcs (1.5.1) drb (2.2.1) erubi (1.13.0) + et-orbi (1.2.11) + tzinfo execjs (2.9.1) factory_bot (6.4.6) activesupport (>= 5.0.0) @@ -104,6 +106,9 @@ GEM railties (>= 5.0.0) faker (3.5.1) i18n (>= 1.8.11, < 2) + fugit (1.11.1) + et-orbi (~> 1, >= 1.2.11) + raabro (~> 1.4) globalid (1.2.1) activesupport (>= 6.1) i18n (1.14.6) @@ -182,6 +187,7 @@ GEM stringio puma (6.4.3) nio4r (~> 2.0) + raabro (1.4.0) racc (1.8.1) rack (3.1.8) rack-cors (2.0.2) @@ -272,6 +278,13 @@ GEM rubytree (2.1.0) json (~> 2.0, > 2.3.1) securerandom (0.3.1) + solid_queue (1.0.0) + activejob (>= 7.1) + activerecord (>= 7.1) + concurrent-ruby (>= 1.3.1) + fugit (~> 1.11.0) + railties (>= 7.1) + thor (~> 1.3.1) sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) @@ -331,6 +344,7 @@ DEPENDENCIES rspec-rails (~> 7.0.0) rubocop rubytree + solid_queue (~> 1.0) sprockets-rails stimulus-rails turbo-rails diff --git a/bin/jobs b/bin/jobs new file mode 100755 index 0000000..dcf59f3 --- /dev/null +++ b/bin/jobs @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby + +require_relative "../config/environment" +require "solid_queue/cli" + +SolidQueue::Cli.start(ARGV) diff --git a/config/application.rb b/config/application.rb index 2c1fa72..8233705 100644 --- a/config/application.rb +++ b/config/application.rb @@ -30,6 +30,9 @@ module WeddingPlanner # Common ones are `templates`, `generators`, or `middleware`, for example. config.autoload_lib(ignore: %w[assets tasks]) + # Use a real queuing backend for Active Job (and separate queues per environment). + config.active_job.queue_adapter = :solid_queue + # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files diff --git a/config/environments/production.rb b/config/environments/production.rb index eb6e7fa..94a2257 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -69,8 +69,6 @@ Rails.application.configure do # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Use a real queuing backend for Active Job (and separate queues per environment). - # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "wedding_planner_production" config.action_mailer.perform_caching = false diff --git a/config/queue.yml b/config/queue.yml new file mode 100644 index 0000000..9eace59 --- /dev/null +++ b/config/queue.yml @@ -0,0 +1,18 @@ +default: &default + dispatchers: + - polling_interval: 1 + batch_size: 500 + workers: + - queues: "*" + threads: 3 + processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %> + polling_interval: 0.1 + +development: + <<: *default + +test: + <<: *default + +production: + <<: *default diff --git a/config/recurring.yml b/config/recurring.yml new file mode 100644 index 0000000..d045b19 --- /dev/null +++ b/config/recurring.yml @@ -0,0 +1,10 @@ +# production: +# periodic_cleanup: +# class: CleanSoftDeletedRecordsJob +# queue: background +# args: [ 1000, { batch_size: 500 } ] +# schedule: every hour +# periodic_command: +# command: "SoftDeletedRecord.due.delete_all" +# priority: 2 +# schedule: at 5am every day diff --git a/db/migrate/20241103075705_solid_queue_install.rb b/db/migrate/20241103075705_solid_queue_install.rb new file mode 100644 index 0000000..4dfb4d0 --- /dev/null +++ b/db/migrate/20241103075705_solid_queue_install.rb @@ -0,0 +1,132 @@ +class SolidQueueInstall < ActiveRecord::Migration[7.2] + def change + create_table 'solid_queue_blocked_executions', force: :cascade do |t| + t.bigint 'job_id', null: false + t.string 'queue_name', null: false + t.integer 'priority', default: 0, null: false + t.string 'concurrency_key', null: false + t.datetime 'expires_at', null: false + t.datetime 'created_at', null: false + t.index %w[concurrency_key priority job_id], name: 'index_solid_queue_blocked_executions_for_release' + t.index %w[expires_at concurrency_key], name: 'index_solid_queue_blocked_executions_for_maintenance' + t.index ['job_id'], name: 'index_solid_queue_blocked_executions_on_job_id', unique: true + end + + create_table 'solid_queue_claimed_executions', force: :cascade do |t| + t.bigint 'job_id', null: false + t.bigint 'process_id' + t.datetime 'created_at', null: false + t.index ['job_id'], name: 'index_solid_queue_claimed_executions_on_job_id', unique: true + t.index %w[process_id job_id], name: 'index_solid_queue_claimed_executions_on_process_id_and_job_id' + end + + create_table 'solid_queue_failed_executions', force: :cascade do |t| + t.bigint 'job_id', null: false + t.text 'error' + t.datetime 'created_at', null: false + t.index ['job_id'], name: 'index_solid_queue_failed_executions_on_job_id', unique: true + end + + create_table 'solid_queue_jobs', force: :cascade do |t| + t.string 'queue_name', null: false + t.string 'class_name', null: false + t.text 'arguments' + t.integer 'priority', default: 0, null: false + t.string 'active_job_id' + t.datetime 'scheduled_at' + t.datetime 'finished_at' + t.string 'concurrency_key' + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.index ['active_job_id'], name: 'index_solid_queue_jobs_on_active_job_id' + t.index ['class_name'], name: 'index_solid_queue_jobs_on_class_name' + t.index ['finished_at'], name: 'index_solid_queue_jobs_on_finished_at' + t.index %w[queue_name finished_at], name: 'index_solid_queue_jobs_for_filtering' + t.index %w[scheduled_at finished_at], name: 'index_solid_queue_jobs_for_alerting' + end + + create_table 'solid_queue_pauses', force: :cascade do |t| + t.string 'queue_name', null: false + t.datetime 'created_at', null: false + t.index ['queue_name'], name: 'index_solid_queue_pauses_on_queue_name', unique: true + end + + create_table 'solid_queue_processes', force: :cascade do |t| + t.string 'kind', null: false + t.datetime 'last_heartbeat_at', null: false + t.bigint 'supervisor_id' + t.integer 'pid', null: false + t.string 'hostname' + t.text 'metadata' + t.datetime 'created_at', null: false + t.string 'name', null: false + t.index ['last_heartbeat_at'], name: 'index_solid_queue_processes_on_last_heartbeat_at' + t.index %w[name supervisor_id], name: 'index_solid_queue_processes_on_name_and_supervisor_id', unique: true + t.index ['supervisor_id'], name: 'index_solid_queue_processes_on_supervisor_id' + end + + create_table 'solid_queue_ready_executions', force: :cascade do |t| + t.bigint 'job_id', null: false + t.string 'queue_name', null: false + t.integer 'priority', default: 0, null: false + t.datetime 'created_at', null: false + t.index ['job_id'], name: 'index_solid_queue_ready_executions_on_job_id', unique: true + t.index %w[priority job_id], name: 'index_solid_queue_poll_all' + t.index %w[queue_name priority job_id], name: 'index_solid_queue_poll_by_queue' + end + + create_table 'solid_queue_recurring_executions', force: :cascade do |t| + t.bigint 'job_id', null: false + t.string 'task_key', null: false + t.datetime 'run_at', null: false + t.datetime 'created_at', null: false + t.index ['job_id'], name: 'index_solid_queue_recurring_executions_on_job_id', unique: true + t.index %w[task_key run_at], name: 'index_solid_queue_recurring_executions_on_task_key_and_run_at', + unique: true + end + + create_table 'solid_queue_recurring_tasks', force: :cascade do |t| + t.string 'key', null: false + t.string 'schedule', null: false + t.string 'command', limit: 2048 + t.string 'class_name' + t.text 'arguments' + t.string 'queue_name' + t.integer 'priority', default: 0 + t.boolean 'static', default: true, null: false + t.text 'description' + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.index ['key'], name: 'index_solid_queue_recurring_tasks_on_key', unique: true + t.index ['static'], name: 'index_solid_queue_recurring_tasks_on_static' + end + + create_table 'solid_queue_scheduled_executions', force: :cascade do |t| + t.bigint 'job_id', null: false + t.string 'queue_name', null: false + t.integer 'priority', default: 0, null: false + t.datetime 'scheduled_at', null: false + t.datetime 'created_at', null: false + t.index ['job_id'], name: 'index_solid_queue_scheduled_executions_on_job_id', unique: true + t.index %w[scheduled_at priority job_id], name: 'index_solid_queue_dispatch_all' + end + + create_table 'solid_queue_semaphores', force: :cascade do |t| + t.string 'key', null: false + t.integer 'value', default: 1, null: false + t.datetime 'expires_at', null: false + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.index ['expires_at'], name: 'index_solid_queue_semaphores_on_expires_at' + t.index %w[key value], name: 'index_solid_queue_semaphores_on_key_and_value' + t.index ['key'], name: 'index_solid_queue_semaphores_on_key', unique: true + end + + add_foreign_key 'solid_queue_blocked_executions', 'solid_queue_jobs', column: 'job_id', on_delete: :cascade + add_foreign_key 'solid_queue_claimed_executions', 'solid_queue_jobs', column: 'job_id', on_delete: :cascade + add_foreign_key 'solid_queue_failed_executions', 'solid_queue_jobs', column: 'job_id', on_delete: :cascade + add_foreign_key 'solid_queue_ready_executions', 'solid_queue_jobs', column: 'job_id', on_delete: :cascade + add_foreign_key 'solid_queue_recurring_executions', 'solid_queue_jobs', column: 'job_id', on_delete: :cascade + add_foreign_key 'solid_queue_scheduled_executions', 'solid_queue_jobs', column: 'job_id', on_delete: :cascade + end +end diff --git a/db/queue_schema.rb b/db/queue_schema.rb new file mode 100644 index 0000000..0cc657e --- /dev/null +++ b/db/queue_schema.rb @@ -0,0 +1,2 @@ +ActiveRecord::Schema[7.1].define(version: 1) do + end diff --git a/db/schema.rb b/db/schema.rb index 2655c6c..2c053f9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_11_03_072808) do +ActiveRecord::Schema[7.2].define(version: 2024_11_03_075705) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -59,6 +59,127 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_03_072808) do t.index ["tables_arrangement_id"], name: "index_seats_on_tables_arrangement_id" end + create_table "solid_queue_blocked_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.string "queue_name", null: false + t.integer "priority", default: 0, null: false + t.string "concurrency_key", null: false + t.datetime "expires_at", null: false + t.datetime "created_at", null: false + t.index ["concurrency_key", "priority", "job_id"], name: "index_solid_queue_blocked_executions_for_release" + t.index ["expires_at", "concurrency_key"], name: "index_solid_queue_blocked_executions_for_maintenance" + t.index ["job_id"], name: "index_solid_queue_blocked_executions_on_job_id", unique: true + end + + create_table "solid_queue_claimed_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.bigint "process_id" + t.datetime "created_at", null: false + t.index ["job_id"], name: "index_solid_queue_claimed_executions_on_job_id", unique: true + t.index ["process_id", "job_id"], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id" + end + + create_table "solid_queue_failed_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.text "error" + t.datetime "created_at", null: false + t.index ["job_id"], name: "index_solid_queue_failed_executions_on_job_id", unique: true + end + + create_table "solid_queue_jobs", force: :cascade do |t| + t.string "queue_name", null: false + t.string "class_name", null: false + t.text "arguments" + t.integer "priority", default: 0, null: false + t.string "active_job_id" + t.datetime "scheduled_at" + t.datetime "finished_at" + t.string "concurrency_key" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["active_job_id"], name: "index_solid_queue_jobs_on_active_job_id" + t.index ["class_name"], name: "index_solid_queue_jobs_on_class_name" + t.index ["finished_at"], name: "index_solid_queue_jobs_on_finished_at" + t.index ["queue_name", "finished_at"], name: "index_solid_queue_jobs_for_filtering" + t.index ["scheduled_at", "finished_at"], name: "index_solid_queue_jobs_for_alerting" + end + + create_table "solid_queue_pauses", force: :cascade do |t| + t.string "queue_name", null: false + t.datetime "created_at", null: false + t.index ["queue_name"], name: "index_solid_queue_pauses_on_queue_name", unique: true + end + + create_table "solid_queue_processes", force: :cascade do |t| + t.string "kind", null: false + t.datetime "last_heartbeat_at", null: false + t.bigint "supervisor_id" + t.integer "pid", null: false + t.string "hostname" + t.text "metadata" + t.datetime "created_at", null: false + t.string "name", null: false + t.index ["last_heartbeat_at"], name: "index_solid_queue_processes_on_last_heartbeat_at" + t.index ["name", "supervisor_id"], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true + t.index ["supervisor_id"], name: "index_solid_queue_processes_on_supervisor_id" + end + + create_table "solid_queue_ready_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.string "queue_name", null: false + t.integer "priority", default: 0, null: false + t.datetime "created_at", null: false + t.index ["job_id"], name: "index_solid_queue_ready_executions_on_job_id", unique: true + t.index ["priority", "job_id"], name: "index_solid_queue_poll_all" + t.index ["queue_name", "priority", "job_id"], name: "index_solid_queue_poll_by_queue" + end + + create_table "solid_queue_recurring_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.string "task_key", null: false + t.datetime "run_at", null: false + t.datetime "created_at", null: false + t.index ["job_id"], name: "index_solid_queue_recurring_executions_on_job_id", unique: true + t.index ["task_key", "run_at"], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true + end + + create_table "solid_queue_recurring_tasks", force: :cascade do |t| + t.string "key", null: false + t.string "schedule", null: false + t.string "command", limit: 2048 + t.string "class_name" + t.text "arguments" + t.string "queue_name" + t.integer "priority", default: 0 + t.boolean "static", default: true, null: false + t.text "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["key"], name: "index_solid_queue_recurring_tasks_on_key", unique: true + t.index ["static"], name: "index_solid_queue_recurring_tasks_on_static" + end + + create_table "solid_queue_scheduled_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.string "queue_name", null: false + t.integer "priority", default: 0, null: false + t.datetime "scheduled_at", null: false + t.datetime "created_at", null: false + t.index ["job_id"], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true + t.index ["scheduled_at", "priority", "job_id"], name: "index_solid_queue_dispatch_all" + end + + create_table "solid_queue_semaphores", force: :cascade do |t| + t.string "key", null: false + t.integer "value", default: 1, null: false + t.datetime "expires_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["expires_at"], name: "index_solid_queue_semaphores_on_expires_at" + t.index ["key", "value"], name: "index_solid_queue_semaphores_on_key_and_value" + t.index ["key"], name: "index_solid_queue_semaphores_on_key", unique: true + end + create_table "tables_arrangements", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.integer "discomfort" t.datetime "created_at", null: false @@ -70,4 +191,10 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_03_072808) do add_foreign_key "guests", "groups" add_foreign_key "seats", "guests" add_foreign_key "seats", "tables_arrangements", on_delete: :cascade + add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade end From 3be71406f85135104a96eda56b3406718b43d437 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 08:01:59 +0000 Subject: [PATCH 057/283] Add copyright notice --- db/migrate/20241103075705_solid_queue_install.rb | 2 ++ db/queue_schema.rb | 2 ++ db/schema.rb | 2 ++ 3 files changed, 6 insertions(+) diff --git a/db/migrate/20241103075705_solid_queue_install.rb b/db/migrate/20241103075705_solid_queue_install.rb index 4dfb4d0..3a0b744 100644 --- a/db/migrate/20241103075705_solid_queue_install.rb +++ b/db/migrate/20241103075705_solid_queue_install.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class SolidQueueInstall < ActiveRecord::Migration[7.2] def change create_table 'solid_queue_blocked_executions', force: :cascade do |t| diff --git a/db/queue_schema.rb b/db/queue_schema.rb index 0cc657e..24748f4 100644 --- a/db/queue_schema.rb +++ b/db/queue_schema.rb @@ -1,2 +1,4 @@ +# Copyright (C) 2024 Manuel Bustillo + ActiveRecord::Schema[7.1].define(version: 1) do end diff --git a/db/schema.rb b/db/schema.rb index 2c053f9..0e3974d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From 8d09fd733facd8fb7f83a6b33371099782a4ff63 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 09:05:51 +0100 Subject: [PATCH 058/283] Define a job to generate table simulations --- app/jobs/table_simulator_job.rb | 20 ++++++++++++++++++++ lib/tasks/vns.rake | 15 +-------------- 2 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 app/jobs/table_simulator_job.rb diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb new file mode 100644 index 0000000..574c4a5 --- /dev/null +++ b/app/jobs/table_simulator_job.rb @@ -0,0 +1,20 @@ +class TableSimulatorJob < ApplicationJob + queue_as :default + + def perform(*_args) + engine = VNS::Engine.new + + engine.add_perturbation(Tables::Swap) + + initial_solution = Tables::Distribution.new(min_per_table: 8, max_per_table: 10) + initial_solution.random_distribution(Guest.all.shuffle) + + engine.initial_solution = initial_solution + + engine.target_function(&:discomfort) + + best_solution = engine.run + + best_solution.save! + end +end diff --git a/lib/tasks/vns.rake b/lib/tasks/vns.rake index c8e6b50..d3a31d0 100644 --- a/lib/tasks/vns.rake +++ b/lib/tasks/vns.rake @@ -1,18 +1,5 @@ namespace :vns do task distribute_tables: :environment do - engine = VNS::Engine.new - - engine.add_perturbation(Tables::Swap) - - initial_solution = Tables::Distribution.new(min_per_table: 8, max_per_table: 10) - initial_solution.random_distribution(Guest.all.shuffle) - - engine.initial_solution = initial_solution - - engine.target_function(&:discomfort) - - best_solution = engine.run - - best_solution.save! + end end From 15a5c51fb62d810030f204a947b45953e48a1871 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 08:12:24 +0000 Subject: [PATCH 059/283] Add copyright notice --- app/jobs/table_simulator_job.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index 574c4a5..c382b1a 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class TableSimulatorJob < ApplicationJob queue_as :default From 50a5c90728f7dda18be80391d22570828173686a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 09:15:48 +0100 Subject: [PATCH 060/283] Only include potential guests in the simulation --- app/jobs/table_simulator_job.rb | 2 +- app/models/guest.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index 574c4a5..f0e99f0 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -7,7 +7,7 @@ class TableSimulatorJob < ApplicationJob engine.add_perturbation(Tables::Swap) initial_solution = Tables::Distribution.new(min_per_table: 8, max_per_table: 10) - initial_solution.random_distribution(Guest.all.shuffle) + initial_solution.random_distribution(Guest.potential.shuffle) engine.initial_solution = initial_solution diff --git a/app/models/guest.rb b/app/models/guest.rb index 39d27b3..87680bf 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -8,9 +8,11 @@ class Guest < ApplicationRecord invited: 10, confirmed: 20, declined: 30, - tentative: 40, + tentative: 40 } + scope :potential, -> { where.not(status: %i[declined considered]) } + def full_name "#{first_name} #{last_name}" end From 35bf272ac8ca4ded4c6090aaa4a9d8a5e417eae5 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 09:25:50 +0100 Subject: [PATCH 061/283] Restart simulations whenever a guest changes their invitation status --- app/controllers/guests_controller.rb | 2 +- app/use_cases/guests/update_use_case.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 app/use_cases/guests/update_use_case.rb diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index ecf5d34..de6127d 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -26,7 +26,7 @@ class GuestsController < ApplicationController end def bulk_update - Guest.where(id: params[:guest_ids]).update!(params.require(:properties).permit(:status)) + Guests::UpdateUseCase.new(guest_ids: params[:guest_ids], params: params.require(:properties).permit(:status)).call render json: {}, status: :ok end end diff --git a/app/use_cases/guests/update_use_case.rb b/app/use_cases/guests/update_use_case.rb new file mode 100644 index 0000000..bcd4f3e --- /dev/null +++ b/app/use_cases/guests/update_use_case.rb @@ -0,0 +1,12 @@ +module Guests + class UpdateUseCase + def initialize(guest_ids:, params:) + Guest.where(id: guest_ids).update!(params) + + # TODO: Not all status transitions may require a table re-arrangement + TablesArrangement.delete_all + + ActiveJob.perform_all_later(50.times.map { TableSimulatorJob.new }) + end + end +end From 33434db3f2c506d8c06272d5a0a8b05836b44c28 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 09:31:10 +0100 Subject: [PATCH 062/283] Stop redundant builds --- .github/workflows/build.yml | 3 +++ .github/workflows/copyright_notice.yml | 3 +++ .github/workflows/tests.yml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16e72bb..5edde29 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,9 @@ on: branches: - main pull_request: +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true jobs: build-static-assets: runs-on: ubuntu-latest diff --git a/.github/workflows/copyright_notice.yml b/.github/workflows/copyright_notice.yml index c97e035..35d8b8d 100644 --- a/.github/workflows/copyright_notice.yml +++ b/.github/workflows/copyright_notice.yml @@ -3,6 +3,9 @@ on: pull_request: permissions: contents: write +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true jobs: copyright_notice: runs-on: ubuntu-latest diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e4d4fec..9f2572f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,6 +4,9 @@ on: branches: - main pull_request: +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true jobs: unit_tests: runs-on: ubuntu-latest From 86e982164d3f5a65e5ecc78d79a18e765c6b7f31 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 08:31:58 +0000 Subject: [PATCH 063/283] Add copyright notice --- app/jobs/table_simulator_job.rb | 2 ++ app/use_cases/guests/update_use_case.rb | 2 ++ db/migrate/20241103072808_add_name_to_tables_arrangements.rb | 2 ++ 3 files changed, 6 insertions(+) diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index f0e99f0..0b90396 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class TableSimulatorJob < ApplicationJob queue_as :default diff --git a/app/use_cases/guests/update_use_case.rb b/app/use_cases/guests/update_use_case.rb index bcd4f3e..9a5cc66 100644 --- a/app/use_cases/guests/update_use_case.rb +++ b/app/use_cases/guests/update_use_case.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module Guests class UpdateUseCase def initialize(guest_ids:, params:) diff --git a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb index 7f38f58..53dd4fa 100644 --- a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb +++ b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class AddNameToTablesArrangements < ActiveRecord::Migration[7.2] def change add_column :tables_arrangements, :name, :string, null: false From 56a8be21cc3729cc893b27ee95b9d402e6e1a3f2 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 09:38:51 +0100 Subject: [PATCH 064/283] Include a step to verify nonfree dependencies are not committed --- .github/workflows/license_finder.yml | 23 ++++++++ doc/dependency_decisions.yml | 85 ++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 .github/workflows/license_finder.yml create mode 100644 doc/dependency_decisions.yml diff --git a/.github/workflows/license_finder.yml b/.github/workflows/license_finder.yml new file mode 100644 index 0000000..19cadd4 --- /dev/null +++ b/.github/workflows/license_finder.yml @@ -0,0 +1,23 @@ +name: Check usage of free licenses +on: + push: + branches: + - main + pull_request: +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true +jobs: + build-static-assets: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + - name: Install license finder gem + run: gem install license_finder + - name: Run license finder + run: license_finder diff --git a/doc/dependency_decisions.yml b/doc/dependency_decisions.yml new file mode 100644 index 0000000..290404e --- /dev/null +++ b/doc/dependency_decisions.yml @@ -0,0 +1,85 @@ +--- +- - :permit + - MIT + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:45:36.831184284 Z +- - :permit + - ISC + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:48:14.527140943 Z +- - :permit + - Apache 2.0 + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:48:23.863998708 Z +- - :permit + - Simplified BSD + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:49:01.330574375 Z +- - :permit + - New BSD + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:49:53.995999923 Z +- - :permit + - LGPL-3.0-or-later + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:51:16.274818102 Z +- - :permit + - Python-2.0 + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:51:32.610018037 Z +- - :permit + - BlueOak-1.0.0 + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:52:28.568966565 Z +- - :permit + - BSD + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:52:37.235297087 Z +- - :permit + - The Unlicense + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:52:49.646463302 Z +- - :permit + - CC-BY-4.0 + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:54:29.363007852 Z +- - :permit + - "(MIT AND Zlib)" + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:54:49.936741134 Z +- - :permit + - BSD Zero Clause License + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:55:31.968339009 Z +- - :permit + - Artistic-2.0 + - :who: + :why: + :versions: [] + :when: 2024-10-25 17:55:52.371898047 Z From 4f133ac3f5568ff40f77038d38d0ab69a31e29e8 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 09:40:57 +0100 Subject: [PATCH 065/283] Configure a build timeout of 30 minutes --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16e72bb..342ba24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,7 @@ on: jobs: build-static-assets: runs-on: ubuntu-latest + timeout-minutes: 30 steps: - uses: actions/checkout@v4 with: From 22fbdf5ca3019b5d1a61bef47d9b7e161e12b76a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 10:07:08 +0100 Subject: [PATCH 066/283] Stop building docker images on PR --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16e72bb..3482b99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,6 @@ on: push: branches: - main - pull_request: jobs: build-static-assets: runs-on: ubuntu-latest From f21aaa37233646be34428d665c54fbfc464e1050 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 10:41:45 +0100 Subject: [PATCH 067/283] Remove the email property from the guest model --- app/serializers/serializable_guest.rb | 2 +- db/migrate/20241103093955_remove_email_from_guests.rb | 5 +++++ db/schema.rb | 5 +---- db/seeds.rb | 1 - spec/factories/guest.rb | 1 - 5 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20241103093955_remove_email_from_guests.rb diff --git a/app/serializers/serializable_guest.rb b/app/serializers/serializable_guest.rb index b8d9347..d711d03 100644 --- a/app/serializers/serializable_guest.rb +++ b/app/serializers/serializable_guest.rb @@ -3,7 +3,7 @@ class SerializableGuest < JSONAPI::Serializable::Resource type 'guest' - attributes :id, :email, :group_id, :status + attributes :id, :group_id, :status attribute :name do "#{@object.first_name} #{@object.last_name}" diff --git a/db/migrate/20241103093955_remove_email_from_guests.rb b/db/migrate/20241103093955_remove_email_from_guests.rb new file mode 100644 index 0000000..f09bced --- /dev/null +++ b/db/migrate/20241103093955_remove_email_from_guests.rb @@ -0,0 +1,5 @@ +class RemoveEmailFromGuests < ActiveRecord::Migration[7.2] + def change + remove_column :guests, :email, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 172be0b..0ee5240 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_11_01_181052) do +ActiveRecord::Schema[7.2].define(version: 2024_11_03_093955) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -42,7 +40,6 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_01_181052) do create_table "guests", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "first_name" t.string "last_name" - t.string "email" t.string "phone" t.datetime "created_at", null: false t.datetime "updated_at", null: false diff --git a/db/seeds.rb b/db/seeds.rb index 71b2a31..ec78d0c 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -58,7 +58,6 @@ NUMBER_OF_GUESTS.times do Guest.create!( first_name: Faker::Name.first_name, last_name: Faker::Name.last_name, - email: Faker::Internet.email, phone: Faker::PhoneNumber.cell_phone, group: groups.sample, status: Guest.statuses.keys.sample diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index 688cdea..2637fb4 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -6,7 +6,6 @@ FactoryBot.define do first_name { Faker::Name.first_name } last_name { Faker::Name.last_name } - email { Faker::Internet.email } phone { Faker::PhoneNumber.cell_phone } end end From c08f7bd37c67f2dd8253eebd212cb2ae1e6fb428 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 10:03:47 +0000 Subject: [PATCH 068/283] Add copyright notice --- db/migrate/20241103093955_remove_email_from_guests.rb | 2 ++ db/schema.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/db/migrate/20241103093955_remove_email_from_guests.rb b/db/migrate/20241103093955_remove_email_from_guests.rb index f09bced..26ca939 100644 --- a/db/migrate/20241103093955_remove_email_from_guests.rb +++ b/db/migrate/20241103093955_remove_email_from_guests.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class RemoveEmailFromGuests < ActiveRecord::Migration[7.2] def change remove_column :guests, :email, :string diff --git a/db/schema.rb b/db/schema.rb index 0ee5240..39cc112 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From 2fd4549b0091c4ce92600f0d13382f917af22ec1 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 10:47:26 +0000 Subject: [PATCH 069/283] Add copyright notice --- db/migrate/20241103072808_add_name_to_tables_arrangements.rb | 2 ++ db/schema.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb index 7f38f58..53dd4fa 100644 --- a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb +++ b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class AddNameToTablesArrangements < ActiveRecord::Migration[7.2] def change add_column :tables_arrangements, :name, :string, null: false diff --git a/db/schema.rb b/db/schema.rb index 5ae1725..12c1307 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From 89d9f722e17445615a6e3f44455a2e9806933c32 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 11:58:53 +0100 Subject: [PATCH 070/283] Add ruby to the list of permitted licenses --- doc/dependency_decisions.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/dependency_decisions.yml b/doc/dependency_decisions.yml index 290404e..59ca514 100644 --- a/doc/dependency_decisions.yml +++ b/doc/dependency_decisions.yml @@ -83,3 +83,9 @@ :why: :versions: [] :when: 2024-10-25 17:55:52.371898047 Z +- - :permit + - ruby + - :who: + :why: + :versions: [] + :when: 2024-11-03 10:58:35.358938407 Z From bae70b9884663b714ba52c779aaea6398761de2a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 13:40:50 +0100 Subject: [PATCH 071/283] Initial version --- .dockerignore | 1 + Dockerfile.dev | 42 ++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 38 ++++++++++++++++++++++++++++++++++++++ nginx.conf | 4 ++-- 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 Dockerfile.dev create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore index 9612375..9be59ed 100644 --- a/.dockerignore +++ b/.dockerignore @@ -35,3 +35,4 @@ /app/assets/builds/* !/app/assets/builds/.keep /public/assets +.docker-compose.yml \ No newline at end of file diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000..dbb61bc --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,42 @@ +# syntax = docker/dockerfile:1 + +# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile +ARG RUBY_VERSION=3.3.5 +FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base + +# Rails app lives here +WORKDIR /rails + +RUN apt-get update && apt-get install -y nodejs + +FROM base as build + +# Install packages needed to build gems +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config + +# Install application gems +COPY Gemfile Gemfile.lock ./ +RUN bundle install + +# Copy application code +COPY . . + +# Final stage for app image +FROM base + +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y curl libvips postgresql-client && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives + +# Copy built artifacts: gems, application +COPY --from=build /usr/local/bundle /usr/local/bundle +COPY --from=build /rails /rails + +# Entrypoint prepares the database. +ENTRYPOINT ["/rails/bin/docker-entrypoint"] + +# Start the server by default, this can be overwritten at runtime +EXPOSE 3001 +CMD ["./bin/rails", "server", "--binding=0.0.0.0"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..97fa122 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,38 @@ +services: + backend: + build: + context: . + dockerfile: Dockerfile.dev + ports: + - "3001:3001" + depends_on: + - db + environment: + DATABASE_URL: postgres://postgres:postgres@db:5432/postgres + RAILS_ENV: development + PORT: 3001 + frontend: + build: ../wedding-planner-frontend + ports: + - 3000:3000 + depends_on: + - backend + nginx: + image: nginx:latest + ports: + - 80:80 + volumes: + - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro + depends_on: + - frontend + - backend + db: + image: postgres:17 + ports: + - 5432 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + + \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index 9fb17cc..f8a4fac 100644 --- a/nginx.conf +++ b/nginx.conf @@ -3,12 +3,12 @@ server { server_name libre-wedding-planner.app.localhost; location /api/ { - proxy_pass http://localhost:3001/; + proxy_pass http://backend:3001/; proxy_set_header Host $http_host; } location / { - proxy_pass http://localhost:3000; + proxy_pass http://frontend:3000; proxy_set_header Host $http_host; } } From c2398c0d80a8fdc9f359a02e913fa036d3311547 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 13:53:36 +0100 Subject: [PATCH 072/283] Avoid exposing internal ports --- Dockerfile.dev | 2 +- docker-compose.yml | 24 ++++++++++++++++++++---- nginx.conf | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index dbb61bc..792a1ce 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -38,5 +38,5 @@ COPY --from=build /rails /rails ENTRYPOINT ["/rails/bin/docker-entrypoint"] # Start the server by default, this can be overwritten at runtime -EXPOSE 3001 +EXPOSE 3000 CMD ["./bin/rails", "server", "--binding=0.0.0.0"] diff --git a/docker-compose.yml b/docker-compose.yml index 97fa122..6aadc77 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,17 +4,28 @@ services: context: . dockerfile: Dockerfile.dev ports: - - "3001:3001" + - 3000 depends_on: - - db + db: + condition: service_healthy + environment: + DATABASE_URL: postgres://postgres:postgres@db:5432/postgres + RAILS_ENV: development + workers: + build: + context: . + dockerfile: Dockerfile.dev + entrypoint: bin/jobs + depends_on: + db: + condition: service_healthy environment: DATABASE_URL: postgres://postgres:postgres@db:5432/postgres RAILS_ENV: development - PORT: 3001 frontend: build: ../wedding-planner-frontend ports: - - 3000:3000 + - 3000 depends_on: - backend nginx: @@ -34,5 +45,10 @@ services: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: postgres + healthcheck: + test: ['CMD-SHELL', 'pg_isready -U postgres'] + interval: 10s + timeout: 5s + retries: 5 \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index f8a4fac..995c062 100644 --- a/nginx.conf +++ b/nginx.conf @@ -3,7 +3,7 @@ server { server_name libre-wedding-planner.app.localhost; location /api/ { - proxy_pass http://backend:3001/; + proxy_pass http://backend:3000/; proxy_set_header Host $http_host; } From 94d0a42ac17609af8e4cc168198e34d45653179f Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 13:56:10 +0100 Subject: [PATCH 073/283] Fix undefined method --- app/use_cases/guests/update_use_case.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/use_cases/guests/update_use_case.rb b/app/use_cases/guests/update_use_case.rb index 9a5cc66..d31a982 100644 --- a/app/use_cases/guests/update_use_case.rb +++ b/app/use_cases/guests/update_use_case.rb @@ -2,7 +2,13 @@ module Guests class UpdateUseCase + private attr_reader :guest_ids, :params def initialize(guest_ids:, params:) + @guest_ids = guest_ids + @params = params + end + + def call Guest.where(id: guest_ids).update!(params) # TODO: Not all status transitions may require a table re-arrangement From a9016ed35209ae296f64eeadf45ff4d1b938cd72 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 13:59:35 +0100 Subject: [PATCH 074/283] Enable hot reloading of modified code --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 6aadc77..abb9822 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,6 +11,8 @@ services: environment: DATABASE_URL: postgres://postgres:postgres@db:5432/postgres RAILS_ENV: development + volumes: + - .:/rails workers: build: context: . @@ -22,6 +24,8 @@ services: environment: DATABASE_URL: postgres://postgres:postgres@db:5432/postgres RAILS_ENV: development + volumes: + - .:/rails frontend: build: ../wedding-planner-frontend ports: From da8086605d7f5a6261c92f01f59abff8d6bfea5e Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 14:13:13 +0100 Subject: [PATCH 075/283] Enable hot reload in the frontend --- docker-compose.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index abb9822..e1a5977 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,11 +27,15 @@ services: volumes: - .:/rails frontend: - build: ../wedding-planner-frontend + build: + context: ../wedding-planner-frontend + dockerfile: Dockerfile.dev ports: - 3000 depends_on: - backend + volumes: + - ../wedding-planner-frontend/:/app nginx: image: nginx:latest ports: From a67696747b3847741a909b5d41d1165a1eb117fe Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 14:18:17 +0100 Subject: [PATCH 076/283] Enqueue some simulations after running the seed file --- db/seeds.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/seeds.rb b/db/seeds.rb index ec78d0c..e77df63 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -63,3 +63,5 @@ NUMBER_OF_GUESTS.times do status: Guest.statuses.keys.sample ) end + +ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new }) From a42f938530751f306ae1f71730529009afe4952d Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 14:41:09 +0100 Subject: [PATCH 077/283] Assign a color to every group and expose it via API --- app/controllers/tables_arrangements_controller.rb | 11 ++++++++--- app/models/group.rb | 8 ++++++++ db/migrate/20241103133122_add_color_to_group.rb | 5 +++++ db/schema.rb | 5 ++--- spec/models/group_spec.rb | 6 +++++- 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20241103133122_add_color_to_group.rb diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index 80935fd..ba2eea3 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -6,10 +6,15 @@ class TablesArrangementsController < ApplicationController end def show - Seat.joins(:guest).where(tables_arrangement_id: params[:id]) - .pluck(:table_number, Arel.sql("guests.first_name || ' ' || guests.last_name "), 'guests.id') + Seat.joins(guest: :group) + .where(tables_arrangement_id: params[:id]) + .pluck( + :table_number, + Arel.sql("guests.first_name || ' ' || guests.last_name "), 'guests.id', + 'groups.color' + ) .group_by(&:first) - .transform_values { |table| table.map { |(_, name, id)| { id:, name: } } } + .transform_values { |table| table.map { |(_, name, id, color)| { id:, name:, color: } } } .map { |number, guests| { number:, guests: } } .then { |result| render json: result } end diff --git a/app/models/group.rb b/app/models/group.rb index 316295e..417e2c6 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -7,7 +7,15 @@ class Group < ApplicationRecord has_many :children, class_name: 'Group', foreign_key: 'parent_id' belongs_to :parent, class_name: 'Group', optional: true + before_create :set_color + scope :roots, -> { where(parent_id: nil) } has_many :guests + + private + + def set_color + self.color = "##{SecureRandom.hex(3)}" + end end diff --git a/db/migrate/20241103133122_add_color_to_group.rb b/db/migrate/20241103133122_add_color_to_group.rb new file mode 100644 index 0000000..f73d988 --- /dev/null +++ b/db/migrate/20241103133122_add_color_to_group.rb @@ -0,0 +1,5 @@ +class AddColorToGroup < ActiveRecord::Migration[7.2] + def change + add_column :groups, :color, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 5a7912b..e71ec6d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_11_03_093955) do +ActiveRecord::Schema[7.2].define(version: 2024_11_03_133122) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -35,6 +33,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_03_093955) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.uuid "parent_id" + t.string "color" t.index ["name"], name: "index_groups_on_name", unique: true t.index ["parent_id"], name: "index_groups_on_parent_id" end diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index c31cd69..10102f4 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -3,5 +3,9 @@ require 'rails_helper' RSpec.describe Group, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + describe 'callbacks' do + it 'should set color before create' do + expect(create(:group).color).to be_present + end + end end From 3ae90bfc4e5d257455295937017b32ce2c9fd97a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 13:43:32 +0000 Subject: [PATCH 078/283] Add copyright notice --- db/migrate/20241103133122_add_color_to_group.rb | 2 ++ db/schema.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/db/migrate/20241103133122_add_color_to_group.rb b/db/migrate/20241103133122_add_color_to_group.rb index f73d988..bca1c30 100644 --- a/db/migrate/20241103133122_add_color_to_group.rb +++ b/db/migrate/20241103133122_add_color_to_group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class AddColorToGroup < ActiveRecord::Migration[7.2] def change add_column :groups, :color, :string diff --git a/db/schema.rb b/db/schema.rb index e71ec6d..b2643a7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From 1e23ad8e5038b1804026a0937962ca6de574b27b Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 14:48:49 +0100 Subject: [PATCH 079/283] Order guests within same table by color --- app/controllers/tables_arrangements_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index ba2eea3..689949c 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -8,6 +8,7 @@ class TablesArrangementsController < ApplicationController def show Seat.joins(guest: :group) .where(tables_arrangement_id: params[:id]) + .order('guests.group_id') .pluck( :table_number, Arel.sql("guests.first_name || ' ' || guests.last_name "), 'guests.id', From ca1a8a499f2a5d9680f48d7366bbc396f6d5a917 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 4 Nov 2024 23:18:44 +0100 Subject: [PATCH 080/283] Initial version of the README --- README.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7db80e4..4d4f615 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,78 @@ -# README +# Libre Wedding Planner -This README would normally document whatever steps are necessary to get the -application up and running. +Libre Wedding Planner is Free, Open Source Software that helps organize several aspects of a wedding. -Things you may want to cover: +The project is not production-ready yet. -* Ruby version +## Features -* System dependencies +The follwing features are either developed or under active development: -* Configuration +- Guests management +- Expense management +- Seating chart -* Database creation -* Database initialization +## Next steps -* How to run the test suite +Some ideas we would like to implement next: -* Services (job queues, cache servers, search engines, etc.) +- Authentication (required to make an instance public) +- Website with wedding information +- Attendance confirmation forms +- Multitenancy -* Deployment instructions +# Development setup + +Libre Wedding Planner is made of two main pieces: + +- The backend (this repo), built with Ruby (on Rails) +- The frontend (repo [here](https://gitea.bustikiller.com/bustikiller/wedding-planner-frontend/)), built with NextJS and React. You will need both to have the service fully working. + +Both repositories are expected to live have a common parent directory: + +``` +projects + |-> wedding-planner + |-> wedding-planner-frontend +``` + +## Docker compose + +Docker compose is the recommended way to run Libre Wedding Planner for development purposes. After downloading both repositories, `cd` to the root of `wedding-planner` and run: + +```bash +docker compose build +docker compose up +``` + +Several containers will be started: + +- backend: starts a Rails server that will act as an API. +- workers: starts a runner of [solid queue](https://github.com/rails/solid_queue/) that takes .care of async tasks. +- frontend: starts a NextJS application in charge of the frontend. +- nginx: A reverse proxy that the backend and frontend under the same domain, and routes all requests to the upstream services. +- db: A Postgres instance used by the backend service. + +The backend service will seed the database with fake data. It's worth noting that the Postgres container does not have a volume, so the application will be seeded every time the container is created. + +The backend, frontend and workers have hot-reloading enabled, so changes made to the codebase should be reflected in the application on the next request. + +Once all containers have started, visit http://libre-wedding-planner.app.localhost/dashboard to load the application. + +## Testing + +Unit tests can be executed with + +``` +bundle exec rspec +``` + +## Contributing + +Contributions of all kinds (code, UX/UI, testing, translations, etc.) are welcome. The procedures to contribute are still being defined, but don't hesitate to reach out in case you want to participate. + +# License + +This project is licensed under the GNU Affero General Public License (AGPL). Check [COPYING.md](./COPYING.md) for additional information. -* ... From 5cceb1e6ed5c2d56abbb7a401c475edd8bbdedd9 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 4 Nov 2024 23:39:44 +0100 Subject: [PATCH 081/283] Choose light colors for the groups --- Gemfile | 3 ++- Gemfile.lock | 2 ++ app/models/group.rb | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index f61ed2f..bb8942b 100644 --- a/Gemfile +++ b/Gemfile @@ -33,4 +33,5 @@ group :development do gem 'web-console' end -gem "solid_queue", "~> 1.0" +gem 'chroma' +gem 'solid_queue', '~> 1.0' diff --git a/Gemfile.lock b/Gemfile.lock index 05575bf..58e83a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,6 +84,7 @@ GEM bootsnap (1.18.4) msgpack (~> 1.2) builder (3.3.0) + chroma (0.2.0) coderay (1.1.3) concurrent-ruby (1.3.4) connection_pool (2.4.1) @@ -326,6 +327,7 @@ PLATFORMS DEPENDENCIES bootsnap + chroma csv debug factory_bot_rails diff --git a/app/models/group.rb b/app/models/group.rb index 417e2c6..cf7cba0 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -16,6 +16,8 @@ class Group < ApplicationRecord private def set_color - self.color = "##{SecureRandom.hex(3)}" + new_color = "##{SecureRandom.hex(3)}".paint + new_color = new_color.lighten(30) if new_color.dark? + self.color = new_color end end From 7a4aad29c1cd09837582b4dd10e43c4747efa169 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 8 Nov 2024 01:08:59 +0000 Subject: [PATCH 082/283] Update dependency factory_bot_rails to v6.4.4 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 58e83a3..f97301b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -295,7 +295,7 @@ GEM sprockets (>= 3.0.0) stimulus-rails (1.3.4) railties (>= 6.0.0) - stringio (3.1.1) + stringio (3.1.2) thor (1.3.2) tilt (2.4.0) timeout (0.4.1) From c70c0c5f60c6678cf15df882bc3a699dfab99f9f Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 9 Nov 2024 01:07:47 +0000 Subject: [PATCH 083/283] Update dependency factory_bot_rails to v6.4.4 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index f97301b..295c88c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -244,7 +244,7 @@ GEM redis-client (0.22.2) connection_pool regexp_parser (2.9.2) - reline (0.5.10) + reline (0.5.11) io-console (~> 0.5) rspec-core (3.13.2) rspec-support (~> 3.13.0) From b4664c5e1dd1bffcb7f36e7df897684bcdcbb04e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 9 Nov 2024 01:08:10 +0000 Subject: [PATCH 084/283] Update dependency ruby to v3.3.6 --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index bb8942b..731c2e6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -ruby '3.3.5' +ruby '3.3.6' gem 'bootsnap', require: false gem 'csv' gem 'importmap-rails' diff --git a/Gemfile.lock b/Gemfile.lock index f97301b..0132c5b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -354,7 +354,7 @@ DEPENDENCIES web-console RUBY VERSION - ruby 3.3.5p100 + ruby 3.3.6p108 BUNDLED WITH 2.5.17 From 985697468440def2a576a7f873e6e23e944d80fd Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 9 Nov 2024 08:35:57 +0100 Subject: [PATCH 085/283] Install project dependencies before running license finder --- .github/workflows/license_finder.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/license_finder.yml b/.github/workflows/license_finder.yml index 19cadd4..0541d69 100644 --- a/.github/workflows/license_finder.yml +++ b/.github/workflows/license_finder.yml @@ -17,6 +17,8 @@ jobs: - uses: ruby/setup-ruby@v1 with: ruby-version: '3.3' + - name: Install project dependencies + run: bundle install --jobs `getconf _NPROCESSORS_ONLN` - name: Install license finder gem run: gem install license_finder - name: Run license finder From f7b227bc971ceb817a7ba997616dfa26aba5eaa3 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 9 Nov 2024 08:38:14 +0100 Subject: [PATCH 086/283] Update ruby version in Gemfile and .ruby-version --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index f13c6f4..e391e18 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.3.5 +ruby-3.3.6 From 004624687a2b6f17fb839bf369f4d631e642ec39 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 9 Nov 2024 08:39:57 +0100 Subject: [PATCH 087/283] Update dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b155a9d..071a90a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax = docker/dockerfile:1 # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.3.5 +ARG RUBY_VERSION=3.3.6 FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base # Rails app lives here From d04f7211e781a03bfbe73c1aaa7863a7719e4522 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 9 Nov 2024 01:08:16 +0000 Subject: [PATCH 088/283] Update dependency solid_queue to v1.0.1 --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 295c88c..c6fb455 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -279,7 +279,7 @@ GEM rubytree (2.1.0) json (~> 2.0, > 2.3.1) securerandom (0.3.1) - solid_queue (1.0.0) + solid_queue (1.0.1) activejob (>= 7.1) activerecord (>= 7.1) concurrent-ruby (>= 1.3.1) @@ -298,7 +298,7 @@ GEM stringio (3.1.2) thor (1.3.2) tilt (2.4.0) - timeout (0.4.1) + timeout (0.4.2) turbo-rails (2.0.11) actionpack (>= 6.0.0) railties (>= 6.0.0) From 60a7b1342fa6c9c6fb9030f67be8ef649e7196f4 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 9 Nov 2024 08:52:40 +0100 Subject: [PATCH 089/283] Add license finder as a development dependency --- .github/workflows/license_finder.yml | 2 -- Gemfile | 1 + Gemfile.lock | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/license_finder.yml b/.github/workflows/license_finder.yml index 0541d69..7536a95 100644 --- a/.github/workflows/license_finder.yml +++ b/.github/workflows/license_finder.yml @@ -19,7 +19,5 @@ jobs: ruby-version: '3.3' - name: Install project dependencies run: bundle install --jobs `getconf _NPROCESSORS_ONLN` - - name: Install license finder gem - run: gem install license_finder - name: Run license finder run: license_finder diff --git a/Gemfile b/Gemfile index bb8942b..cdbb8ab 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,7 @@ group :development, :test do gem 'factory_bot_rails' gem 'pry' gem 'rspec-rails', '~> 7.0.0' + gem 'license_finder' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index c6fb455..a1ac3c1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -138,6 +138,14 @@ GEM jsonapi-serializable (0.3.1) jsonapi-renderer (~> 0.2.0) language_server-protocol (3.17.0.3) + license_finder (7.2.1) + bundler + csv (~> 3.2) + rubyzip (>= 1, < 3) + thor (~> 1.2) + tomlrb (>= 1.3, < 2.1) + with_env (= 1.1.0) + xml-simple (~> 1.1.9) logger (1.6.1) loofah (2.22.0) crass (~> 1.0.2) @@ -246,6 +254,7 @@ GEM regexp_parser (2.9.2) reline (0.5.11) io-console (~> 0.5) + rexml (3.3.9) rspec-core (3.13.2) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) @@ -278,6 +287,7 @@ GEM ruby-progressbar (1.13.0) rubytree (2.1.0) json (~> 2.0, > 2.3.1) + rubyzip (2.3.2) securerandom (0.3.1) solid_queue (1.0.1) activejob (>= 7.1) @@ -299,6 +309,7 @@ GEM thor (1.3.2) tilt (2.4.0) timeout (0.4.2) + tomlrb (2.0.3) turbo-rails (2.0.11) actionpack (>= 6.0.0) railties (>= 6.0.0) @@ -315,6 +326,9 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) + with_env (1.1.0) + xml-simple (1.1.9) + rexml zeitwerk (2.7.1) PLATFORMS @@ -335,6 +349,7 @@ DEPENDENCIES importmap-rails jbuilder jsonapi-rails + license_finder money pg (~> 1.1) pry From 9035df5178b7b35d202d3c0c8f70db431324be52 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 9 Nov 2024 17:45:23 +0100 Subject: [PATCH 090/283] Install shoulda matchers, improve guests specs and change enum syntax --- Gemfile | 3 ++- Gemfile.lock | 3 +++ app/models/guest.rb | 2 +- spec/models/guest_spec.rb | 34 +++++++++++++++++++++++++++++++++- spec/rails_helper.rb | 7 +++++++ 5 files changed, 46 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index cdbb8ab..5eb981a 100644 --- a/Gemfile +++ b/Gemfile @@ -24,9 +24,10 @@ gem 'rubytree' group :development, :test do gem 'debug', platforms: %i[mri windows] gem 'factory_bot_rails' + gem 'license_finder' gem 'pry' gem 'rspec-rails', '~> 7.0.0' - gem 'license_finder' + gem 'shoulda-matchers', '~> 6.0' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index a1ac3c1..09646a4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -289,6 +289,8 @@ GEM json (~> 2.0, > 2.3.1) rubyzip (2.3.2) securerandom (0.3.1) + shoulda-matchers (6.4.0) + activesupport (>= 5.2.0) solid_queue (1.0.1) activejob (>= 7.1) activerecord (>= 7.1) @@ -361,6 +363,7 @@ DEPENDENCIES rspec-rails (~> 7.0.0) rubocop rubytree + shoulda-matchers (~> 6.0) solid_queue (~> 1.0) sprockets-rails stimulus-rails diff --git a/app/models/guest.rb b/app/models/guest.rb index 87680bf..774eee3 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -3,7 +3,7 @@ class Guest < ApplicationRecord belongs_to :group - enum status: { + enum :status, { considered: 0, invited: 10, confirmed: 20, diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index 1d3e530..6861079 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -3,5 +3,37 @@ require 'rails_helper' RSpec.describe Guest, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + it do + should define_enum_for(:status).with_values( + considered: 0, + invited: 10, + confirmed: 20, + declined: 30, + tentative: 40 + ) + end + + it { should belong_to(:group) } + + describe 'scopes' do + describe '.potential' do + it 'returns guests that are not declined or considered' do + _declined_guest = create(:guest, status: :declined) + _considered_guest = create(:guest, status: :considered) + invited_guest = create(:guest, status: :invited) + confirmed_guest = create(:guest, status: :confirmed) + tentative_guest = create(:guest, status: :tentative) + + expect(Guest.potential).to match_array([invited_guest, confirmed_guest, tentative_guest]) + end + end + end + + describe '#full_name' do + it 'returns the full name of the guest' do + guest = create(:guest, first_name: 'John', last_name: 'Doe') + + expect(guest.full_name).to eq('John Doe') + end + end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 233f83a..fa81db3 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -66,3 +66,10 @@ RSpec.configure do |config| # config.filter_gems_from_backtrace("gem name") config.include FactoryBot::Syntax::Methods end + +Shoulda::Matchers.configure do |config| + config.integrate do |with| + with.test_framework :rspec + with.library :rails + end +end From ffc7fa3801d2f2f597d293efd92f38a85ae41df9 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 9 Nov 2024 17:51:12 +0100 Subject: [PATCH 091/283] Update dependency rails to v8 --- Gemfile | 2 +- Gemfile.lock | 127 +++++++++++++++++++++++++-------------------------- 2 files changed, 64 insertions(+), 65 deletions(-) diff --git a/Gemfile b/Gemfile index 5eb981a..06385f9 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'jbuilder' gem 'money' gem 'pg', '~> 1.1' gem 'puma', '>= 5.0' -gem 'rails', '~> 7.2.0', '>= 7.2.1' +gem 'rails', '~> 8.0.0', '>= 8.0.0' gem 'redis', '>= 4.0.1' gem 'sprockets-rails' gem 'stimulus-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 09646a4..f5d6fed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,66 +1,65 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.2.2) - actionpack (= 7.2.2) - activesupport (= 7.2.2) + actioncable (8.0.0) + actionpack (= 8.0.0) + activesupport (= 8.0.0) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.2) - actionpack (= 7.2.2) - activejob (= 7.2.2) - activerecord (= 7.2.2) - activestorage (= 7.2.2) - activesupport (= 7.2.2) + actionmailbox (8.0.0) + actionpack (= 8.0.0) + activejob (= 8.0.0) + activerecord (= 8.0.0) + activestorage (= 8.0.0) + activesupport (= 8.0.0) mail (>= 2.8.0) - actionmailer (7.2.2) - actionpack (= 7.2.2) - actionview (= 7.2.2) - activejob (= 7.2.2) - activesupport (= 7.2.2) + actionmailer (8.0.0) + actionpack (= 8.0.0) + actionview (= 8.0.0) + activejob (= 8.0.0) + activesupport (= 8.0.0) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.2) - actionview (= 7.2.2) - activesupport (= 7.2.2) + actionpack (8.0.0) + actionview (= 8.0.0) + activesupport (= 8.0.0) nokogiri (>= 1.8.5) - racc - rack (>= 2.2.4, < 3.2) + rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.2) - actionpack (= 7.2.2) - activerecord (= 7.2.2) - activestorage (= 7.2.2) - activesupport (= 7.2.2) + actiontext (8.0.0) + actionpack (= 8.0.0) + activerecord (= 8.0.0) + activestorage (= 8.0.0) + activesupport (= 8.0.0) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.2) - activesupport (= 7.2.2) + actionview (8.0.0) + activesupport (= 8.0.0) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.2) - activesupport (= 7.2.2) + activejob (8.0.0) + activesupport (= 8.0.0) globalid (>= 0.3.6) - activemodel (7.2.2) - activesupport (= 7.2.2) - activerecord (7.2.2) - activemodel (= 7.2.2) - activesupport (= 7.2.2) + activemodel (8.0.0) + activesupport (= 8.0.0) + activerecord (8.0.0) + activemodel (= 8.0.0) + activesupport (= 8.0.0) timeout (>= 0.4.0) - activestorage (7.2.2) - actionpack (= 7.2.2) - activejob (= 7.2.2) - activerecord (= 7.2.2) - activesupport (= 7.2.2) + activestorage (8.0.0) + actionpack (= 8.0.0) + activejob (= 8.0.0) + activerecord (= 8.0.0) + activesupport (= 8.0.0) marcel (~> 1.0) - activesupport (7.2.2) + activesupport (8.0.0) base64 benchmark (>= 0.3) bigdecimal @@ -72,13 +71,14 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) ast (2.4.2) babel-source (5.8.35) babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) execjs (~> 2.0) base64 (0.2.0) - benchmark (0.3.0) + benchmark (0.4.0) bigdecimal (3.1.8) bindex (0.8.1) bootsnap (1.18.4) @@ -90,7 +90,7 @@ GEM connection_pool (2.4.1) crass (1.0.6) csv (3.3.0) - date (3.3.4) + date (3.4.0) debug (1.9.2) irb (~> 1.10) reline (>= 0.3.8) @@ -147,7 +147,7 @@ GEM with_env (= 1.1.0) xml-simple (~> 1.1.9) logger (1.6.1) - loofah (2.22.0) + loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -162,7 +162,7 @@ GEM money (6.19.0) i18n (>= 0.6.4, <= 2) msgpack (1.7.2) - net-imap (0.4.17) + net-imap (0.5.1) date net-protocol net-pop (0.1.2) @@ -192,7 +192,7 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - psych (5.1.2) + psych (5.2.0) stringio puma (6.4.3) nio4r (~> 2.0) @@ -205,23 +205,22 @@ GEM rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rackup (2.1.0) + rackup (2.2.0) rack (>= 3) - webrick (~> 1.8) - rails (7.2.2) - actioncable (= 7.2.2) - actionmailbox (= 7.2.2) - actionmailer (= 7.2.2) - actionpack (= 7.2.2) - actiontext (= 7.2.2) - actionview (= 7.2.2) - activejob (= 7.2.2) - activemodel (= 7.2.2) - activerecord (= 7.2.2) - activestorage (= 7.2.2) - activesupport (= 7.2.2) + rails (8.0.0) + actioncable (= 8.0.0) + actionmailbox (= 8.0.0) + actionmailer (= 8.0.0) + actionpack (= 8.0.0) + actiontext (= 8.0.0) + actionview (= 8.0.0) + activejob (= 8.0.0) + activemodel (= 8.0.0) + activerecord (= 8.0.0) + activestorage (= 8.0.0) + activesupport (= 8.0.0) bundler (>= 1.15.0) - railties (= 7.2.2) + railties (= 8.0.0) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -229,9 +228,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.2.2) - actionpack (= 7.2.2) - activesupport (= 7.2.2) + railties (8.0.0) + actionpack (= 8.0.0) + activesupport (= 8.0.0) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -318,13 +317,13 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.6.0) + uri (1.0.1) useragent (0.16.10) web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webrick (1.8.2) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -357,7 +356,7 @@ DEPENDENCIES pry puma (>= 5.0) rack-cors - rails (~> 7.2.0, >= 7.2.1) + rails (~> 8.0.0, >= 8.0.0) react-rails redis (>= 4.0.1) rspec-rails (~> 7.0.0) From 9190348ff20b690a0ff66178989d3c1bcc931458 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 10 Nov 2024 01:24:55 +0000 Subject: [PATCH 092/283] Update dependency rspec-rails to '~> 7.1.0' --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 06385f9..c64df42 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ group :development, :test do gem 'factory_bot_rails' gem 'license_finder' gem 'pry' - gem 'rspec-rails', '~> 7.0.0' + gem 'rspec-rails', '~> 7.1.0' gem 'shoulda-matchers', '~> 6.0' end diff --git a/Gemfile.lock b/Gemfile.lock index f5d6fed..ac22d73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -262,7 +262,7 @@ GEM rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (7.0.1) + rspec-rails (7.1.0) actionpack (>= 7.0) activesupport (>= 7.0) railties (>= 7.0) @@ -359,7 +359,7 @@ DEPENDENCIES rails (~> 8.0.0, >= 8.0.0) react-rails redis (>= 4.0.1) - rspec-rails (~> 7.0.0) + rspec-rails (~> 7.1.0) rubocop rubytree shoulda-matchers (~> 6.0) From 19d309a2cf4d340478fb39684c46652ae4958942 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 10:16:22 +0100 Subject: [PATCH 093/283] Modify initial distribution of tables to guarantee there is no single-person table --- app/services/tables/distribution.rb | 7 ++++--- spec/services/tables/distribution_spec.rb | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 spec/services/tables/distribution_spec.rb diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index b361c70..48d4ea9 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -13,9 +13,10 @@ module Tables end def random_distribution(people) - @tables = [] - - @tables << Table.new(people.slice!(0..rand(@min_per_table..@max_per_table))) while people.any? + min_tables = (people.count * 1.0 / @max_per_table).ceil + max_tables = (people.count * 1.0 / @min_per_table).ceil + @tables = people.in_groups(rand(min_tables..max_tables), false) + .map { |group| Table.new(group) } end def discomfort diff --git a/spec/services/tables/distribution_spec.rb b/spec/services/tables/distribution_spec.rb new file mode 100644 index 0000000..15387c8 --- /dev/null +++ b/spec/services/tables/distribution_spec.rb @@ -0,0 +1,23 @@ +require 'rails_helper' + +module Tables + RSpec.describe Distribution do + describe '#random_distribution' do + let(:subject) { described_class.new(min_per_table: 5, max_per_table: 10) } + + context 'when there are fewer people than the minimum per table' do + it 'creates one table' do + subject.random_distribution([1, 2, 3, 4]) + expect(subject.tables.count).to eq(1) + end + end + + context 'when there are more people than the maximum per table' do + it 'creates multiple tables' do + subject.random_distribution([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) + expect(subject.tables.count).to be > 1 + end + end + end + end +end From c12e2fc6a4b4e4fd64772519a3b874e00cac636a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 09:17:34 +0000 Subject: [PATCH 094/283] Add copyright notice --- spec/services/tables/distribution_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/services/tables/distribution_spec.rb b/spec/services/tables/distribution_spec.rb index 15387c8..df88a85 100644 --- a/spec/services/tables/distribution_spec.rb +++ b/spec/services/tables/distribution_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' module Tables From f3b70f5a317df070d7fa18f76bfd3924fe038219 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 11:22:51 +0100 Subject: [PATCH 095/283] Apply a penalty if table sizes are not honored --- app/services/tables/discomfort_calculator.rb | 26 +++++++++- app/services/tables/distribution.rb | 6 ++- app/services/tables/table.rb | 5 +- .../tables/discomfort_calculator_spec.rb | 50 ++++++++++++++++++- 4 files changed, 80 insertions(+), 7 deletions(-) diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index 09b5356..0d40670 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -3,16 +3,38 @@ module Tables class DiscomfortCalculator private attr_reader :table - def initialize(table) + def initialize(table:) @table = table end def calculate - cohesion_penalty + table_size_penalty + cohesion_penalty end private + # + # Calculates the penalty associated with violating the table size constraints. The penalty is + # zero when the limits are honored, and it increases linearly as the number of guests deviates + # from the limits. Overcapacity is penalized more severely than undercapacity. + # + # @return [Number] The penalty associated with violating the table size constraints. + # + def table_size_penalty + case table.size + when 0...table.min_per_table then 2 * (table.min_per_table - table.size) + when table.min_per_table..table.max_per_table then 0 + else 5 * (table.size - table.max_per_table) + end + end + + # + # Calculates the discomfort of the table based on the cohesion of the guests. The total discomfort + # is calculated as the sum of the discomfort of each pair of guests. The discomfort of a pair of + # guests is a rational number between 1 (unrelated groups) and 0 (same group). + # + # @return [Number] Total discomfort of the table. + # def cohesion_penalty table.map(&:group_id).tally.to_a.combination(2).sum do |(a, count_a), (b, count_b)| distance = AffinityGroupsHierarchy.instance.distance(a, b) diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 48d4ea9..52621c3 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -4,7 +4,7 @@ require_relative '../../extensions/tree_node_extension' module Tables class Distribution - attr_accessor :tables + attr_accessor :tables, :min_per_table, :max_per_table def initialize(min_per_table:, max_per_table:) @min_per_table = min_per_table @@ -17,6 +17,8 @@ module Tables max_tables = (people.count * 1.0 / @min_per_table).ceil @tables = people.in_groups(rand(min_tables..max_tables), false) .map { |group| Table.new(group) } + .each { |table| table.min_per_table = @min_per_table } + .each { |table| table.max_per_table = @max_per_table } end def discomfort @@ -62,7 +64,7 @@ module Tables private def local_discomfort(table) - table.discomfort ||= DiscomfortCalculator.new(table).calculate + table.discomfort ||= DiscomfortCalculator.new(table:).calculate end end end diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index 92b0f08..8f58854 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -2,7 +2,8 @@ module Tables class Table < Array - attr_accessor :discomfort + attr_accessor :discomfort, :min_per_table, :max_per_table + def initialize(*args) super reset @@ -14,4 +15,4 @@ module Tables original_discomfort end end -end \ No newline at end of file +end diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index 0e22602..b7a3030 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -3,13 +3,61 @@ require 'rails_helper' module Tables RSpec.describe DiscomfortCalculator do - let(:calculator) { described_class.new(table) } + let(:calculator) { described_class.new(table:) } let(:family) { create(:group, name: 'family') } let(:friends) { create(:group, name: 'friends') } let(:work) { create(:group, name: 'work') } let(:school) { create(:group, name: 'school') } + describe '#table_size_penalty' do + before do + table.min_per_table = 5 + table.max_per_table = 7 + end + context 'when the number of guests is in the lower bound' do + let(:table) { Table.new(create_list(:guest, 5)) } + + it { expect(calculator.send(:table_size_penalty)).to eq(0) } + end + + context 'when the number of guests is within the table size limits' do + let(:table) { Table.new(create_list(:guest, 6)) } + + it { expect(calculator.send(:table_size_penalty)).to eq(0) } + end + + context 'when the number of guests is in the upper bound' do + let(:table) { Table.new(create_list(:guest, 7)) } + + it { expect(calculator.send(:table_size_penalty)).to eq(0) } + end + + context 'when the number of guests is one unit below the lower bound' do + let(:table) { Table.new(create_list(:guest, 4)) } + + it { expect(calculator.send(:table_size_penalty)).to eq(2) } + end + + context 'when the number of guests is two units below the lower bound' do + let(:table) { Table.new(create_list(:guest, 3)) } + + it { expect(calculator.send(:table_size_penalty)).to eq(4) } + end + + context 'when the number of guests is one unit above the upper bound' do + let(:table) { Table.new(create_list(:guest, 8)) } + + it { expect(calculator.send(:table_size_penalty)).to eq(5) } + end + + context 'when the number of guests is two units above the upper bound' do + let(:table) { Table.new(create_list(:guest, 9)) } + + it { expect(calculator.send(:table_size_penalty)).to eq(10) } + end + end + describe '#cohesion_penalty' do before do # Overridden in each test except trivial cases From 021b82b28e148dadf58bd97f37ee93b989e00990 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 11:34:26 +0100 Subject: [PATCH 096/283] Use average discomfort instead of sum --- app/services/tables/discomfort_calculator.rb | 2 +- spec/services/tables/discomfort_calculator_spec.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index 0d40670..9942bf0 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -8,7 +8,7 @@ module Tables end def calculate - table_size_penalty + cohesion_penalty + table_size_penalty + 10 * (cohesion_penalty * 1.0 / table.size) end private diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index b7a3030..eab291b 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -10,6 +10,19 @@ module Tables let(:work) { create(:group, name: 'work') } let(:school) { create(:group, name: 'school') } + describe '#calculate' do + before do + allow(calculator).to receive(:table_size_penalty).and_return(2) + allow(calculator).to receive(:cohesion_penalty).and_return(3) + end + + let(:table) { Table.new(create_list(:guest, 6)) } + + it 'returns the sum of the table size penalty and the average cohesion penalty' do + expect(calculator.calculate).to eq(2 + 10 * 3 / 6.0) + end + end + describe '#table_size_penalty' do before do table.min_per_table = 5 From fa3d3cf13bbe8ecb9be8e23bd790d32ffa273849 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 09:49:08 +0100 Subject: [PATCH 097/283] Assign similar colors to child groups --- app/models/group.rb | 14 ++++++++++++++ config/initializers/colors.rb | 6 ++++++ db/seeds.rb | 4 ++++ 3 files changed, 24 insertions(+) create mode 100644 config/initializers/colors.rb diff --git a/app/models/group.rb b/app/models/group.rb index cf7cba0..105d08c 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -13,6 +13,20 @@ class Group < ApplicationRecord has_many :guests + def colorize_children(generation = 1) + derived_colors = generation == 1 ? color.paint.palette.analogous(size: children.count) : color.paint.palette.decreasing_saturation + + children.zip(derived_colors) do |child, raw_color| + + final_color = raw_color.paint + final_color.brighten(60) if final_color.dark? + + child.update!(color: final_color) + + child.colorize_children(generation + 1) + end + end + private def set_color diff --git a/config/initializers/colors.rb b/config/initializers/colors.rb new file mode 100644 index 0000000..042a749 --- /dev/null +++ b/config/initializers/colors.rb @@ -0,0 +1,6 @@ +Chroma.define_palette :decreasing_saturation do + spin(20).desaturate(40) + spin(-20).desaturate(40) + spin(40).desaturate(40) + spin(-40).desaturate(40) +end diff --git a/db/seeds.rb b/db/seeds.rb index e77df63..bd9417a 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -65,3 +65,7 @@ NUMBER_OF_GUESTS.times do end ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new }) + +'red'.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) } + +Group.roots.each(&:colorize_children) \ No newline at end of file From 4089ff63baf538a870bc50bf4d44be495a440aab Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 11:24:07 +0000 Subject: [PATCH 098/283] Add copyright notice --- config/initializers/colors.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/initializers/colors.rb b/config/initializers/colors.rb index 042a749..b435084 100644 --- a/config/initializers/colors.rb +++ b/config/initializers/colors.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + Chroma.define_palette :decreasing_saturation do spin(20).desaturate(40) spin(-20).desaturate(40) From 29d9d219164103f6a1edcbdd3a1e0455e5b3596c Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 17:30:01 +0100 Subject: [PATCH 099/283] Use sets instead of arrays to represent tables --- app/services/tables/swap.rb | 2 +- app/services/tables/table.rb | 2 +- config/initializers/ruby_extensions.rb | 2 +- spec/services/tables/swap_spec.rb | 64 +++++++++++++------------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/app/services/tables/swap.rb b/app/services/tables/swap.rb index 9668efb..ae74294 100644 --- a/app/services/tables/swap.rb +++ b/app/services/tables/swap.rb @@ -9,7 +9,7 @@ module Tables def each @initial_solution.tables.combination(2) do |table_a, table_b| - table_a.product(table_b).each do |(person_a, person_b)| + table_a.to_a.product(table_b.to_a).each do |(person_a, person_b)| original_discomfort_a = table_a.reset original_discomfort_b = table_b.reset diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index 8f58854..2c50435 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -1,7 +1,7 @@ # Copyright (C) 2024 Manuel Bustillo module Tables - class Table < Array + class Table < Set attr_accessor :discomfort, :min_per_table, :max_per_table def initialize(*args) diff --git a/config/initializers/ruby_extensions.rb b/config/initializers/ruby_extensions.rb index e515905..46016e7 100644 --- a/config/initializers/ruby_extensions.rb +++ b/config/initializers/ruby_extensions.rb @@ -6,7 +6,7 @@ class Numeric end end -class Array +class Set def to_table Tables::Table.new(self) end diff --git a/spec/services/tables/swap_spec.rb b/spec/services/tables/swap_spec.rb index 3022af2..159d998 100644 --- a/spec/services/tables/swap_spec.rb +++ b/spec/services/tables/swap_spec.rb @@ -16,17 +16,17 @@ module Tables context 'when there are two tables with two people each' do let(:initial_solution) do Distribution.new(min_per_table: 2, max_per_table: 2).tap do |distribution| - distribution.tables << %i[a b].to_table - distribution.tables << %i[c d].to_table + distribution.tables << Set[:a, :b].to_table + distribution.tables << Set[:c, :d].to_table end end it 'yields all possible swaps between the tables' do expect(swaps).to contain_exactly( - [%i[a d], %i[c b]], - [%i[b c], %i[d a]], - [%i[a c], %i[d b]], - [%i[b d], %i[c a]] + [Set[:a, :d], Set[:c, :b]], + [Set[:b, :c], Set[:d, :a]], + [Set[:a, :c], Set[:d, :b]], + [Set[:b, :d], Set[:c, :a]] ) end end @@ -34,22 +34,22 @@ module Tables context 'when there are two tables with three people each' do let(:initial_solution) do Distribution.new(min_per_table: 3, max_per_table: 3).tap do |distribution| - distribution.tables << %i[a b c].to_table - distribution.tables << %i[d e f].to_table + distribution.tables << Set[:a, :b, :c].to_table + distribution.tables << Set[:d, :e, :f].to_table end end it 'yields all possible swaps between the tables' do expect(swaps).to contain_exactly( - [%i[b c d], %i[e f a]], - [%i[b c e], %i[f d a]], - [%i[b c f], %i[d e a]], - [%i[c a d], %i[e f b]], - [%i[c a e], %i[f d b]], - [%i[c a f], %i[d e b]], - [%i[a b d], %i[e f c]], - [%i[a b e], %i[f d c]], - [%i[a b f], %i[d e c]] + [Set[:b, :c, :d], Set[:e, :f, :a]], + [Set[:b, :c, :e], Set[:f, :d, :a]], + [Set[:b, :c, :f], Set[:d, :e, :a]], + [Set[:c, :a, :d], Set[:e, :f, :b]], + [Set[:c, :a, :e], Set[:f, :d, :b]], + [Set[:c, :a, :f], Set[:d, :e, :b]], + [Set[:a, :b, :d], Set[:e, :f, :c]], + [Set[:a, :b, :e], Set[:f, :d, :c]], + [Set[:a, :b, :f], Set[:d, :e, :c]] ) end end @@ -57,26 +57,26 @@ module Tables context 'when there are three tables with two people each' do let(:initial_solution) do Distribution.new(min_per_table: 2, max_per_table: 2).tap do |distribution| - distribution.tables << %i[a b].to_table - distribution.tables << %i[c d].to_table - distribution.tables << %i[e f].to_table + distribution.tables << Set[:a, :b].to_table + distribution.tables << Set[:c, :d].to_table + distribution.tables << Set[:e, :f].to_table end end it 'yields all possible swaps between the tables' do expect(swaps).to contain_exactly( - [%i[b c], %i[d a], %i[e f]], - [%i[b d], %i[c a], %i[e f]], - [%i[a c], %i[d b], %i[e f]], - [%i[a d], %i[c b], %i[e f]], - [%i[b e], %i[c d], %i[f a]], - [%i[b f], %i[c d], %i[e a]], - [%i[a e], %i[c d], %i[f b]], - [%i[a f], %i[c d], %i[e b]], - [%i[a b], %i[d e], %i[f c]], - [%i[a b], %i[d f], %i[e c]], - [%i[a b], %i[c e], %i[f d]], - [%i[a b], %i[c f], %i[e d]] + [Set[:b, :c], Set[:d, :a], Set[:e, :f]], + [Set[:b, :d], Set[:c, :a], Set[:e, :f]], + [Set[:a, :c], Set[:d, :b], Set[:e, :f]], + [Set[:a, :d], Set[:c, :b], Set[:e, :f]], + [Set[:b, :e], Set[:c, :d], Set[:f, :a]], + [Set[:b, :f], Set[:c, :d], Set[:e, :a]], + [Set[:a, :e], Set[:c, :d], Set[:f, :b]], + [Set[:a, :f], Set[:c, :d], Set[:e, :b]], + [Set[:a, :b], Set[:d, :e], Set[:f, :c]], + [Set[:a, :b], Set[:d, :f], Set[:e, :c]], + [Set[:a, :b], Set[:c, :e], Set[:f, :d]], + [Set[:a, :b], Set[:c, :f], Set[:e, :d]] ) end end From 1fcca3857627b12a0e5666db34a71071aebc41c7 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 12:35:41 +0100 Subject: [PATCH 100/283] Implement shift perturbation --- app/jobs/table_simulator_job.rb | 1 + app/services/tables/shift.rb | 30 +++++++++++++++++ spec/services/tables/shift_spec.rb | 53 ++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 app/services/tables/shift.rb create mode 100644 spec/services/tables/shift_spec.rb diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index 0b90396..ef91719 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -7,6 +7,7 @@ class TableSimulatorJob < ApplicationJob engine = VNS::Engine.new engine.add_perturbation(Tables::Swap) + engine.add_perturbation(Tables::Shift) initial_solution = Tables::Distribution.new(min_per_table: 8, max_per_table: 10) initial_solution.random_distribution(Guest.potential.shuffle) diff --git a/app/services/tables/shift.rb b/app/services/tables/shift.rb new file mode 100644 index 0000000..6ae7c94 --- /dev/null +++ b/app/services/tables/shift.rb @@ -0,0 +1,30 @@ +# Copyright (C) 2024 Manuel Bustillo + +module Tables + class Shift + private attr_reader :initial_solution + def initialize(initial_solution) + @initial_solution = initial_solution + end + + def each + @initial_solution.tables.permutation(2) do |table_a, table_b| + table_a.dup.each do |person| + original_discomfort_a = table_a.reset + original_discomfort_b = table_b.reset + + table_a.delete(person) + table_b << person + + yield(@initial_solution) + ensure + table_b.delete(person) + table_a << person + + table_a.discomfort = original_discomfort_a + table_b.discomfort = original_discomfort_b + end + end + end + end +end diff --git a/spec/services/tables/shift_spec.rb b/spec/services/tables/shift_spec.rb new file mode 100644 index 0000000..4c24927 --- /dev/null +++ b/spec/services/tables/shift_spec.rb @@ -0,0 +1,53 @@ +require 'rails_helper' + +module Tables + RSpec.describe Shift do + describe '#each' do + let(:shifts) do + acc = [] + described_class.new(initial_solution).each do |solution| + acc << solution.tables.map(&:dup) + end + acc + end + + context 'when there are two tables with two people each' do + let(:initial_solution) do + Distribution.new(min_per_table: 2, max_per_table: 2).tap do |distribution| + distribution.tables << Set[:a, :b].to_table + distribution.tables << Set[:c, :d].to_table + end + end + + it 'yields all possible shifts between the tables' do + expect(shifts).to contain_exactly( + [Set[:b], Set[:c, :d, :a]], + [Set[:a], Set[:c, :d, :b]], + [Set[:b, :a, :d], Set[:c]], + [Set[:b, :a, :c], Set[:d]] + ) + end + end + + context 'when there are two tables with three people each' do + let(:initial_solution) do + Distribution.new(min_per_table: 3, max_per_table: 3).tap do |distribution| + distribution.tables << Set[:a, :b, :c].to_table + distribution.tables << Set[:d, :e, :f].to_table + end + end + + it 'yields all possible shifts between the tables' do + expect(shifts).to contain_exactly( + [Set[:b, :c], Set[:d, :e, :f, :a]], + [Set[:c, :a], Set[:d, :e, :f, :b]], + [Set[:a, :b], Set[:d, :e, :f, :c]], + [Set[:a, :b, :c, :d], Set[:e, :f]], + [Set[:a, :b, :c, :e], Set[:d, :f]], + [Set[:a, :b, :c, :f], Set[:d, :e]] + ) + end + end + end + end +end From bcf00fabf0668b07507a014c4b46efe1284a254e Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 17:01:57 +0000 Subject: [PATCH 101/283] Add copyright notice --- spec/services/tables/shift_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/services/tables/shift_spec.rb b/spec/services/tables/shift_spec.rb index 4c24927..e4c48af 100644 --- a/spec/services/tables/shift_spec.rb +++ b/spec/services/tables/shift_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' module Tables From 5b36526c599d57601afab487769254517aaceb66 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 18:40:26 +0100 Subject: [PATCH 102/283] Increase penalty for tables under minimum capacity --- app/services/tables/discomfort_calculator.rb | 2 +- spec/services/tables/discomfort_calculator_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index 9942bf0..c21796a 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -22,7 +22,7 @@ module Tables # def table_size_penalty case table.size - when 0...table.min_per_table then 2 * (table.min_per_table - table.size) + when 0...table.min_per_table then 5 * (table.min_per_table - table.size) when table.min_per_table..table.max_per_table then 0 else 5 * (table.size - table.max_per_table) end diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index eab291b..99fb3d0 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -49,13 +49,13 @@ module Tables context 'when the number of guests is one unit below the lower bound' do let(:table) { Table.new(create_list(:guest, 4)) } - it { expect(calculator.send(:table_size_penalty)).to eq(2) } + it { expect(calculator.send(:table_size_penalty)).to eq(5) } end context 'when the number of guests is two units below the lower bound' do let(:table) { Table.new(create_list(:guest, 3)) } - it { expect(calculator.send(:table_size_penalty)).to eq(4) } + it { expect(calculator.send(:table_size_penalty)).to eq(10) } end context 'when the number of guests is one unit above the upper bound' do From f2e91c8d7acb8af31fddad5b990fd9c200692066 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 18:55:04 +0100 Subject: [PATCH 103/283] Run perturbations in both orders --- app/services/vns/engine.rb | 11 +++++++++-- spec/services/vns/engine_spec.rb | 13 +++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 spec/services/vns/engine_spec.rb diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index 00f2c80..65ceb71 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -2,6 +2,13 @@ module VNS class Engine + class << self + def sequence(elements) + elements = elements.to_a + (elements + elements.reverse).chunk(&:itself).map(&:first) + end + end + def target_function(&function) @target_function = function end @@ -23,12 +30,12 @@ module VNS puts "Initial score: #{@best_score.to_f}" - @perturbations.each do |perturbation| + self.class.sequence(@perturbations).each do |perturbation| puts "Running perturbation: #{perturbation.name}" optimize(perturbation.new(@best_solution)) end - @best_solution + @best_solution end private diff --git a/spec/services/vns/engine_spec.rb b/spec/services/vns/engine_spec.rb new file mode 100644 index 0000000..974f342 --- /dev/null +++ b/spec/services/vns/engine_spec.rb @@ -0,0 +1,13 @@ +require 'rails_helper' + +module VNS + RSpec.describe Engine do + describe '.sequence' do + it { expect(described_class.sequence([])).to eq([]) } + it { expect(described_class.sequence([1])).to eq([1]) } + it { expect(described_class.sequence([1, 2])).to eq([1, 2, 1]) } + it { expect(described_class.sequence([1, 2, 3])).to eq([1, 2, 3, 2, 1]) } + it { expect(described_class.sequence([1, 2, 3, 4])).to eq([1, 2, 3, 4, 3, 2, 1]) } + end + end +end From fe91f75ec077b1369c8f67fcf6bf09840612c7ef Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 17:57:29 +0000 Subject: [PATCH 104/283] Add copyright notice --- spec/services/vns/engine_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/services/vns/engine_spec.rb b/spec/services/vns/engine_spec.rb index 974f342..d4064f6 100644 --- a/spec/services/vns/engine_spec.rb +++ b/spec/services/vns/engine_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' module VNS From 6f19e4f1bde11f8d46384cd41ea57eadd6081a05 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 20:37:58 +0100 Subject: [PATCH 105/283] Remove rake task leftover --- lib/tasks/vns.rake | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 lib/tasks/vns.rake diff --git a/lib/tasks/vns.rake b/lib/tasks/vns.rake deleted file mode 100644 index d3a31d0..0000000 --- a/lib/tasks/vns.rake +++ /dev/null @@ -1,5 +0,0 @@ -namespace :vns do - task distribute_tables: :environment do - - end -end From 810d0740f3babc3c3df51a085583002e1e291ee6 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 20:40:37 +0100 Subject: [PATCH 106/283] Define an endpoint to expose the list of expenses --- app/controllers/expenses_controller.rb | 4 ++++ config/routes.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index e208a12..0077568 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -4,4 +4,8 @@ class ExpensesController < ApplicationController def summary render json: Expenses::TotalQuery.new.call end + + def index + render json: Expense.all.order(pricing_type: :asc, amount: :desc).as_json(only: %i[id name amount pricing_type]) + end end diff --git a/config/routes.rb b/config/routes.rb index a7b4d0c..df17dac 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ Rails.application.routes.draw do post :import, on: :collection post :bulk_update, on: :collection end - resources :expenses do + resources :expenses, only: :index do get :summary, on: :collection end resources :tables_arrangements, only: [:index, :show] From bd5c4f54821584aad12145b9b625bac11182004e Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 11 Nov 2024 07:43:42 +0100 Subject: [PATCH 107/283] Merge first and last name and expose guest update endpoint --- app/controllers/guests_controller.rb | 17 ++++------------- .../tables_arrangements_controller.rb | 3 ++- app/models/guest.rb | 4 ---- app/serializers/serializable_guest.rb | 2 +- app/services/tables/distribution.rb | 2 +- app/use_cases/guests/update_use_case.rb | 2 ++ config/routes.rb | 5 ++--- db/migrate/20241111063741_merge_guest_names.rb | 17 +++++++++++++++++ db/schema.rb | 9 +++------ db/seeds.rb | 3 +-- spec/factories/guest.rb | 3 +-- spec/models/guest_spec.rb | 8 -------- 12 files changed, 34 insertions(+), 41 deletions(-) create mode 100644 db/migrate/20241111063741_merge_guest_names.rb diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index de6127d..18dc949 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -6,23 +6,14 @@ class GuestsController < ApplicationController def index @guests = Guest.all.includes(:group) .joins(:group) - .order('groups.name' => :asc, first_name: :asc, last_name: :asc) + .order('groups.name' => :asc, name: :asc) render jsonapi: @guests end - def import - csv = CSV.parse(params[:file].read, headers: true) - ActiveRecord::Base.transaction do - csv.each do |row| - guest = Guest.create!(first_name: row['name']) - - guest.affinity_group_list.add(row['affinity_group']) - guest.save! - end - end - - redirect_to guests_url + def update + Guests::UpdateUseCase.new(guest_ids: [params[:id]], params: params.require(:guest).permit(:name)).call + render json: {}, status: :ok end def bulk_update diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index 689949c..87bcc4c 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -11,7 +11,8 @@ class TablesArrangementsController < ApplicationController .order('guests.group_id') .pluck( :table_number, - Arel.sql("guests.first_name || ' ' || guests.last_name "), 'guests.id', + 'guests.name', + 'guests.id', 'groups.color' ) .group_by(&:first) diff --git a/app/models/guest.rb b/app/models/guest.rb index 774eee3..bfa1265 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -12,8 +12,4 @@ class Guest < ApplicationRecord } scope :potential, -> { where.not(status: %i[declined considered]) } - - def full_name - "#{first_name} #{last_name}" - end end diff --git a/app/serializers/serializable_guest.rb b/app/serializers/serializable_guest.rb index d711d03..e411307 100644 --- a/app/serializers/serializable_guest.rb +++ b/app/serializers/serializable_guest.rb @@ -6,7 +6,7 @@ class SerializableGuest < JSONAPI::Serializable::Resource attributes :id, :group_id, :status attribute :name do - "#{@object.first_name} #{@object.last_name}" + @object.name end attribute :group_name do diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 52621c3..9236007 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -33,7 +33,7 @@ module Tables def pretty_print @tables.map.with_index do |table, i| - "Table #{i + 1} (#{table.count} ppl): (#{local_discomfort(table)}) #{table.map(&:full_name).join(', ')}" + "Table #{i + 1} (#{table.count} ppl): (#{local_discomfort(table)}) #{table.map(&:name).join(', ')}" end.join("\n") end diff --git a/app/use_cases/guests/update_use_case.rb b/app/use_cases/guests/update_use_case.rb index d31a982..3d82c52 100644 --- a/app/use_cases/guests/update_use_case.rb +++ b/app/use_cases/guests/update_use_case.rb @@ -12,6 +12,8 @@ module Guests Guest.where(id: guest_ids).update!(params) # TODO: Not all status transitions may require a table re-arrangement + return unless params.key?(:status) + TablesArrangement.delete_all ActiveJob.perform_all_later(50.times.map { TableSimulatorJob.new }) diff --git a/config/routes.rb b/config/routes.rb index df17dac..dd8654a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,13 +3,12 @@ Rails.application.routes.draw do resources :groups, only: :index resources :guests do - post :import, on: :collection post :bulk_update, on: :collection end - resources :expenses, only: :index do + resources :expenses, only: %i[index update] do get :summary, on: :collection end - resources :tables_arrangements, only: [:index, :show] + resources :tables_arrangements, only: %i[index show] get 'up' => 'rails/health#show', as: :rails_health_check end diff --git a/db/migrate/20241111063741_merge_guest_names.rb b/db/migrate/20241111063741_merge_guest_names.rb new file mode 100644 index 0000000..21cdfa6 --- /dev/null +++ b/db/migrate/20241111063741_merge_guest_names.rb @@ -0,0 +1,17 @@ +class MergeGuestNames < ActiveRecord::Migration[8.0] + def change + add_column :guests, :name, :string + + reversible do |dir| + dir.up do + execute <<~SQL + UPDATE guests + SET name = CONCAT(first_name, ' ', last_name) + SQL + end + end + + remove_column :guests, :first_name, :string + remove_column :guests, :last_name, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index b2643a7..7107478 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,9 +10,9 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_11_03_133122) do +ActiveRecord::Schema[8.0].define(version: 2024_11_11_063741) do # These are extensions that must be enabled in order to support this database - enable_extension "plpgsql" + enable_extension "pg_catalog.plpgsql" # Custom types defined in this database. # Note that some types may not work with other database engines. Be careful if changing database. @@ -41,13 +39,12 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_03_133122) do end create_table "guests", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| - t.string "first_name" - t.string "last_name" t.string "phone" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.uuid "group_id", null: false t.integer "status", default: 0 + t.string "name" t.index ["group_id"], name: "index_guests_on_group_id" end diff --git a/db/seeds.rb b/db/seeds.rb index bd9417a..42c175e 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -56,8 +56,7 @@ groups = Group.all NUMBER_OF_GUESTS.times do Guest.create!( - first_name: Faker::Name.first_name, - last_name: Faker::Name.last_name, + name: Faker::Name.name, phone: Faker::PhoneNumber.cell_phone, group: groups.sample, status: Guest.statuses.keys.sample diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index 2637fb4..4c9b58a 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -4,8 +4,7 @@ FactoryBot.define do factory :guest do association :group - first_name { Faker::Name.first_name } - last_name { Faker::Name.last_name } + name { Faker::Name.name } phone { Faker::PhoneNumber.cell_phone } end end diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index 6861079..bd560af 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -28,12 +28,4 @@ RSpec.describe Guest, type: :model do end end end - - describe '#full_name' do - it 'returns the full name of the guest' do - guest = create(:guest, first_name: 'John', last_name: 'Doe') - - expect(guest.full_name).to eq('John Doe') - end - end end From 3b9ca24bcdc88c6c86a9f09cfa82c39ca7a2b0fc Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 11 Nov 2024 06:57:39 +0000 Subject: [PATCH 108/283] Add copyright notice --- db/migrate/20241111063741_merge_guest_names.rb | 2 ++ db/schema.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/db/migrate/20241111063741_merge_guest_names.rb b/db/migrate/20241111063741_merge_guest_names.rb index 21cdfa6..849f58f 100644 --- a/db/migrate/20241111063741_merge_guest_names.rb +++ b/db/migrate/20241111063741_merge_guest_names.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class MergeGuestNames < ActiveRecord::Migration[8.0] def change add_column :guests, :name, :string diff --git a/db/schema.rb b/db/schema.rb index 7107478..c54ec05 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From 88a7785b469d13e54c256311373817ad935eb092 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 11 Nov 2024 08:08:49 +0100 Subject: [PATCH 109/283] Define endpoint to update expenses --- app/controllers/expenses_controller.rb | 11 +++++++++++ config/routes.rb | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 0077568..297fa80 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -8,4 +8,15 @@ class ExpensesController < ApplicationController def index render json: Expense.all.order(pricing_type: :asc, amount: :desc).as_json(only: %i[id name amount pricing_type]) end + + def update + Expense.find(params[:id]).update!(expense_params) + render json: {}, status: :ok + end + + private + + def expense_params + params.require(:expense).permit(:name, :amount, :pricing_type) + end end diff --git a/config/routes.rb b/config/routes.rb index dd8654a..7e40865 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,7 +2,7 @@ Rails.application.routes.draw do resources :groups, only: :index - resources :guests do + resources :guests, only: %i[index update] do post :bulk_update, on: :collection end resources :expenses, only: %i[index update] do From 94bf7077236cf14a555c12398e563c8da5a553e3 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 12 Nov 2024 01:07:37 +0000 Subject: [PATCH 110/283] Update dependency factory_bot_rails to v6.4.4 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ac22d73..fa7df0e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -287,7 +287,7 @@ GEM rubytree (2.1.0) json (~> 2.0, > 2.3.1) rubyzip (2.3.2) - securerandom (0.3.1) + securerandom (0.3.2) shoulda-matchers (6.4.0) activesupport (>= 5.2.0) solid_queue (1.0.1) From 452b5b2040061e760b761e539373212491083cfd Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Wed, 13 Nov 2024 08:57:20 +0100 Subject: [PATCH 111/283] Introduce endpoint to retrieve a summary of groups and invite attendance --- app/controllers/groups_controller.rb | 3 +- app/models/group.rb | 2 + app/queries/groups/summary_query.rb | 29 +++++++ spec/queries/groups/summary_query_spec.rb | 96 +++++++++++++++++++++++ 4 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 app/queries/groups/summary_query.rb create mode 100644 spec/queries/groups/summary_query_spec.rb diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 232ac85..37df884 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -2,7 +2,6 @@ class GroupsController < ApplicationController def index - roots = Group.where(parent_id: nil) - render jsonapi: roots, include: [children: [children: [:children]]] + render json: Groups::SummaryQuery.new.call.as_json end end diff --git a/app/models/group.rb b/app/models/group.rb index 105d08c..b06c1ba 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -30,6 +30,8 @@ class Group < ApplicationRecord private def set_color + return if color.present? + new_color = "##{SecureRandom.hex(3)}".paint new_color = new_color.lighten(30) if new_color.dark? self.color = new_color diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb new file mode 100644 index 0000000..830ab59 --- /dev/null +++ b/app/queries/groups/summary_query.rb @@ -0,0 +1,29 @@ +module Groups + class SummaryQuery + def call + ActiveRecord::Base.connection.execute(query).to_a + end + + private + + def query + <<~SQL.squish + SELECT#{' '} + groups.id, + groups.name, + groups.icon, + groups.parent_id, + groups.color, + count(*) filter (where status IS NOT NULL) as total, + count(*) filter (where status = 0) as considered, + count(*) filter (where status = 10) as invited, + count(*) filter (where status = 20) as confirmed, + count(*) filter (where status = 30) as declined, + count(*) filter (where status = 40) as tentative + FROM groups + LEFT JOIN guests on groups.id = guests.group_id + GROUP BY groups.id + SQL + end + end +end diff --git a/spec/queries/groups/summary_query_spec.rb b/spec/queries/groups/summary_query_spec.rb new file mode 100644 index 0000000..71650c9 --- /dev/null +++ b/spec/queries/groups/summary_query_spec.rb @@ -0,0 +1,96 @@ +require 'rails_helper' + +module Groups + RSpec.describe SummaryQuery do + describe '#call' do + subject { described_class.new.call } + + context 'when there are no groups' do + it { is_expected.to eq([]) } + end + + context 'when groups are defined' do + let!(:parent) { create(:group, name: 'Friends', icon: 'icon-1', color: '#FF0000') } + let!(:child) { create(:group, name: 'Family', icon: 'icon-2', color: '#00FF00', parent:) } + + context 'when there are no guests' do + it 'returns the summary of groups' do + is_expected.to contain_exactly( + { 'id' => parent.id, + 'name' => 'Friends', + 'icon' => 'icon-1', + 'parent_id' => nil, + 'color' => '#FF0000', + 'total' => 0, + 'considered' => 0, + 'invited' => 0, + 'confirmed' => 0, + 'declined' => 0, + 'tentative' => 0 }, + { 'id' => child.id, + 'name' => 'Family', + 'icon' => 'icon-2', + 'parent_id' => parent.id, + 'color' => '#00FF00', + 'total' => 0, + 'considered' => 0, + 'invited' => 0, + 'confirmed' => 0, + 'declined' => 0, + 'tentative' => 0 } + ) + end + end + + context 'when there are guests' do + before do + # Parent group + create_list(:guest, 2, group: parent, status: :considered) + create_list(:guest, 3, group: parent, status: :invited) + create_list(:guest, 4, group: parent, status: :confirmed) + create_list(:guest, 5, group: parent, status: :declined) + create_list(:guest, 6, group: parent, status: :tentative) + + # Child group + create_list(:guest, 7, group: child, status: :considered) + create_list(:guest, 8, group: child, status: :invited) + create_list(:guest, 9, group: child, status: :confirmed) + create_list(:guest, 10, group: child, status: :declined) + create_list(:guest, 11, group: child, status: :tentative) + end + + it 'returns the summary of groups' do + is_expected.to contain_exactly( + { + 'id' => parent.id, + 'name' => 'Friends', + 'icon' => 'icon-1', + 'parent_id' => nil, + 'color' => '#FF0000', + 'total' => 20, + 'considered' => 2, + 'invited' => 3, + 'confirmed' => 4, + 'declined' => 5, + 'tentative' => 6 + }, + { + 'id' => child.id, + 'name' => 'Family', + 'icon' => 'icon-2', + 'parent_id' => parent.id, + 'color' => '#00FF00', + 'total' => 45, + 'considered' => 7, + 'invited' => 8, + 'confirmed' => 9, + 'declined' => 10, + 'tentative' => 11 + } + ) + end + end + end + end + end +end From 4be1fc6cad084a581009b48e5da90fdf9460d1eb Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Wed, 13 Nov 2024 07:59:07 +0000 Subject: [PATCH 112/283] Add copyright notice --- app/queries/groups/summary_query.rb | 2 ++ spec/queries/groups/summary_query_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb index 830ab59..637a508 100644 --- a/app/queries/groups/summary_query.rb +++ b/app/queries/groups/summary_query.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module Groups class SummaryQuery def call diff --git a/spec/queries/groups/summary_query_spec.rb b/spec/queries/groups/summary_query_spec.rb index 71650c9..6e2c3d2 100644 --- a/spec/queries/groups/summary_query_spec.rb +++ b/spec/queries/groups/summary_query_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' module Groups From 1a4067859d2fed3281bbbca3b0c2ae1e925043bc Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 14 Nov 2024 01:06:51 +0000 Subject: [PATCH 113/283] Update dependency factory_bot_rails to v6.4.4 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index fa7df0e..53299b7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -205,7 +205,7 @@ GEM rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rackup (2.2.0) + rackup (2.2.1) rack (>= 3) rails (8.0.0) actioncable (= 8.0.0) From 42f5f7b246f21d29499d86a72a5da515ee88316c Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Thu, 14 Nov 2024 07:33:24 +0000 Subject: [PATCH 114/283] Add copyright notice --- db/schema.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/schema.rb b/db/schema.rb index 7107478..c54ec05 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From 2fc4e2debd5bc0a2f3e6957413122036b909b7b6 Mon Sep 17 00:00:00 2001 From: Bustikiller Date: Thu, 14 Nov 2024 09:40:53 +0100 Subject: [PATCH 115/283] Use a setup-ruby version that has ruby 3.3.6 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9f2572f..36f5b06 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} - - uses: ruby/setup-ruby@v1 + - uses: ruby/setup-ruby@v1.202.0 - run: bundle install - name: Wait until Postgres is ready to accept connections run: | From 4cd3f24032e422bd2a4ea21562364dda79376eff Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 15 Nov 2024 08:33:31 +0100 Subject: [PATCH 116/283] Fix ruby version used to run license finder --- .github/workflows/license_finder.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/license_finder.yml b/.github/workflows/license_finder.yml index 7536a95..01c120e 100644 --- a/.github/workflows/license_finder.yml +++ b/.github/workflows/license_finder.yml @@ -8,15 +8,15 @@ concurrency: group: ${{ github.ref }} cancel-in-progress: true jobs: - build-static-assets: + check-licenses: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} - - uses: ruby/setup-ruby@v1 + - uses: ruby/setup-ruby@v1.202.0 with: - ruby-version: '3.3' + ruby-version: '3.3.6' - name: Install project dependencies run: bundle install --jobs `getconf _NPROCESSORS_ONLN` - name: Run license finder From c37713af8fbfe07a317c9f1e14ff42ddd5b87051 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 15 Nov 2024 01:08:19 +0000 Subject: [PATCH 117/283] Update dependency factory_bot_rails to v6.4.4 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8b7b155..d34808a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -318,7 +318,7 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.6.0) - uri (1.0.1) + uri (1.0.2) useragent (0.16.10) web-console (4.2.1) actionview (>= 6.0.0) From 8a3469447ba4f08695c5beb80d57df9236cafea6 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 15 Nov 2024 08:45:56 +0100 Subject: [PATCH 118/283] Install rswag gem with default configuration --- Gemfile | 1 + Gemfile.lock | 21 ++++++++++++++++ config/initializers/rswag_api.rb | 14 +++++++++++ config/initializers/rswag_ui.rb | 16 ++++++++++++ config/routes.rb | 2 ++ spec/swagger_helper.rb | 43 ++++++++++++++++++++++++++++++++ 6 files changed, 97 insertions(+) create mode 100644 config/initializers/rswag_api.rb create mode 100644 config/initializers/rswag_ui.rb create mode 100644 spec/swagger_helper.rb diff --git a/Gemfile b/Gemfile index e3f3306..81b24ff 100644 --- a/Gemfile +++ b/Gemfile @@ -28,6 +28,7 @@ group :development, :test do gem 'license_finder' gem 'pry' gem 'rspec-rails', '~> 7.1.0' + gem 'rswag' gem 'shoulda-matchers', '~> 6.0' end diff --git a/Gemfile.lock b/Gemfile.lock index 8b7b155..9667dfe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -72,6 +72,8 @@ GEM securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) annotaterb (4.13.0) ast (2.4.2) babel-source (5.8.35) @@ -127,6 +129,8 @@ GEM actionview (>= 5.0.0) activesupport (>= 5.0.0) json (2.7.5) + json-schema (5.0.1) + addressable (~> 2.8) jsonapi-deserializable (0.2.0) jsonapi-parser (0.1.1) jsonapi-rails (0.4.1) @@ -195,6 +199,7 @@ GEM method_source (~> 1.0) psych (5.2.0) stringio + public_suffix (6.0.1) puma (6.4.3) nio4r (~> 2.0) raabro (1.4.0) @@ -272,6 +277,21 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.1) + rswag (2.16.0) + rswag-api (= 2.16.0) + rswag-specs (= 2.16.0) + rswag-ui (= 2.16.0) + rswag-api (2.16.0) + activesupport (>= 5.2, < 8.1) + railties (>= 5.2, < 8.1) + rswag-specs (2.16.0) + activesupport (>= 5.2, < 8.1) + json-schema (>= 2.2, < 6.0) + railties (>= 5.2, < 8.1) + rspec-core (>= 2.14) + rswag-ui (2.16.0) + actionpack (>= 5.2, < 8.1) + railties (>= 5.2, < 8.1) rubocop (1.68.0) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -362,6 +382,7 @@ DEPENDENCIES react-rails redis (>= 4.0.1) rspec-rails (~> 7.1.0) + rswag rubocop rubytree shoulda-matchers (~> 6.0) diff --git a/config/initializers/rswag_api.rb b/config/initializers/rswag_api.rb new file mode 100644 index 0000000..c4462b2 --- /dev/null +++ b/config/initializers/rswag_api.rb @@ -0,0 +1,14 @@ +Rswag::Api.configure do |c| + + # Specify a root folder where Swagger JSON files are located + # This is used by the Swagger middleware to serve requests for API descriptions + # NOTE: If you're using rswag-specs to generate Swagger, you'll need to ensure + # that it's configured to generate files in the same folder + c.openapi_root = Rails.root.to_s + '/swagger' + + # Inject a lambda function to alter the returned Swagger prior to serialization + # The function will have access to the rack env for the current request + # For example, you could leverage this to dynamically assign the "host" property + # + #c.swagger_filter = lambda { |swagger, env| swagger['host'] = env['HTTP_HOST'] } +end diff --git a/config/initializers/rswag_ui.rb b/config/initializers/rswag_ui.rb new file mode 100644 index 0000000..1d6151b --- /dev/null +++ b/config/initializers/rswag_ui.rb @@ -0,0 +1,16 @@ +Rswag::Ui.configure do |c| + + # List the Swagger endpoints that you want to be documented through the + # swagger-ui. The first parameter is the path (absolute or relative to the UI + # host) to the corresponding endpoint and the second is a title that will be + # displayed in the document selector. + # NOTE: If you're using rspec-api to expose Swagger files + # (under openapi_root) as JSON or YAML endpoints, then the list below should + # correspond to the relative paths for those endpoints. + + c.swagger_endpoint '/api-docs/v1/swagger.yaml', 'API V1 Docs' + + # Add Basic Auth in case your API is private + # c.basic_auth_enabled = true + # c.basic_auth_credentials 'username', 'password' +end diff --git a/config/routes.rb b/config/routes.rb index 7e40865..80aa2e0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,8 @@ # Copyright (C) 2024 Manuel Bustillo Rails.application.routes.draw do + mount Rswag::Ui::Engine => '/api-docs' + mount Rswag::Api::Engine => '/api-docs' resources :groups, only: :index resources :guests, only: %i[index update] do post :bulk_update, on: :collection diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb new file mode 100644 index 0000000..14c1214 --- /dev/null +++ b/spec/swagger_helper.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.configure do |config| + # Specify a root folder where Swagger JSON files are generated + # NOTE: If you're using the rswag-api to serve API descriptions, you'll need + # to ensure that it's configured to serve Swagger from the same folder + config.openapi_root = Rails.root.join('swagger').to_s + + # Define one or more Swagger documents and provide global metadata for each one + # When you run the 'rswag:specs:swaggerize' rake task, the complete Swagger will + # be generated at the provided relative path under openapi_root + # By default, the operations defined in spec files are added to the first + # document below. You can override this behavior by adding a openapi_spec tag to the + # the root example_group in your specs, e.g. describe '...', openapi_spec: 'v2/swagger.json' + config.openapi_specs = { + 'v1/swagger.yaml' => { + openapi: '3.0.1', + info: { + title: 'API V1', + version: 'v1' + }, + paths: {}, + servers: [ + { + url: 'https://{defaultHost}', + variables: { + defaultHost: { + default: 'www.example.com' + } + } + } + ] + } + } + + # Specify the format of the output Swagger file when running 'rswag:specs:swaggerize'. + # The openapi_specs configuration option has the filename including format in + # the key, this may want to be changed to avoid putting yaml in json files. + # Defaults to json. Accepts ':json' and ':yaml'. + config.openapi_format = :yaml +end From bcbcf9b469f4992928077d4e352d6caa89e39f67 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 15 Nov 2024 18:28:45 +0100 Subject: [PATCH 119/283] MVP of swagger documentation --- .gitignore | 3 +++ Dockerfile.dev | 2 +- config/initializers/rswag_ui.rb | 2 +- spec/requests/groups_spec.rb | 19 +++++++++++++++++++ spec/swagger_helper.rb | 4 ++-- 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 spec/requests/groups_spec.rb diff --git a/.gitignore b/.gitignore index 5fb66c9..13e3051 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ # Ignore master key for decrypting credentials and more. /config/master.key + +# Ignore swagger generated documentation +swagger/v1/swagger.yaml diff --git a/Dockerfile.dev b/Dockerfile.dev index 792a1ce..f911e52 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,7 +1,7 @@ # syntax = docker/dockerfile:1 # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.3.5 +ARG RUBY_VERSION=3.3.6 FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base # Rails app lives here diff --git a/config/initializers/rswag_ui.rb b/config/initializers/rswag_ui.rb index 1d6151b..30172aa 100644 --- a/config/initializers/rswag_ui.rb +++ b/config/initializers/rswag_ui.rb @@ -8,7 +8,7 @@ Rswag::Ui.configure do |c| # (under openapi_root) as JSON or YAML endpoints, then the list below should # correspond to the relative paths for those endpoints. - c.swagger_endpoint '/api-docs/v1/swagger.yaml', 'API V1 Docs' + c.swagger_endpoint '/api/api-docs/v1/swagger.yaml', 'API V1 Docs' # Add Basic Auth in case your API is private # c.basic_auth_enabled = true diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb new file mode 100644 index 0000000..4dcfd71 --- /dev/null +++ b/spec/requests/groups_spec.rb @@ -0,0 +1,19 @@ +require 'swagger_helper' + +RSpec.describe 'groups', type: :request do + path '/groups' do + get('list groups') do + response(200, 'successful') do + + after do |example| + example.metadata[:response][:content] = { + 'application/json' => { + example: JSON.parse(response.body, symbolize_names: true) + } + } + end + run_test! + end + end + end +end diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index 14c1214..2cae0bb 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -24,10 +24,10 @@ RSpec.configure do |config| paths: {}, servers: [ { - url: 'https://{defaultHost}', + url: 'http://{defaultHost}/api', variables: { defaultHost: { - default: 'www.example.com' + default: 'libre-wedding-planner.app.localhost' } } } From 41cb719bf49b2e9630347a1bdc0296f97f3f9eb5 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 15 Nov 2024 17:29:56 +0000 Subject: [PATCH 120/283] Add copyright notice --- config/initializers/rswag_api.rb | 2 ++ config/initializers/rswag_ui.rb | 2 ++ spec/requests/groups_spec.rb | 2 ++ spec/swagger_helper.rb | 2 ++ 4 files changed, 8 insertions(+) diff --git a/config/initializers/rswag_api.rb b/config/initializers/rswag_api.rb index c4462b2..5c46141 100644 --- a/config/initializers/rswag_api.rb +++ b/config/initializers/rswag_api.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + Rswag::Api.configure do |c| # Specify a root folder where Swagger JSON files are located diff --git a/config/initializers/rswag_ui.rb b/config/initializers/rswag_ui.rb index 30172aa..9540ca4 100644 --- a/config/initializers/rswag_ui.rb +++ b/config/initializers/rswag_ui.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + Rswag::Ui.configure do |c| # List the Swagger endpoints that you want to be documented through the diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index 4dcfd71..eb96268 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'groups', type: :request do diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index 2cae0bb..c9479c3 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true require 'rails_helper' From ca0b1b18d3b83a8614a6e78c1976e1cb80b074e6 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 15 Nov 2024 19:04:22 +0100 Subject: [PATCH 121/283] Use different server URLs for development and testing --- spec/swagger_helper.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index c9479c3..d07a97e 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -26,12 +26,12 @@ RSpec.configure do |config| paths: {}, servers: [ { - url: 'http://{defaultHost}/api', - variables: { - defaultHost: { - default: 'libre-wedding-planner.app.localhost' - } - } + url: '/', + description: 'suitable for testing' + }, + { + url: 'http://libre-wedding-planner.app.localhost/api', + description: 'Suitable for development' } ] } From 94b1066c17dc87b70b076ce899bc2e7a18e91e15 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 15 Nov 2024 19:09:55 +0100 Subject: [PATCH 122/283] Include OpenAPI information in the README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 4d4f615..49752d5 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,16 @@ Unit tests can be executed with bundle exec rspec ``` +## API documentation + +Generate the OpenAPI documentation with the command: + +``` +rake rswag:specs:swaggerize +``` + +The documentation is available in Swagger UI in http://libre-wedding-planner.app.localhost/api/api-docs/index.html. If testing the API through the UI, you will need to select the second server (which includes the `/api` path), intended for development. + ## Contributing Contributions of all kinds (code, UX/UI, testing, translations, etc.) are welcome. The procedures to contribute are still being defined, but don't hesitate to reach out in case you want to participate. From cc3c8fdd6345c7f390c907049459ed81fee69523 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Fri, 15 Nov 2024 19:42:59 +0100 Subject: [PATCH 123/283] Improve documentation of groups endpoint --- app/queries/groups/summary_query.rb | 2 +- spec/requests/groups_spec.rb | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb index 637a508..70fc234 100644 --- a/app/queries/groups/summary_query.rb +++ b/app/queries/groups/summary_query.rb @@ -10,7 +10,7 @@ module Groups def query <<~SQL.squish - SELECT#{' '} + SELECT groups.id, groups.name, groups.icon, diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index eb96268..8bf622b 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -5,15 +5,26 @@ require 'swagger_helper' RSpec.describe 'groups', type: :request do path '/groups' do get('list groups') do + produces 'application/json' response(200, 'successful') do - - after do |example| - example.metadata[:response][:content] = { - 'application/json' => { - example: JSON.parse(response.body, symbolize_names: true) - } - } - end + schema type: :array, + items: { + type: :object, + required: %i[id name icon parent_id color total considered invited confirmed declined tentative], + properties: { + id: { type: :string, format: :uuid, required: true }, + name: { type: :string }, + icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' }, + parent_id: { type: :string, format: :uuid }, + color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' }, + total: { type: :integer, minimum: 0, description: 'Total number of guests in any status' }, + considered: { type: :integer, minimum: 0 }, + invited: { type: :integer, minimum: 0 }, + confirmed: { type: :integer, minimum: 0 }, + declined: { type: :integer, minimum: 0 }, + tentative: { type: :integer, minimum: 0 } + } + } run_test! end end From 6709c6b1f1fa6b170c7e5794dd0f0ae03f07de57 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 16 Nov 2024 01:08:16 +0000 Subject: [PATCH 124/283] Update dependency pry to v0.15.0 --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ca46e1f..c014782 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -161,7 +161,7 @@ GEM net-pop net-smtp marcel (1.0.4) - method_source (1.0.0) + method_source (1.1.0) mini_mime (1.1.5) minitest (5.25.1) money (6.19.0) @@ -194,7 +194,7 @@ GEM ast (~> 2.4.1) racc pg (1.5.9) - pry (0.14.2) + pry (0.15.0) coderay (~> 1.1) method_source (~> 1.0) psych (5.2.0) From 6f6a6aaabf9e38ce5222afd943df28830418dcf6 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 16 Nov 2024 02:16:19 +0100 Subject: [PATCH 125/283] Update format of guests API and document endpoints --- app/controllers/application_controller.rb | 46 +++++++++--- app/controllers/guests_controller.rb | 11 ++- app/models/guest.rb | 4 +- spec/models/guest_spec.rb | 19 ++--- spec/requests/groups_spec.rb | 3 +- spec/requests/guests_spec.rb | 87 +++++++++++++++++++++++ spec/swagger_helper.rb | 12 ++++ spec/swagger_response_helper.rb | 36 ++++++++++ 8 files changed, 193 insertions(+), 25 deletions(-) create mode 100644 spec/requests/guests_spec.rb create mode 100644 spec/swagger_response_helper.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index eda95cc..57926f3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,15 +1,43 @@ # Copyright (C) 2024 Manuel Bustillo class ApplicationController < ActionController::Base - after_action :set_csrf_cookie + after_action :set_csrf_cookie - private + skip_before_action :verify_authenticity_token, if: :development_swagger? - def set_csrf_cookie - cookies["csrf-token"] = { - value: form_authenticity_token, - secure: Rails.env.production?, - same_site: :strict, - } - end + rescue_from ActiveRecord::RecordInvalid do |exception| + render json: { + message: 'Record invalid', + errors: exception.record.errors.full_messages + }, status: :unprocessable_entity + end + + rescue_from ActionController::ParameterMissing do |exception| + render json: { + message: 'Parameter missing', + errors: [exception.message] + }, status: :bad_request + end + + rescue_from ActiveRecord::RecordNotFound do |exception| + render json: { + message: 'Record not found', + errors: [exception.message] + }, status: :not_found + end + + private + + def development_swagger? + Rails.env.test? || + Rails.env.development? && request.headers['referer'].include?('/api-docs/index.html') + end + + def set_csrf_cookie + cookies['csrf-token'] = { + value: form_authenticity_token, + secure: Rails.env.production?, + same_site: :strict + } + end end diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 18dc949..efc3e58 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -4,15 +4,14 @@ require 'csv' class GuestsController < ApplicationController def index - @guests = Guest.all.includes(:group) - .joins(:group) - .order('groups.name' => :asc, name: :asc) - - render jsonapi: @guests + render json: Guest.all.includes(:group) + .joins(:group) + .order('groups.name' => :asc, name: :asc) + .as_json(only: %i[id name status], include: { group: { only: %i[id name] } }) end def update - Guests::UpdateUseCase.new(guest_ids: [params[:id]], params: params.require(:guest).permit(:name)).call + Guest.find(params[:id]).update!(params.require(:guest).permit(:name)) render json: {}, status: :ok end diff --git a/app/models/guest.rb b/app/models/guest.rb index 6b8f70e..8e794f2 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -29,7 +29,9 @@ class Guest < ApplicationRecord confirmed: 20, declined: 30, tentative: 40 - } + }, validate: true + + validates :name, presence: true scope :potential, -> { where.not(status: %i[declined considered]) } end diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index bd560af..b484464 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -3,14 +3,17 @@ require 'rails_helper' RSpec.describe Guest, type: :model do - it do - should define_enum_for(:status).with_values( - considered: 0, - invited: 10, - confirmed: 20, - declined: 30, - tentative: 40 - ) + describe 'validations' do + it { should validate_presence_of(:name) } + it do + should define_enum_for(:status).with_values( + considered: 0, + invited: 10, + confirmed: 20, + declined: 30, + tentative: 40 + ) + end end it { should belong_to(:group) } diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index 8bf622b..597848f 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -5,6 +5,7 @@ require 'swagger_helper' RSpec.describe 'groups', type: :request do path '/groups' do get('list groups') do + tags 'Groups' produces 'application/json' response(200, 'successful') do schema type: :array, @@ -25,7 +26,7 @@ RSpec.describe 'groups', type: :request do tentative: { type: :integer, minimum: 0 } } } - run_test! + xit end end end diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb new file mode 100644 index 0000000..3cde46f --- /dev/null +++ b/spec/requests/guests_spec.rb @@ -0,0 +1,87 @@ +require 'swagger_helper' + +RSpec.describe 'guests', type: :request do + path '/guests/bulk_update' do + post('Update multiple guests in a single request') do + tags 'Guests' + consumes 'application/json' + produces 'application/json' + parameter name: :body, in: :body, schema: { + type: :object, + required: %i[guest_ids properties], + properties: { + guest_ids: { type: :array, items: { type: :string, format: :uuid } }, + properties: { + type: :object, + required: %i[status], + properties: { + status: { type: :string, enum: Guest.statuses.keys } + } + } + } + } + let(:body) do + { + guest_ids: [SecureRandom.uuid, SecureRandom.uuid], + properties: { + status: 'confirmed' + } + } + end + response_empty_200 + response_422 + end + end + + path '/guests' do + get('list guests') do + tags 'Guests' + produces 'application/json' + response(200, 'successful') do + schema type: :array, + items: { + type: :object, + required: %i[id name status group], + properties: { + id: { type: :string, format: :uuid }, + name: { type: :string }, + status: { type: :string, enum: Guest.statuses.keys }, + group: { type: :object, + required: %i[id name], + properties: { + id: { type: :string, format: :uuid }, + name: { type: :string } + } } + } + } + xit + end + end + end + + path '/guests/{id}' do + patch('update guest') do + tags 'Guests' + consumes 'application/json' + produces 'application/json' + parameter name: 'id', in: :path, type: :string, format: :uuid + parameter name: :body, in: :body, schema: { + type: :object, + required: %i[guest], + properties: { + guest: { + type: :object, + required: %i[name], + properties: { + name: { type: :string } + } + } + } + } + + response_empty_200 + response_422 + response_404 + end + end +end diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index d07a97e..7ffd0d2 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -3,6 +3,9 @@ # frozen_string_literal: true require 'rails_helper' +require_relative './swagger_response_helper' + +include SwaggerResponseHelper RSpec.configure do |config| # Specify a root folder where Swagger JSON files are generated @@ -19,6 +22,15 @@ RSpec.configure do |config| config.openapi_specs = { 'v1/swagger.yaml' => { openapi: '3.0.1', + components: { + securitySchemes: { + csrfToken: { + type: :apiKey, + in: :header, + name: 'X-CSRF-Token' + } + } + }, info: { title: 'API V1', version: 'v1' diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb new file mode 100644 index 0000000..55e09f6 --- /dev/null +++ b/spec/swagger_response_helper.rb @@ -0,0 +1,36 @@ +module SwaggerResponseHelper + def response_422 + response(422, 'Validation errors in input parameters') do + produces 'application/json' + error_schema + xit + end + end + + def response_empty_200 + response(200, 'Success') do + produces 'application/json' + schema type: :object + xit + end + end + + def response_404 + response(404, 'Record not found') do + produces 'application/json' + error_schema + xit + end + end + + private + + def error_schema + schema type: :object, + required: %i[message errors], + properties: { + message: { type: :string }, + errors: { type: :array, items: { type: :string } } + } + end +end From a8c9c051f002601d2677f36dc4aca4f4ac486f14 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 16 Nov 2024 01:52:48 +0000 Subject: [PATCH 126/283] Add copyright notice --- spec/requests/guests_spec.rb | 2 ++ spec/swagger_response_helper.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index 3cde46f..fedbce1 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'guests', type: :request do diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index 55e09f6..7db38fa 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module SwaggerResponseHelper def response_422 response(422, 'Validation errors in input parameters') do From 6e5bbb7b1b5d81d76c83e82dd73039a3e6189e4f Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 16 Nov 2024 09:59:19 +0100 Subject: [PATCH 127/283] Remove leftover code from Swagger-CSRF experiment --- spec/swagger_helper.rb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index 7ffd0d2..d4d34a4 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -22,15 +22,6 @@ RSpec.configure do |config| config.openapi_specs = { 'v1/swagger.yaml' => { openapi: '3.0.1', - components: { - securitySchemes: { - csrfToken: { - type: :apiKey, - in: :header, - name: 'X-CSRF-Token' - } - } - }, info: { title: 'API V1', version: 'v1' From 86b9d0b56c04e42fbbbaa5fe90f9871877e6bdcb Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 16 Nov 2024 10:22:10 +0100 Subject: [PATCH 128/283] Document expenses endpoint and add some specs --- app/models/expense.rb | 7 +++++ spec/models/expense_spec.rb | 7 ++++- spec/requests/expenses_spec.rb | 47 ++++++++++++++++++++++++++++++++++ spec/requests/guests_spec.rb | 9 +------ 4 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 spec/requests/expenses_spec.rb diff --git a/app/models/expense.rb b/app/models/expense.rb index 32f486f..6da98af 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -12,4 +12,11 @@ # updated_at :datetime not null # class Expense < ApplicationRecord + enum :pricing_type, + fixed: 'fixed', + per_person: 'per_person' + + validates :name, presence: true + validates :amount, presence: true, numericality: { greater_than: 0 } + validates :pricing_type, presence: true end diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index a6592fe..973ccf2 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -3,5 +3,10 @@ require 'rails_helper' RSpec.describe Expense, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + describe 'validations' do + it { should validate_presence_of(:name) } + it { should validate_presence_of(:amount) } + it { should validate_numericality_of(:amount).is_greater_than(0) } + it { should validate_presence_of(:pricing_type) } + end end diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb new file mode 100644 index 0000000..943204e --- /dev/null +++ b/spec/requests/expenses_spec.rb @@ -0,0 +1,47 @@ +require 'swagger_helper' + +RSpec.describe 'expenses', type: :request do + path '/expenses' do + get('list expenses') do + tags 'Expenses' + produces 'application/json' + response(200, 'successful') do + schema type: :array, + items: { + type: :object, + required: %i[id name amount pricing_type], + properties: { + id: { type: :string, format: :uuid }, + name: { type: :string }, + amount: { type: :number }, + pricing_type: { type: :string, enum: Expense.pricing_types.keys } + } + } + + xit + end + end + end + + path '/expenses/{id}' do + + patch('update expense') do + tags 'Expenses' + consumes 'application/json' + produces 'application/json' + parameter name: 'id', in: :path, type: :string, format: :uuid, description: 'id' + parameter name: :body, in: :body, schema: { + type: :object, + properties: { + name: { type: :string }, + amount: { type: :number, minimum: 0 }, + pricing_type: { type: :string, enum: Expense.pricing_types.keys } + } + } + + response_empty_200 + response_422 + response_404 + end + end +end diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index fedbce1..9a92de9 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -22,14 +22,7 @@ RSpec.describe 'guests', type: :request do } } } - let(:body) do - { - guest_ids: [SecureRandom.uuid, SecureRandom.uuid], - properties: { - status: 'confirmed' - } - } - end + response_empty_200 response_422 end From 73e02a9d956e42b2ea5187d90bafb89cc9318b79 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 16 Nov 2024 09:23:51 +0000 Subject: [PATCH 129/283] Add copyright notice --- spec/requests/expenses_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index 943204e..c96b5cf 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'expenses', type: :request do From 5f47b923d551faf5aa2ae19c6e62808ee5080363 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 16 Nov 2024 12:30:05 +0100 Subject: [PATCH 130/283] Remove / server from Swagger configuration --- spec/swagger_helper.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index d4d34a4..b87d934 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -28,10 +28,6 @@ RSpec.configure do |config| }, paths: {}, servers: [ - { - url: '/', - description: 'suitable for testing' - }, { url: 'http://libre-wedding-planner.app.localhost/api', description: 'Suitable for development' From b008777c20a209465a3887892025bcbc260e6db8 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 17 Nov 2024 01:08:15 +0000 Subject: [PATCH 131/283] Update dependency solid_queue to v1.0.2 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c014782..9ea8033 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -311,7 +311,7 @@ GEM securerandom (0.3.2) shoulda-matchers (6.4.0) activesupport (>= 5.2.0) - solid_queue (1.0.1) + solid_queue (1.0.2) activejob (>= 7.1) activerecord (>= 7.1) concurrent-ruby (>= 1.3.1) From b3cfde445c9205559933b19bde6c9400f49a1445 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 17 Nov 2024 11:27:38 +0100 Subject: [PATCH 132/283] Merge docker compose up and build into a single command --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 49752d5..93a449f 100644 --- a/README.md +++ b/README.md @@ -42,8 +42,7 @@ projects Docker compose is the recommended way to run Libre Wedding Planner for development purposes. After downloading both repositories, `cd` to the root of `wedding-planner` and run: ```bash -docker compose build -docker compose up +docker compose up --build ``` Several containers will be started: From 1b2c0f0d0ab99a6fce28890bc10393881323448b Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 17 Nov 2024 11:47:12 +0100 Subject: [PATCH 133/283] Define an endpoint to create new guests --- app/controllers/guests_controller.rb | 5 +++++ config/routes.rb | 2 +- spec/requests/guests_spec.rb | 24 ++++++++++++++++++++++++ spec/swagger_response_helper.rb | 8 ++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index efc3e58..9a0c9fb 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -10,6 +10,11 @@ class GuestsController < ApplicationController .as_json(only: %i[id name status], include: { group: { only: %i[id name] } }) end + def create + Guest.create!(params.require(:guest).permit(:name, :group_id, :status)) + render json: {}, status: :created + end + def update Guest.find(params[:id]).update!(params.require(:guest).permit(:name)) render json: {}, status: :ok diff --git a/config/routes.rb b/config/routes.rb index 80aa2e0..b90eb65 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,7 @@ Rails.application.routes.draw do mount Rswag::Ui::Engine => '/api-docs' mount Rswag::Api::Engine => '/api-docs' resources :groups, only: :index - resources :guests, only: %i[index update] do + resources :guests, only: %i[index create update] do post :bulk_update, on: :collection end resources :expenses, only: %i[index update] do diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index 9a92de9..a7f637c 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -52,6 +52,30 @@ RSpec.describe 'guests', type: :request do xit end end + + post('create guest') do + tags 'Guests' + consumes 'application/json' + produces 'application/json' + parameter name: :body, in: :body, schema: { + type: :object, + required: %i[guest], + properties: { + guest: { + type: :object, + required: %i[name group_id status], + properties: { + name: { type: :string }, + group_id: { type: :string, format: :uuid }, + status: { type: :string, enum: Guest.statuses.keys } + } + } + } + } + + response_empty_201 + response_422 + end end path '/guests/{id}' do diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index 7db38fa..1f84ebd 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -17,6 +17,14 @@ module SwaggerResponseHelper end end + def response_empty_201 + response(201, 'Created') do + produces 'application/json' + schema type: :object + xit + end + end + def response_404 response(404, 'Record not found') do produces 'application/json' From 31d41ea2ea01a5feaadd44d25cc1621f5e1f8632 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 17 Nov 2024 17:07:29 +0100 Subject: [PATCH 134/283] Remove unused bulk update endpoint --- app/controllers/guests_controller.rb | 7 +----- app/models/guest.rb | 10 +++++++++ app/use_cases/guests/update_use_case.rb | 22 ------------------- spec/requests/guests_spec.rb | 29 ++----------------------- 4 files changed, 13 insertions(+), 55 deletions(-) delete mode 100644 app/use_cases/guests/update_use_case.rb diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 9a0c9fb..1b51eaf 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -16,12 +16,7 @@ class GuestsController < ApplicationController end def update - Guest.find(params[:id]).update!(params.require(:guest).permit(:name)) - render json: {}, status: :ok - end - - def bulk_update - Guests::UpdateUseCase.new(guest_ids: params[:guest_ids], params: params.require(:properties).permit(:status)).call + Guest.find(params[:id]).update!(params.require(:guest).permit(:name, :status)) render json: {}, status: :ok end end diff --git a/app/models/guest.rb b/app/models/guest.rb index 8e794f2..bf689d9 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -34,4 +34,14 @@ class Guest < ApplicationRecord validates :name, presence: true scope :potential, -> { where.not(status: %i[declined considered]) } + + after_save :recalculate_simulations, if: :saved_change_to_status? + + private + + def recalculate_simulations + TablesArrangement.delete_all + + ActiveJob.perform_all_later(50.times.map { TableSimulatorJob.new }) + end end diff --git a/app/use_cases/guests/update_use_case.rb b/app/use_cases/guests/update_use_case.rb deleted file mode 100644 index 3d82c52..0000000 --- a/app/use_cases/guests/update_use_case.rb +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -module Guests - class UpdateUseCase - private attr_reader :guest_ids, :params - def initialize(guest_ids:, params:) - @guest_ids = guest_ids - @params = params - end - - def call - Guest.where(id: guest_ids).update!(params) - - # TODO: Not all status transitions may require a table re-arrangement - return unless params.key?(:status) - - TablesArrangement.delete_all - - ActiveJob.perform_all_later(50.times.map { TableSimulatorJob.new }) - end - end -end diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index a7f637c..ea6ae59 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -3,31 +3,6 @@ require 'swagger_helper' RSpec.describe 'guests', type: :request do - path '/guests/bulk_update' do - post('Update multiple guests in a single request') do - tags 'Guests' - consumes 'application/json' - produces 'application/json' - parameter name: :body, in: :body, schema: { - type: :object, - required: %i[guest_ids properties], - properties: { - guest_ids: { type: :array, items: { type: :string, format: :uuid } }, - properties: { - type: :object, - required: %i[status], - properties: { - status: { type: :string, enum: Guest.statuses.keys } - } - } - } - } - - response_empty_200 - response_422 - end - end - path '/guests' do get('list guests') do tags 'Guests' @@ -90,9 +65,9 @@ RSpec.describe 'guests', type: :request do properties: { guest: { type: :object, - required: %i[name], properties: { - name: { type: :string } + name: { type: :string }, + status: { type: :string, enum: Guest.statuses.keys } } } } From 7542c6361cd8606e87debb29a83ba03d522a80eb Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 17 Nov 2024 18:24:43 +0100 Subject: [PATCH 135/283] Define an endpoint to destroy guests --- app/controllers/guests_controller.rb | 5 +++++ app/models/guest.rb | 2 ++ config/routes.rb | 2 +- spec/requests/guests_spec.rb | 9 +++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 1b51eaf..03cf377 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -19,4 +19,9 @@ class GuestsController < ApplicationController Guest.find(params[:id]).update!(params.require(:guest).permit(:name, :status)) render json: {}, status: :ok end + + def destroy + Guest.find(params[:id]).destroy! + render json: {}, status: :ok + end end diff --git a/app/models/guest.rb b/app/models/guest.rb index bf689d9..f729f4c 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -37,6 +37,8 @@ class Guest < ApplicationRecord after_save :recalculate_simulations, if: :saved_change_to_status? + has_many :seats, dependent: :delete_all + private def recalculate_simulations diff --git a/config/routes.rb b/config/routes.rb index b90eb65..c9d7ee6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,7 @@ Rails.application.routes.draw do mount Rswag::Ui::Engine => '/api-docs' mount Rswag::Api::Engine => '/api-docs' resources :groups, only: :index - resources :guests, only: %i[index create update] do + resources :guests, only: %i[index create update destroy] do post :bulk_update, on: :collection end resources :expenses, only: %i[index update] do diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index ea6ae59..0bbfe7a 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -77,5 +77,14 @@ RSpec.describe 'guests', type: :request do response_422 response_404 end + + delete('delete guest') do + tags 'Guests' + produces 'application/json' + parameter name: 'id', in: :path, type: :string, format: :uuid + + response_empty_200 + response_404 + end end end From f1d1ea825cc8c4116f86c1478bb177c2e8dccd41 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 17 Nov 2024 18:25:38 +0100 Subject: [PATCH 136/283] Recalculate simulations after removing a guest --- app/models/guest.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/guest.rb b/app/models/guest.rb index f729f4c..40c41be 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -36,6 +36,7 @@ class Guest < ApplicationRecord scope :potential, -> { where.not(status: %i[declined considered]) } after_save :recalculate_simulations, if: :saved_change_to_status? + after_destroy :recalculate_simulations has_many :seats, dependent: :delete_all From 80c1c9b99d8309370ab8082249a621035c2c7c46 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 17 Nov 2024 20:01:23 +0100 Subject: [PATCH 137/283] Refine guest controller --- app/controllers/guests_controller.rb | 10 ++++++++-- spec/requests/guests_spec.rb | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 03cf377..a302541 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -11,12 +11,12 @@ class GuestsController < ApplicationController end def create - Guest.create!(params.require(:guest).permit(:name, :group_id, :status)) + Guest.create!(guest_params) render json: {}, status: :created end def update - Guest.find(params[:id]).update!(params.require(:guest).permit(:name, :status)) + Guest.find(params[:id]).update!(guest_params) render json: {}, status: :ok end @@ -24,4 +24,10 @@ class GuestsController < ApplicationController Guest.find(params[:id]).destroy! render json: {}, status: :ok end + + private + + def guest_params + params.require(:guest).permit(:name, :group_id, :status) + end end diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index 0bbfe7a..df26f17 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -67,6 +67,7 @@ RSpec.describe 'guests', type: :request do type: :object, properties: { name: { type: :string }, + group_id: { type: :string, format: :uuid }, status: { type: :string, enum: Guest.statuses.keys } } } From aa0986986f1b6544e918d3fd6af13336547feacd Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 19 Nov 2024 00:26:44 +0100 Subject: [PATCH 138/283] Install Rails' authentication generator --- Gemfile | 2 + Gemfile.lock | 2 + app/channels/application_cable/connection.rb | 14 ++++- app/controllers/application_controller.rb | 1 + app/controllers/concerns/authentication.rb | 55 ++++++++++++++++++++ app/controllers/passwords_controller.rb | 33 ++++++++++++ app/controllers/sessions_controller.rb | 21 ++++++++ app/mailers/passwords_mailer.rb | 6 +++ app/models/current.rb | 4 ++ app/models/session.rb | 22 ++++++++ app/models/user.rb | 20 +++++++ app/views/passwords/edit.html.erb | 9 ++++ app/views/passwords/new.html.erb | 8 +++ app/views/passwords_mailer/reset.html.erb | 4 ++ app/views/passwords_mailer/reset.text.erb | 2 + app/views/sessions/new.html.erb | 11 ++++ config/routes.rb | 2 + db/migrate/20241118232609_create_users.rb | 11 ++++ db/migrate/20241118232618_create_sessions.rb | 11 ++++ db/schema.rb | 22 ++++++-- 20 files changed, 255 insertions(+), 5 deletions(-) create mode 100644 app/controllers/concerns/authentication.rb create mode 100644 app/controllers/passwords_controller.rb create mode 100644 app/controllers/sessions_controller.rb create mode 100644 app/mailers/passwords_mailer.rb create mode 100644 app/models/current.rb create mode 100644 app/models/session.rb create mode 100644 app/models/user.rb create mode 100644 app/views/passwords/edit.html.erb create mode 100644 app/views/passwords/new.html.erb create mode 100644 app/views/passwords_mailer/reset.html.erb create mode 100644 app/views/passwords_mailer/reset.text.erb create mode 100644 app/views/sessions/new.html.erb create mode 100644 db/migrate/20241118232609_create_users.rb create mode 100644 db/migrate/20241118232618_create_sessions.rb diff --git a/Gemfile b/Gemfile index 81b24ff..a62f8ee 100644 --- a/Gemfile +++ b/Gemfile @@ -39,3 +39,5 @@ end gem 'chroma' gem 'solid_queue', '~> 1.0' + +gem "bcrypt", "~> 3.1" diff --git a/Gemfile.lock b/Gemfile.lock index 9ea8033..ca48703 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -81,6 +81,7 @@ GEM babel-source (>= 4.0, < 6) execjs (~> 2.0) base64 (0.2.0) + bcrypt (3.1.20) benchmark (0.4.0) bigdecimal (3.1.8) bindex (0.8.1) @@ -363,6 +364,7 @@ PLATFORMS DEPENDENCIES annotaterb + bcrypt (~> 3.1) bootsnap chroma csv diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 1cc97c6..4264c74 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,6 +1,16 @@ -# Copyright (C) 2024 Manuel Bustillo - module ApplicationCable class Connection < ActionCable::Connection::Base + identified_by :current_user + + def connect + set_current_user || reject_unauthorized_connection + end + + private + def set_current_user + if session = Session.find_by(id: cookies.signed[:session_id]) + self.current_user = session.user + end + end end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 57926f3..54431ec 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,7 @@ # Copyright (C) 2024 Manuel Bustillo class ApplicationController < ActionController::Base + include Authentication after_action :set_csrf_cookie skip_before_action :verify_authenticity_token, if: :development_swagger? diff --git a/app/controllers/concerns/authentication.rb b/app/controllers/concerns/authentication.rb new file mode 100644 index 0000000..771b21d --- /dev/null +++ b/app/controllers/concerns/authentication.rb @@ -0,0 +1,55 @@ +module Authentication + extend ActiveSupport::Concern + + included do + before_action :require_authentication + helper_method :authenticated? + end + + class_methods do + def allow_unauthenticated_access(**options) + skip_before_action :require_authentication, **options + end + end + + private + def authenticated? + resume_session + end + + def require_authentication + resume_session || request_authentication + end + + + def resume_session + Current.session ||= find_session_by_cookie + end + + def find_session_by_cookie + Session.find_by(id: cookies.signed[:session_id]) + end + + + def request_authentication + session[:return_to_after_authenticating] = request.url + redirect_to new_session_path + end + + def after_authentication_url + session.delete(:return_to_after_authenticating) || root_url + end + + + def start_new_session_for(user) + user.sessions.create!(user_agent: request.user_agent, ip_address: request.remote_ip).tap do |session| + Current.session = session + cookies.signed.permanent[:session_id] = { value: session.id, httponly: true, same_site: :lax } + end + end + + def terminate_session + Current.session.destroy + cookies.delete(:session_id) + end +end diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb new file mode 100644 index 0000000..0c4b4a8 --- /dev/null +++ b/app/controllers/passwords_controller.rb @@ -0,0 +1,33 @@ +class PasswordsController < ApplicationController + allow_unauthenticated_access + before_action :set_user_by_token, only: %i[ edit update ] + + def new + end + + def create + if user = User.find_by(email_address: params[:email_address]) + PasswordsMailer.reset(user).deliver_later + end + + redirect_to new_session_path, notice: "Password reset instructions sent (if user with that email address exists)." + end + + def edit + end + + def update + if @user.update(params.permit(:password, :password_confirmation)) + redirect_to new_session_path, notice: "Password has been reset." + else + redirect_to edit_password_path(params[:token]), alert: "Passwords did not match." + end + end + + private + def set_user_by_token + @user = User.find_by_password_reset_token!(params[:token]) + rescue ActiveSupport::MessageVerifier::InvalidSignature + redirect_to new_password_path, alert: "Password reset link is invalid or has expired." + end +end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 0000000..9785c92 --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,21 @@ +class SessionsController < ApplicationController + allow_unauthenticated_access only: %i[ new create ] + rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_url, alert: "Try again later." } + + def new + end + + def create + if user = User.authenticate_by(params.permit(:email_address, :password)) + start_new_session_for user + redirect_to after_authentication_url + else + redirect_to new_session_path, alert: "Try another email address or password." + end + end + + def destroy + terminate_session + redirect_to new_session_path + end +end diff --git a/app/mailers/passwords_mailer.rb b/app/mailers/passwords_mailer.rb new file mode 100644 index 0000000..4f0ac7f --- /dev/null +++ b/app/mailers/passwords_mailer.rb @@ -0,0 +1,6 @@ +class PasswordsMailer < ApplicationMailer + def reset(user) + @user = user + mail subject: "Reset your password", to: user.email_address + end +end diff --git a/app/models/current.rb b/app/models/current.rb new file mode 100644 index 0000000..2bef56d --- /dev/null +++ b/app/models/current.rb @@ -0,0 +1,4 @@ +class Current < ActiveSupport::CurrentAttributes + attribute :session + delegate :user, to: :session, allow_nil: true +end diff --git a/app/models/session.rb b/app/models/session.rb new file mode 100644 index 0000000..688bbd3 --- /dev/null +++ b/app/models/session.rb @@ -0,0 +1,22 @@ +# == Schema Information +# +# Table name: sessions +# +# id :bigint not null, primary key +# ip_address :string +# user_agent :string +# created_at :datetime not null +# updated_at :datetime not null +# user_id :bigint not null +# +# Indexes +# +# index_sessions_on_user_id (user_id) +# +# Foreign Keys +# +# fk_rails_... (user_id => users.id) +# +class Session < ApplicationRecord + belongs_to :user +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..6b2fd8a --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,20 @@ +# == Schema Information +# +# Table name: users +# +# id :bigint not null, primary key +# email_address :string not null +# password_digest :string not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_users_on_email_address (email_address) UNIQUE +# +class User < ApplicationRecord + has_secure_password + has_many :sessions, dependent: :destroy + + normalizes :email_address, with: ->(e) { e.strip.downcase } +end diff --git a/app/views/passwords/edit.html.erb b/app/views/passwords/edit.html.erb new file mode 100644 index 0000000..9f0c87c --- /dev/null +++ b/app/views/passwords/edit.html.erb @@ -0,0 +1,9 @@ +

    Update your password

    + +<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> + +<%= form_with url: password_path(params[:token]), method: :put do |form| %> + <%= form.password_field :password, required: true, autocomplete: "new-password", placeholder: "Enter new password", maxlength: 72 %>
    + <%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: "Repeat new password", maxlength: 72 %>
    + <%= form.submit "Save" %> +<% end %> diff --git a/app/views/passwords/new.html.erb b/app/views/passwords/new.html.erb new file mode 100644 index 0000000..44efb2b --- /dev/null +++ b/app/views/passwords/new.html.erb @@ -0,0 +1,8 @@ +

    Forgot your password?

    + +<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> + +<%= form_with url: passwords_path do |form| %> + <%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address] %>
    + <%= form.submit "Email reset instructions" %> +<% end %> diff --git a/app/views/passwords_mailer/reset.html.erb b/app/views/passwords_mailer/reset.html.erb new file mode 100644 index 0000000..4a06619 --- /dev/null +++ b/app/views/passwords_mailer/reset.html.erb @@ -0,0 +1,4 @@ +

    + You can reset your password within the next 15 minutes on + <%= link_to "this password reset page", edit_password_url(@user.password_reset_token) %>. +

    diff --git a/app/views/passwords_mailer/reset.text.erb b/app/views/passwords_mailer/reset.text.erb new file mode 100644 index 0000000..2cf03fc --- /dev/null +++ b/app/views/passwords_mailer/reset.text.erb @@ -0,0 +1,2 @@ +You can reset your password within the next 15 minutes on this password reset page: +<%= edit_password_url(@user.password_reset_token) %> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb new file mode 100644 index 0000000..ff641c4 --- /dev/null +++ b/app/views/sessions/new.html.erb @@ -0,0 +1,11 @@ +<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> +<%= tag.div(flash[:notice], style: "color:green") if flash[:notice] %> + +<%= form_with url: session_path do |form| %> + <%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address] %>
    + <%= form.password_field :password, required: true, autocomplete: "current-password", placeholder: "Enter your password", maxlength: 72 %>
    + <%= form.submit "Sign in" %> +<% end %> +
    + +<%= link_to "Forgot password?", new_password_path %> diff --git a/config/routes.rb b/config/routes.rb index c9d7ee6..537876a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,8 @@ # Copyright (C) 2024 Manuel Bustillo Rails.application.routes.draw do + resource :session + resources :passwords, param: :token mount Rswag::Ui::Engine => '/api-docs' mount Rswag::Api::Engine => '/api-docs' resources :groups, only: :index diff --git a/db/migrate/20241118232609_create_users.rb b/db/migrate/20241118232609_create_users.rb new file mode 100644 index 0000000..2075edf --- /dev/null +++ b/db/migrate/20241118232609_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration[8.0] + def change + create_table :users do |t| + t.string :email_address, null: false + t.string :password_digest, null: false + + t.timestamps + end + add_index :users, :email_address, unique: true + end +end diff --git a/db/migrate/20241118232618_create_sessions.rb b/db/migrate/20241118232618_create_sessions.rb new file mode 100644 index 0000000..8102f13 --- /dev/null +++ b/db/migrate/20241118232618_create_sessions.rb @@ -0,0 +1,11 @@ +class CreateSessions < ActiveRecord::Migration[8.0] + def change + create_table :sessions do |t| + t.references :user, null: false, foreign_key: true + t.string :ip_address + t.string :user_agent + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index c54ec05..98095a5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2024_11_11_063741) do +ActiveRecord::Schema[8.0].define(version: 2024_11_18_232618) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -60,6 +58,15 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_11_063741) do t.index ["tables_arrangement_id"], name: "index_seats_on_tables_arrangement_id" end + create_table "sessions", force: :cascade do |t| + t.bigint "user_id", null: false + t.string "ip_address" + t.string "user_agent" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_sessions_on_user_id" + end + create_table "solid_queue_blocked_executions", force: :cascade do |t| t.bigint "job_id", null: false t.string "queue_name", null: false @@ -188,10 +195,19 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_11_063741) do t.string "name", null: false end + create_table "users", force: :cascade do |t| + t.string "email_address", null: false + t.string "password_digest", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["email_address"], name: "index_users_on_email_address", unique: true + end + add_foreign_key "groups", "groups", column: "parent_id" add_foreign_key "guests", "groups" add_foreign_key "seats", "guests" add_foreign_key "seats", "tables_arrangements", on_delete: :cascade + add_foreign_key "sessions", "users" add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade From 134bf27955e6caab0f7cc731f72551daae6f2a17 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 18 Nov 2024 23:27:50 +0000 Subject: [PATCH 139/283] Add copyright notice --- app/channels/application_cable/connection.rb | 2 ++ app/controllers/concerns/authentication.rb | 2 ++ app/controllers/passwords_controller.rb | 2 ++ app/controllers/sessions_controller.rb | 2 ++ app/mailers/passwords_mailer.rb | 2 ++ app/models/current.rb | 2 ++ app/models/session.rb | 2 ++ app/models/user.rb | 2 ++ app/views/passwords/edit.html.erb | 2 ++ app/views/passwords/new.html.erb | 2 ++ app/views/passwords_mailer/reset.html.erb | 2 ++ app/views/passwords_mailer/reset.text.erb | 2 ++ app/views/sessions/new.html.erb | 2 ++ db/migrate/20241118232609_create_users.rb | 2 ++ db/migrate/20241118232618_create_sessions.rb | 2 ++ db/schema.rb | 2 ++ 16 files changed, 32 insertions(+) diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 4264c74..abaef27 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module ApplicationCable class Connection < ActionCable::Connection::Base identified_by :current_user diff --git a/app/controllers/concerns/authentication.rb b/app/controllers/concerns/authentication.rb index 771b21d..5275e10 100644 --- a/app/controllers/concerns/authentication.rb +++ b/app/controllers/concerns/authentication.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module Authentication extend ActiveSupport::Concern diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index 0c4b4a8..49e8595 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class PasswordsController < ApplicationController allow_unauthenticated_access before_action :set_user_by_token, only: %i[ edit update ] diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 9785c92..6a46998 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class SessionsController < ApplicationController allow_unauthenticated_access only: %i[ new create ] rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_url, alert: "Try again later." } diff --git a/app/mailers/passwords_mailer.rb b/app/mailers/passwords_mailer.rb index 4f0ac7f..f3692f0 100644 --- a/app/mailers/passwords_mailer.rb +++ b/app/mailers/passwords_mailer.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class PasswordsMailer < ApplicationMailer def reset(user) @user = user diff --git a/app/models/current.rb b/app/models/current.rb index 2bef56d..f7b1ab9 100644 --- a/app/models/current.rb +++ b/app/models/current.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class Current < ActiveSupport::CurrentAttributes attribute :session delegate :user, to: :session, allow_nil: true diff --git a/app/models/session.rb b/app/models/session.rb index 688bbd3..9ba68b4 100644 --- a/app/models/session.rb +++ b/app/models/session.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # == Schema Information # # Table name: sessions diff --git a/app/models/user.rb b/app/models/user.rb index 6b2fd8a..6c752a9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # == Schema Information # # Table name: users diff --git a/app/views/passwords/edit.html.erb b/app/views/passwords/edit.html.erb index 9f0c87c..8b76bbf 100644 --- a/app/views/passwords/edit.html.erb +++ b/app/views/passwords/edit.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

    Update your password

    <%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> diff --git a/app/views/passwords/new.html.erb b/app/views/passwords/new.html.erb index 44efb2b..2572313 100644 --- a/app/views/passwords/new.html.erb +++ b/app/views/passwords/new.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

    Forgot your password?

    <%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> diff --git a/app/views/passwords_mailer/reset.html.erb b/app/views/passwords_mailer/reset.html.erb index 4a06619..9b536ff 100644 --- a/app/views/passwords_mailer/reset.html.erb +++ b/app/views/passwords_mailer/reset.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

    You can reset your password within the next 15 minutes on <%= link_to "this password reset page", edit_password_url(@user.password_reset_token) %>. diff --git a/app/views/passwords_mailer/reset.text.erb b/app/views/passwords_mailer/reset.text.erb index 2cf03fc..0ce9c12 100644 --- a/app/views/passwords_mailer/reset.text.erb +++ b/app/views/passwords_mailer/reset.text.erb @@ -1,2 +1,4 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + You can reset your password within the next 15 minutes on this password reset page: <%= edit_password_url(@user.password_reset_token) %> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index ff641c4..e78774d 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + <%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> <%= tag.div(flash[:notice], style: "color:green") if flash[:notice] %> diff --git a/db/migrate/20241118232609_create_users.rb b/db/migrate/20241118232609_create_users.rb index 2075edf..b1f1381 100644 --- a/db/migrate/20241118232609_create_users.rb +++ b/db/migrate/20241118232609_create_users.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class CreateUsers < ActiveRecord::Migration[8.0] def change create_table :users do |t| diff --git a/db/migrate/20241118232618_create_sessions.rb b/db/migrate/20241118232618_create_sessions.rb index 8102f13..3cc4be3 100644 --- a/db/migrate/20241118232618_create_sessions.rb +++ b/db/migrate/20241118232618_create_sessions.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class CreateSessions < ActiveRecord::Migration[8.0] def change create_table :sessions do |t| diff --git a/db/schema.rb b/db/schema.rb index 98095a5..02eeea6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From 3e38630eb45ec494e25aa9fb3435e8b7655a60a6 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 19 Nov 2024 00:32:24 +0100 Subject: [PATCH 140/283] Refine controllers --- app/controllers/passwords_controller.rb | 25 ++++++++++--------------- app/controllers/sessions_controller.rb | 14 ++++++-------- config/routes.rb | 4 ++-- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index 49e8595..9877034 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -2,34 +2,29 @@ class PasswordsController < ApplicationController allow_unauthenticated_access - before_action :set_user_by_token, only: %i[ edit update ] - - def new - end + before_action :set_user_by_token, only: :update def create if user = User.find_by(email_address: params[:email_address]) PasswordsMailer.reset(user).deliver_later end - redirect_to new_session_path, notice: "Password reset instructions sent (if user with that email address exists)." - end - - def edit + render json: {}, status: :ok end def update if @user.update(params.permit(:password, :password_confirmation)) - redirect_to new_session_path, notice: "Password has been reset." + render json: {}, status: :ok else - redirect_to edit_password_path(params[:token]), alert: "Passwords did not match." + render json: { errors: @user.errors.full_messages }, status: :unprocessable_entity end end private - def set_user_by_token - @user = User.find_by_password_reset_token!(params[:token]) - rescue ActiveSupport::MessageVerifier::InvalidSignature - redirect_to new_password_path, alert: "Password reset link is invalid or has expired." - end + + def set_user_by_token + @user = User.find_by_password_reset_token!(params[:token]) + rescue ActiveSupport::MessageVerifier::InvalidSignature + redirect_to new_password_path, alert: 'Password reset link is invalid or has expired.' + end end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 6a46998..aa74562 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,23 +1,21 @@ # Copyright (C) 2024 Manuel Bustillo class SessionsController < ApplicationController - allow_unauthenticated_access only: %i[ new create ] - rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_url, alert: "Try again later." } - - def new - end + allow_unauthenticated_access only: :create + rate_limit to: 10, within: 3.minutes, only: :create, + with: -> { render json: { errors: ['Rate limit exceeded'] }, status: :too_many_requests } def create if user = User.authenticate_by(params.permit(:email_address, :password)) start_new_session_for user - redirect_to after_authentication_url + render json: {}, status: :created else - redirect_to new_session_path, alert: "Try another email address or password." + render json: { errors: ['Invalid email address or password'] }, status: :unauthorized end end def destroy terminate_session - redirect_to new_session_path + render json: {}, status: :ok end end diff --git a/config/routes.rb b/config/routes.rb index 537876a..ed59be2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,8 @@ # Copyright (C) 2024 Manuel Bustillo Rails.application.routes.draw do - resource :session - resources :passwords, param: :token + resource :session, only: %i[create destroy] + resources :passwords, param: :token, only: %w[create update] mount Rswag::Ui::Engine => '/api-docs' mount Rswag::Api::Engine => '/api-docs' resources :groups, only: :index From 8b336164362bada541f1dbac48dd46419638d5f5 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 19 Nov 2024 00:33:26 +0100 Subject: [PATCH 141/283] Remove unnecessary views --- app/views/passwords/edit.html.erb | 11 ----------- app/views/passwords/new.html.erb | 10 ---------- app/views/sessions/new.html.erb | 13 ------------- 3 files changed, 34 deletions(-) delete mode 100644 app/views/passwords/edit.html.erb delete mode 100644 app/views/passwords/new.html.erb delete mode 100644 app/views/sessions/new.html.erb diff --git a/app/views/passwords/edit.html.erb b/app/views/passwords/edit.html.erb deleted file mode 100644 index 8b76bbf..0000000 --- a/app/views/passwords/edit.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    Update your password

    - -<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> - -<%= form_with url: password_path(params[:token]), method: :put do |form| %> - <%= form.password_field :password, required: true, autocomplete: "new-password", placeholder: "Enter new password", maxlength: 72 %>
    - <%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: "Repeat new password", maxlength: 72 %>
    - <%= form.submit "Save" %> -<% end %> diff --git a/app/views/passwords/new.html.erb b/app/views/passwords/new.html.erb deleted file mode 100644 index 2572313..0000000 --- a/app/views/passwords/new.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    Forgot your password?

    - -<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> - -<%= form_with url: passwords_path do |form| %> - <%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address] %>
    - <%= form.submit "Email reset instructions" %> -<% end %> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb deleted file mode 100644 index e78774d..0000000 --- a/app/views/sessions/new.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> -<%= tag.div(flash[:notice], style: "color:green") if flash[:notice] %> - -<%= form_with url: session_path do |form| %> - <%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address] %>
    - <%= form.password_field :password, required: true, autocomplete: "current-password", placeholder: "Enter your password", maxlength: 72 %>
    - <%= form.submit "Sign in" %> -<% end %> -
    - -<%= link_to "Forgot password?", new_password_path %> From 0e0da9c765457a1a9ef3137c3bf2f6f6939971a4 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 19 Nov 2024 08:56:51 +0100 Subject: [PATCH 142/283] Refine and document controllers --- app/controllers/passwords_controller.rb | 4 +-- spec/requests/passwords_spec.rb | 40 +++++++++++++++++++++++++ spec/requests/sessions_spec.rb | 29 ++++++++++++++++++ spec/swagger_response_helper.rb | 16 ++++++++++ 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 spec/requests/passwords_spec.rb create mode 100644 spec/requests/sessions_spec.rb diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index 9877034..1189710 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -9,7 +9,7 @@ class PasswordsController < ApplicationController PasswordsMailer.reset(user).deliver_later end - render json: {}, status: :ok + render json: {}, status: :created end def update @@ -25,6 +25,6 @@ class PasswordsController < ApplicationController def set_user_by_token @user = User.find_by_password_reset_token!(params[:token]) rescue ActiveSupport::MessageVerifier::InvalidSignature - redirect_to new_password_path, alert: 'Password reset link is invalid or has expired.' + render json: { errors: ['Password reset link is invalid or has expired.'] }, status: :unprocessable_entity end end diff --git a/spec/requests/passwords_spec.rb b/spec/requests/passwords_spec.rb new file mode 100644 index 0000000..510177a --- /dev/null +++ b/spec/requests/passwords_spec.rb @@ -0,0 +1,40 @@ +require 'swagger_helper' + +RSpec.describe 'passwords', type: :request do + path '/passwords' do + post('send a password (re)set email') do + tags 'Passwords' + consumes 'application/json' + produces 'application/json' + parameter name: :body, in: :body, schema: { + type: :object, + required: [:email_address], + properties: { + email_address: { type: :string, format: :email } + } + } + + response_empty_201 + end + end + + path '/passwords/{token}' do + parameter name: 'token', in: :path, type: :string, description: 'token' + put('update password') do + tags 'Passwords' + consumes 'application/json' + produces 'application/json' + parameter name: :body, in: :body, schema: { + type: :object, + required: %i[password password_confirmation], + properties: { + password: { type: :string }, + password_confirmation: { type: :string } + } + } + + response_empty_200 + response_422 + end + end +end diff --git a/spec/requests/sessions_spec.rb b/spec/requests/sessions_spec.rb new file mode 100644 index 0000000..3800088 --- /dev/null +++ b/spec/requests/sessions_spec.rb @@ -0,0 +1,29 @@ +require 'swagger_helper' + +RSpec.describe 'sessions', type: :request do + path '/session' do + delete('delete session') do + tags 'Sessions' + produces 'application/json' + response_empty_200 + end + + post('create session') do + tags 'Sessions' + consumes 'application/json' + produces 'application/json' + parameter name: :body, in: :body, schema: { + type: :object, + required: %i[email_address password], + properties: { + email_address: { type: :string, format: :email }, + password: { type: :string } + } + } + + response_empty_201 + response_401 + response_429 + end + end +end diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index 1f84ebd..d0812dd 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -9,6 +9,22 @@ module SwaggerResponseHelper end end + def response_429 + response(429, 'Rate limit exceeded') do + produces 'application/json' + error_schema + xit + end + end + + def response_401 + response(401, 'Unauthorized') do + produces 'application/json' + error_schema + xit + end + end + def response_empty_200 response(200, 'Success') do produces 'application/json' From b215e8a3b40be089e7359cfd424f807c2d54b1c2 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 19 Nov 2024 07:57:42 +0000 Subject: [PATCH 143/283] Add copyright notice --- spec/requests/passwords_spec.rb | 2 ++ spec/requests/sessions_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/spec/requests/passwords_spec.rb b/spec/requests/passwords_spec.rb index 510177a..c83a450 100644 --- a/spec/requests/passwords_spec.rb +++ b/spec/requests/passwords_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'passwords', type: :request do diff --git a/spec/requests/sessions_spec.rb b/spec/requests/sessions_spec.rb index 3800088..f836a93 100644 --- a/spec/requests/sessions_spec.rb +++ b/spec/requests/sessions_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'sessions', type: :request do From 3bde27ddce822af7388b3e73a42c7293fc6503b0 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 24 Nov 2024 01:05:23 +0000 Subject: [PATCH 144/283] Update dependency puma to v6.5.0 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9ea8033..cf1e999 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -200,7 +200,7 @@ GEM psych (5.2.0) stringio public_suffix (6.0.1) - puma (6.4.3) + puma (6.5.0) nio4r (~> 2.0) raabro (1.4.0) racc (1.8.1) From d2eaa21df286a2a6335e4551d2fff92fc30a99d1 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 25 Nov 2024 01:08:54 +0000 Subject: [PATCH 145/283] Update dependency factory_bot_rails to v6.4.4 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index cf1e999..d540f62 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -163,7 +163,7 @@ GEM marcel (1.0.4) method_source (1.1.0) mini_mime (1.1.5) - minitest (5.25.1) + minitest (5.25.2) money (6.19.0) i18n (>= 0.6.4, <= 2) msgpack (1.7.2) From d8ee5972aad14dbc6128b497640d3da2eaee4668 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 29 Nov 2024 01:05:48 +0000 Subject: [PATCH 146/283] Update dependency factory_bot_rails to v6.4.4 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index d540f62..988ab87 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -257,7 +257,7 @@ GEM redis-client (0.22.2) connection_pool regexp_parser (2.9.2) - reline (0.5.11) + reline (0.5.12) io-console (~> 0.5) rexml (3.3.9) rspec-core (3.13.2) From 50c0a80dec4882d52c60c2824ec82fa3c866579b Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 30 Nov 2024 01:07:31 +0000 Subject: [PATCH 147/283] Update dependency rubocop to v1.69.0 --- Gemfile.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6615946..e2e1c2a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -129,7 +129,7 @@ GEM jbuilder (2.13.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) - json (2.7.5) + json (2.8.2) json-schema (5.0.1) addressable (~> 2.8) jsonapi-deserializable (0.2.0) @@ -191,7 +191,7 @@ GEM nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) parallel (1.26.3) - parser (3.3.5.1) + parser (3.3.6.0) ast (~> 2.4.1) racc pg (1.5.9) @@ -257,7 +257,7 @@ GEM redis-client (>= 0.22.0) redis-client (0.22.2) connection_pool - regexp_parser (2.9.2) + regexp_parser (2.9.3) reline (0.5.12) io-console (~> 0.5) rexml (3.3.9) @@ -293,17 +293,17 @@ GEM rswag-ui (2.16.0) actionpack (>= 5.2, < 8.1) railties (>= 5.2, < 8.1) - rubocop (1.68.0) + rubocop (1.69.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + rubocop-ast (>= 1.36.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.33.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.36.2) parser (>= 3.3.1.0) ruby-progressbar (1.13.0) rubytree (2.1.0) From 3d424c304e73c097fca4cadbcd54595ae854e0de Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 10:44:15 +0100 Subject: [PATCH 148/283] Revert user authentication This reverts commit b215e8a3b40be089e7359cfd424f807c2d54b1c2. --- Gemfile | 2 - Gemfile.lock | 2 - app/channels/application_cable/connection.rb | 12 ----- app/controllers/application_controller.rb | 1 - app/controllers/concerns/authentication.rb | 57 -------------------- app/controllers/passwords_controller.rb | 30 ----------- app/controllers/sessions_controller.rb | 21 -------- app/mailers/passwords_mailer.rb | 8 --- app/models/current.rb | 6 --- app/models/session.rb | 24 --------- app/models/user.rb | 22 -------- app/views/passwords_mailer/reset.html.erb | 6 --- app/views/passwords_mailer/reset.text.erb | 4 -- config/routes.rb | 2 - db/migrate/20241118232609_create_users.rb | 13 ----- db/migrate/20241118232618_create_sessions.rb | 13 ----- db/schema.rb | 20 +------ spec/requests/passwords_spec.rb | 42 --------------- spec/requests/sessions_spec.rb | 31 ----------- spec/swagger_response_helper.rb | 16 ------ 20 files changed, 1 insertion(+), 331 deletions(-) delete mode 100644 app/controllers/concerns/authentication.rb delete mode 100644 app/controllers/passwords_controller.rb delete mode 100644 app/controllers/sessions_controller.rb delete mode 100644 app/mailers/passwords_mailer.rb delete mode 100644 app/models/current.rb delete mode 100644 app/models/session.rb delete mode 100644 app/models/user.rb delete mode 100644 app/views/passwords_mailer/reset.html.erb delete mode 100644 app/views/passwords_mailer/reset.text.erb delete mode 100644 db/migrate/20241118232609_create_users.rb delete mode 100644 db/migrate/20241118232618_create_sessions.rb delete mode 100644 spec/requests/passwords_spec.rb delete mode 100644 spec/requests/sessions_spec.rb diff --git a/Gemfile b/Gemfile index a62f8ee..81b24ff 100644 --- a/Gemfile +++ b/Gemfile @@ -39,5 +39,3 @@ end gem 'chroma' gem 'solid_queue', '~> 1.0' - -gem "bcrypt", "~> 3.1" diff --git a/Gemfile.lock b/Gemfile.lock index ca48703..9ea8033 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -81,7 +81,6 @@ GEM babel-source (>= 4.0, < 6) execjs (~> 2.0) base64 (0.2.0) - bcrypt (3.1.20) benchmark (0.4.0) bigdecimal (3.1.8) bindex (0.8.1) @@ -364,7 +363,6 @@ PLATFORMS DEPENDENCIES annotaterb - bcrypt (~> 3.1) bootsnap chroma csv diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index abaef27..1cc97c6 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -2,17 +2,5 @@ module ApplicationCable class Connection < ActionCable::Connection::Base - identified_by :current_user - - def connect - set_current_user || reject_unauthorized_connection - end - - private - def set_current_user - if session = Session.find_by(id: cookies.signed[:session_id]) - self.current_user = session.user - end - end end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 54431ec..57926f3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,6 @@ # Copyright (C) 2024 Manuel Bustillo class ApplicationController < ActionController::Base - include Authentication after_action :set_csrf_cookie skip_before_action :verify_authenticity_token, if: :development_swagger? diff --git a/app/controllers/concerns/authentication.rb b/app/controllers/concerns/authentication.rb deleted file mode 100644 index 5275e10..0000000 --- a/app/controllers/concerns/authentication.rb +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -module Authentication - extend ActiveSupport::Concern - - included do - before_action :require_authentication - helper_method :authenticated? - end - - class_methods do - def allow_unauthenticated_access(**options) - skip_before_action :require_authentication, **options - end - end - - private - def authenticated? - resume_session - end - - def require_authentication - resume_session || request_authentication - end - - - def resume_session - Current.session ||= find_session_by_cookie - end - - def find_session_by_cookie - Session.find_by(id: cookies.signed[:session_id]) - end - - - def request_authentication - session[:return_to_after_authenticating] = request.url - redirect_to new_session_path - end - - def after_authentication_url - session.delete(:return_to_after_authenticating) || root_url - end - - - def start_new_session_for(user) - user.sessions.create!(user_agent: request.user_agent, ip_address: request.remote_ip).tap do |session| - Current.session = session - cookies.signed.permanent[:session_id] = { value: session.id, httponly: true, same_site: :lax } - end - end - - def terminate_session - Current.session.destroy - cookies.delete(:session_id) - end -end diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb deleted file mode 100644 index 1189710..0000000 --- a/app/controllers/passwords_controller.rb +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -class PasswordsController < ApplicationController - allow_unauthenticated_access - before_action :set_user_by_token, only: :update - - def create - if user = User.find_by(email_address: params[:email_address]) - PasswordsMailer.reset(user).deliver_later - end - - render json: {}, status: :created - end - - def update - if @user.update(params.permit(:password, :password_confirmation)) - render json: {}, status: :ok - else - render json: { errors: @user.errors.full_messages }, status: :unprocessable_entity - end - end - - private - - def set_user_by_token - @user = User.find_by_password_reset_token!(params[:token]) - rescue ActiveSupport::MessageVerifier::InvalidSignature - render json: { errors: ['Password reset link is invalid or has expired.'] }, status: :unprocessable_entity - end -end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb deleted file mode 100644 index aa74562..0000000 --- a/app/controllers/sessions_controller.rb +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -class SessionsController < ApplicationController - allow_unauthenticated_access only: :create - rate_limit to: 10, within: 3.minutes, only: :create, - with: -> { render json: { errors: ['Rate limit exceeded'] }, status: :too_many_requests } - - def create - if user = User.authenticate_by(params.permit(:email_address, :password)) - start_new_session_for user - render json: {}, status: :created - else - render json: { errors: ['Invalid email address or password'] }, status: :unauthorized - end - end - - def destroy - terminate_session - render json: {}, status: :ok - end -end diff --git a/app/mailers/passwords_mailer.rb b/app/mailers/passwords_mailer.rb deleted file mode 100644 index f3692f0..0000000 --- a/app/mailers/passwords_mailer.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -class PasswordsMailer < ApplicationMailer - def reset(user) - @user = user - mail subject: "Reset your password", to: user.email_address - end -end diff --git a/app/models/current.rb b/app/models/current.rb deleted file mode 100644 index f7b1ab9..0000000 --- a/app/models/current.rb +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -class Current < ActiveSupport::CurrentAttributes - attribute :session - delegate :user, to: :session, allow_nil: true -end diff --git a/app/models/session.rb b/app/models/session.rb deleted file mode 100644 index 9ba68b4..0000000 --- a/app/models/session.rb +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -# == Schema Information -# -# Table name: sessions -# -# id :bigint not null, primary key -# ip_address :string -# user_agent :string -# created_at :datetime not null -# updated_at :datetime not null -# user_id :bigint not null -# -# Indexes -# -# index_sessions_on_user_id (user_id) -# -# Foreign Keys -# -# fk_rails_... (user_id => users.id) -# -class Session < ApplicationRecord - belongs_to :user -end diff --git a/app/models/user.rb b/app/models/user.rb deleted file mode 100644 index 6c752a9..0000000 --- a/app/models/user.rb +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -# == Schema Information -# -# Table name: users -# -# id :bigint not null, primary key -# email_address :string not null -# password_digest :string not null -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# index_users_on_email_address (email_address) UNIQUE -# -class User < ApplicationRecord - has_secure_password - has_many :sessions, dependent: :destroy - - normalizes :email_address, with: ->(e) { e.strip.downcase } -end diff --git a/app/views/passwords_mailer/reset.html.erb b/app/views/passwords_mailer/reset.html.erb deleted file mode 100644 index 9b536ff..0000000 --- a/app/views/passwords_mailer/reset.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -

    - You can reset your password within the next 15 minutes on - <%= link_to "this password reset page", edit_password_url(@user.password_reset_token) %>. -

    diff --git a/app/views/passwords_mailer/reset.text.erb b/app/views/passwords_mailer/reset.text.erb deleted file mode 100644 index 0ce9c12..0000000 --- a/app/views/passwords_mailer/reset.text.erb +++ /dev/null @@ -1,4 +0,0 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> - -You can reset your password within the next 15 minutes on this password reset page: -<%= edit_password_url(@user.password_reset_token) %> diff --git a/config/routes.rb b/config/routes.rb index ed59be2..c9d7ee6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,6 @@ # Copyright (C) 2024 Manuel Bustillo Rails.application.routes.draw do - resource :session, only: %i[create destroy] - resources :passwords, param: :token, only: %w[create update] mount Rswag::Ui::Engine => '/api-docs' mount Rswag::Api::Engine => '/api-docs' resources :groups, only: :index diff --git a/db/migrate/20241118232609_create_users.rb b/db/migrate/20241118232609_create_users.rb deleted file mode 100644 index b1f1381..0000000 --- a/db/migrate/20241118232609_create_users.rb +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -class CreateUsers < ActiveRecord::Migration[8.0] - def change - create_table :users do |t| - t.string :email_address, null: false - t.string :password_digest, null: false - - t.timestamps - end - add_index :users, :email_address, unique: true - end -end diff --git a/db/migrate/20241118232618_create_sessions.rb b/db/migrate/20241118232618_create_sessions.rb deleted file mode 100644 index 3cc4be3..0000000 --- a/db/migrate/20241118232618_create_sessions.rb +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -class CreateSessions < ActiveRecord::Migration[8.0] - def change - create_table :sessions do |t| - t.references :user, null: false, foreign_key: true - t.string :ip_address - t.string :user_agent - - t.timestamps - end - end -end diff --git a/db/schema.rb b/db/schema.rb index 02eeea6..c54ec05 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2024_11_18_232618) do +ActiveRecord::Schema[8.0].define(version: 2024_11_11_063741) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -60,15 +60,6 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_18_232618) do t.index ["tables_arrangement_id"], name: "index_seats_on_tables_arrangement_id" end - create_table "sessions", force: :cascade do |t| - t.bigint "user_id", null: false - t.string "ip_address" - t.string "user_agent" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["user_id"], name: "index_sessions_on_user_id" - end - create_table "solid_queue_blocked_executions", force: :cascade do |t| t.bigint "job_id", null: false t.string "queue_name", null: false @@ -197,19 +188,10 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_18_232618) do t.string "name", null: false end - create_table "users", force: :cascade do |t| - t.string "email_address", null: false - t.string "password_digest", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["email_address"], name: "index_users_on_email_address", unique: true - end - add_foreign_key "groups", "groups", column: "parent_id" add_foreign_key "guests", "groups" add_foreign_key "seats", "guests" add_foreign_key "seats", "tables_arrangements", on_delete: :cascade - add_foreign_key "sessions", "users" add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade diff --git a/spec/requests/passwords_spec.rb b/spec/requests/passwords_spec.rb deleted file mode 100644 index c83a450..0000000 --- a/spec/requests/passwords_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -require 'swagger_helper' - -RSpec.describe 'passwords', type: :request do - path '/passwords' do - post('send a password (re)set email') do - tags 'Passwords' - consumes 'application/json' - produces 'application/json' - parameter name: :body, in: :body, schema: { - type: :object, - required: [:email_address], - properties: { - email_address: { type: :string, format: :email } - } - } - - response_empty_201 - end - end - - path '/passwords/{token}' do - parameter name: 'token', in: :path, type: :string, description: 'token' - put('update password') do - tags 'Passwords' - consumes 'application/json' - produces 'application/json' - parameter name: :body, in: :body, schema: { - type: :object, - required: %i[password password_confirmation], - properties: { - password: { type: :string }, - password_confirmation: { type: :string } - } - } - - response_empty_200 - response_422 - end - end -end diff --git a/spec/requests/sessions_spec.rb b/spec/requests/sessions_spec.rb deleted file mode 100644 index f836a93..0000000 --- a/spec/requests/sessions_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2024 Manuel Bustillo - -require 'swagger_helper' - -RSpec.describe 'sessions', type: :request do - path '/session' do - delete('delete session') do - tags 'Sessions' - produces 'application/json' - response_empty_200 - end - - post('create session') do - tags 'Sessions' - consumes 'application/json' - produces 'application/json' - parameter name: :body, in: :body, schema: { - type: :object, - required: %i[email_address password], - properties: { - email_address: { type: :string, format: :email }, - password: { type: :string } - } - } - - response_empty_201 - response_401 - response_429 - end - end -end diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index d0812dd..1f84ebd 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -9,22 +9,6 @@ module SwaggerResponseHelper end end - def response_429 - response(429, 'Rate limit exceeded') do - produces 'application/json' - error_schema - xit - end - end - - def response_401 - response(401, 'Unauthorized') do - produces 'application/json' - error_schema - xit - end - end - def response_empty_200 response(200, 'Success') do produces 'application/json' From d9ab2f5091dda5ba4b52ea6f47b65d5e8a852137 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 10:59:28 +0100 Subject: [PATCH 149/283] Install devise gem --- Gemfile | 2 + Gemfile.lock | 14 + app/models/user.rb | 22 ++ config/environments/development.rb | 2 + config/initializers/devise.rb | 313 ++++++++++++++++++ config/locales/devise.en.yml | 65 ++++ config/routes.rb | 1 + .../20241130095753_devise_create_users.rb | 44 +++ db/schema.rb | 16 +- spec/factories/users.rb | 5 + spec/models/user_spec.rb | 5 + 11 files changed, 486 insertions(+), 3 deletions(-) create mode 100644 app/models/user.rb create mode 100644 config/initializers/devise.rb create mode 100644 config/locales/devise.en.yml create mode 100644 db/migrate/20241130095753_devise_create_users.rb create mode 100644 spec/factories/users.rb create mode 100644 spec/models/user_spec.rb diff --git a/Gemfile b/Gemfile index 81b24ff..24f8631 100644 --- a/Gemfile +++ b/Gemfile @@ -39,3 +39,5 @@ end gem 'chroma' gem 'solid_queue', '~> 1.0' + +gem "devise", "~> 4.9" diff --git a/Gemfile.lock b/Gemfile.lock index 9ea8033..339a1c5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -81,6 +81,7 @@ GEM babel-source (>= 4.0, < 6) execjs (~> 2.0) base64 (0.2.0) + bcrypt (3.1.20) benchmark (0.4.0) bigdecimal (3.1.8) bindex (0.8.1) @@ -97,6 +98,12 @@ GEM debug (1.9.2) irb (~> 1.10) reline (>= 0.3.8) + devise (4.9.4) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0) + responders + warden (~> 1.2.3) diff-lcs (1.5.1) drb (2.2.1) erubi (1.13.0) @@ -189,6 +196,7 @@ GEM racc (~> 1.4) nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) + orm_adapter (0.5.0) parallel (1.26.3) parser (3.3.5.1) ast (~> 2.4.1) @@ -259,6 +267,9 @@ GEM regexp_parser (2.9.2) reline (0.5.11) io-console (~> 0.5) + responders (3.1.1) + actionpack (>= 5.2) + railties (>= 5.2) rexml (3.3.9) rspec-core (3.13.2) rspec-support (~> 3.13.0) @@ -340,6 +351,8 @@ GEM unicode-display_width (2.6.0) uri (1.0.2) useragent (0.16.10) + warden (1.2.9) + rack (>= 2.0.9) web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) @@ -367,6 +380,7 @@ DEPENDENCIES chroma csv debug + devise (~> 4.9) factory_bot_rails faker importmap-rails diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..84de3d9 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,22 @@ +# == Schema Information +# +# Table name: users +# +# id :bigint not null, primary key +# email :string default(""), not null +# encrypted_password :string default(""), not null +# remember_created_at :datetime +# reset_password_sent_at :datetime +# reset_password_token :string +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_users_on_email (email) UNIQUE +# index_users_on_reset_password_token (reset_password_token) UNIQUE +# +class User < ApplicationRecord + devise :database_authenticatable, :registerable, + :recoverable, :validatable, :confirmable, :lockable +end diff --git a/config/environments/development.rb b/config/environments/development.rb index 49b67a2..501a213 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -43,6 +43,8 @@ Rails.application.configure do config.action_mailer.perform_caching = false + config.action_mailer.default_url_options = { host: 'libre-wedding-planner.app.localhost' } + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb new file mode 100644 index 0000000..7de951c --- /dev/null +++ b/config/initializers/devise.rb @@ -0,0 +1,313 @@ +# frozen_string_literal: true + +# Assuming you have not yet modified this file, each configuration option below +# is set to its default value. Note that some are commented out while others +# are not: uncommented lines are intended to protect your configuration from +# breaking changes in upgrades (i.e., in the event that future versions of +# Devise change the default values for those options). +# +# Use this hook to configure devise mailer, warden hooks and so forth. +# Many of these configuration options can be set straight in your model. +Devise.setup do |config| + # The secret key used by Devise. Devise uses this key to generate + # random tokens. Changing this key will render invalid all existing + # confirmation, reset password and unlock tokens in the database. + # Devise will use the `secret_key_base` as its `secret_key` + # by default. You can change it below and use your own secret key. + # config.secret_key = '11353ae8c2bf66dd638d9edff9ec82856aecf74bba6c598273559a8750c902d3439da1b301e40c47578577a971f1058dbf37211c107fba5107c29baa654e9888' + + # ==> Controller configuration + # Configure the parent class to the devise controllers. + # config.parent_controller = 'DeviseController' + + # ==> Mailer Configuration + # Configure the e-mail address which will be shown in Devise::Mailer, + # note that it will be overwritten if you use your own mailer class + # with default "from" parameter. + config.mailer_sender = 'noreply@libreweddingplanner.org' + + # Configure the class responsible to send e-mails. + # config.mailer = 'Devise::Mailer' + + # Configure the parent class responsible to send e-mails. + # config.parent_mailer = 'ActionMailer::Base' + + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default) and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'devise/orm/active_record' + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating a user. The default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating a user, both parameters are required. Remember that those + # parameters are used only when authenticating and not when retrieving from + # session. If you need permissions, you should implement that in a before filter. + # You can also supply a hash where the value is a boolean determining whether + # or not authentication should be aborted when the value is not present. + # config.authentication_keys = [:email] + + # Configure parameters from the request object used for authentication. Each entry + # given should be a request method and it will automatically be passed to the + # find_for_authentication method and considered in your model lookup. For instance, + # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. + # The same considerations mentioned for authentication_keys also apply to request_keys. + # config.request_keys = [] + + # Configure which authentication keys should be case-insensitive. + # These keys will be downcased upon creating or modifying a user and when used + # to authenticate or find a user. Default is :email. + config.case_insensitive_keys = [:email] + + # Configure which authentication keys should have whitespace stripped. + # These keys will have whitespace before and after removed upon creating or + # modifying a user and when used to authenticate or find a user. Default is :email. + config.strip_whitespace_keys = [:email] + + # Tell if authentication through request.params is enabled. True by default. + # It can be set to an array that will enable params authentication only for the + # given strategies, for example, `config.params_authenticatable = [:database]` will + # enable it only for database (email + password) authentication. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Auth is enabled. False by default. + # It can be set to an array that will enable http authentication only for the + # given strategies, for example, `config.http_authenticatable = [:database]` will + # enable it only for database authentication. + # For API-only applications to support authentication "out-of-the-box", you will likely want to + # enable this with :database unless you are using a custom strategy. + # The supported strategies are: + # :database = Support basic authentication with authentication key + password + # config.http_authenticatable = false + + # If 401 status code should be returned for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true + + # The realm used in Http Basic Authentication. 'Application' by default. + # config.http_authentication_realm = 'Application' + + # It will change confirmation, password recovery and other workflows + # to behave the same regardless if the e-mail provided was right or wrong. + # Does not affect registerable. + config.paranoid = true + + # By default Devise will store the user in session. You can skip storage for + # particular strategies by setting this option. + # Notice that if you are skipping storage for all authentication paths, you + # may want to disable generating routes to Devise's sessions controller by + # passing skip: :sessions to `devise_for` in your config/routes.rb + config.skip_session_storage = [:http_auth] + + # By default, Devise cleans up the CSRF token on authentication to + # avoid CSRF token fixation attacks. This means that, when using AJAX + # requests for sign in and sign up, you need to get a new CSRF token + # from the server. You can disable this option at your own risk. + # config.clean_up_csrf_token_on_authentication = true + + # When false, Devise will not attempt to reload routes on eager load. + # This can reduce the time taken to boot the app but if your application + # requires the Devise mappings to be loaded during boot time the application + # won't boot properly. + # config.reload_routes = true + + # ==> Configuration for :database_authenticatable + # For bcrypt, this is the cost for hashing the password and defaults to 12. If + # using other algorithms, it sets how many times you want the password to be hashed. + # The number of stretches used for generating the hashed password are stored + # with the hashed password. This allows you to change the stretches without + # invalidating existing passwords. + # + # Limiting the stretches to just one in testing will increase the performance of + # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use + # a value less than 10 in other environments. Note that, for bcrypt (the default + # algorithm), the cost increases exponentially with the number of stretches (e.g. + # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). + config.stretches = Rails.env.test? ? 1 : 12 + + # Set up a pepper to generate the hashed password. + # config.pepper = '6f86425fd587f80f4a338a785a6abbbccf8de7322f70fcccf356118d982942c9421819445f9d236a296fa3c431ef5e509be20e6db03f90ec2b42aa78f3a7e526' + + # Send a notification to the original email when the user's email is changed. + config.send_email_changed_notification = false + + # Send a notification email when the user's password is changed. + config.send_password_change_notification = false + + # ==> Configuration for :confirmable + # A period that the user is allowed to access the website even without + # confirming their account. For instance, if set to 2.days, the user will be + # able to access the website for two days without confirming their account, + # access will be blocked just in the third day. + # You can also set it to nil, which will allow the user to access the website + # without confirming their account. + # Default is 0.days, meaning the user cannot access the website without + # confirming their account. + # config.allow_unconfirmed_access_for = 2.days + + # A period that the user is allowed to confirm their account before their + # token becomes invalid. For example, if set to 3.days, the user can confirm + # their account within 3 days after the mail was sent, but on the fourth day + # their account can't be confirmed with the token any more. + # Default is nil, meaning there is no restriction on how long a user can take + # before confirming their account. + config.confirm_within = 3.days + + # If true, requires any email changes to be confirmed (exactly the same way as + # initial account confirmation) to be applied. Requires additional unconfirmed_email + # db field (see migrations). Until confirmed, new email is stored in + # unconfirmed_email column, and copied to email column on successful confirmation. + config.reconfirmable = true + + # Defines which key will be used when confirming an account + # config.confirmation_keys = [:email] + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # Invalidates all the remember me tokens when the user signs out. + config.expire_all_remember_me_on_sign_out = true + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # Options to be passed to the created cookie. For instance, you can set + # secure: true in order to force SSL only cookies. + # config.rememberable_options = {} + + # ==> Configuration for :validatable + # Range for password length. + config.password_length = 15..128 + + # Email regex used to validate email formats. It simply asserts that + # one (and only one) @ exists in the given string. This is mainly + # to give user feedback and not to assert the e-mail validity. + config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ + + # ==> Configuration for :timeoutable + # The time you want to timeout the user session without activity. After this + # time the user will be asked for credentials again. Default is 30 minutes. + # config.timeout_in = 30.minutes + + # ==> Configuration for :lockable + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + config.lock_strategy = :failed_attempts + + # Defines which key will be used when locking and unlocking an account + # config.unlock_keys = [:email] + + # Defines which strategy will be used to unlock an account. + # :email = Sends an unlock link to the user email + # :time = Re-enables login after a certain amount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. + config.unlock_strategy = :both + + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + config.maximum_attempts = 10 + + # Time interval to unlock the account if :time is enabled as unlock_strategy. + config.unlock_in = 1.hour + + # Warn on the last attempt before the account is locked. + # config.last_attempt_warning = true + + # ==> Configuration for :recoverable + # + # Defines which key will be used when recovering the password for an account + # config.reset_password_keys = [:email] + + # Time interval you can reset your password with a reset password key. + # Don't put a too small interval or your users won't have the time to + # change their passwords. + config.reset_password_within = 6.hours + + # When set to false, does not sign a user in automatically after their password is + # reset. Defaults to true, so a user is signed in automatically after a reset. + config.sign_in_after_reset_password = true + + # ==> Configuration for :encryptable + # Allow you to use another hashing or encryption algorithm besides bcrypt (default). + # You can use :sha1, :sha512 or algorithms from others authentication tools as + # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 + # for default behavior) and :restful_authentication_sha1 (then you should set + # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). + # + # Require the `devise-encryptable` gem when using anything other than bcrypt + # config.encryptor = :sha512 + + # ==> Scopes configuration + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "users/sessions/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = false + + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes (usually :user). + # config.default_scope = :user + + # Set this configuration to false if you want /users/sign_out to sign out + # only the current scope. By default, Devise signs out all scopes. + # config.sign_out_all_scopes = true + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. + # + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. + # + # The "*/*" below is required to match Internet Explorer requests. + # config.navigational_formats = ['*/*', :html, :turbo_stream] + + # The default HTTP method used to sign out a resource. Default is :delete. + config.sign_out_via = :delete + + # ==> OmniAuth + # Add a new OmniAuth provider. Check the wiki for more information on setting + # up on your models and hooks. + # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' + + # ==> Warden configuration + # If you want to use other strategies, that are not supported by Devise, or + # change the failure app, you can configure them inside the config.warden block. + # + # config.warden do |manager| + # manager.intercept_401 = false + # manager.default_strategies(scope: :user).unshift :some_external_strategy + # end + + # ==> Mountable engine configurations + # When using Devise inside an engine, let's call it `MyEngine`, and this engine + # is mountable, there are some extra configurations to be taken into account. + # The following options are available, assuming the engine is mounted as: + # + # mount MyEngine, at: '/my_engine' + # + # The router that invoked `devise_for`, in the example above, would be: + # config.router_name = :my_engine + # + # When using OmniAuth, Devise cannot automatically set OmniAuth path, + # so you need to do it manually. For the users scope, it would be: + # config.omniauth_path_prefix = '/my_engine/users/auth' + + # ==> Hotwire/Turbo configuration + # When using Devise with Hotwire/Turbo, the http status for error responses + # and some redirects must match the following. The default in Devise for existing + # apps is `200 OK` and `302 Found` respectively, but new apps are generated with + # these new defaults that match Hotwire/Turbo behavior. + # Note: These might become the new default in future versions of Devise. + config.responder.error_status = :unprocessable_entity + config.responder.redirect_status = :see_other + + # ==> Configuration for :registerable + + # When set to false, does not sign a user in automatically after their password is + # changed. Defaults to true, so a user is signed in automatically after changing a password. + # config.sign_in_after_change_password = true +end diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml new file mode 100644 index 0000000..260e1c4 --- /dev/null +++ b/config/locales/devise.en.yml @@ -0,0 +1,65 @@ +# Additional translations at https://github.com/heartcombo/devise/wiki/I18n + +en: + devise: + confirmations: + confirmed: "Your email address has been successfully confirmed." + send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." + failure: + already_authenticated: "You are already signed in." + inactive: "Your account is not activated yet." + invalid: "Invalid %{authentication_keys} or password." + locked: "Your account is locked." + last_attempt: "You have one more attempt before your account is locked." + not_found_in_database: "Invalid %{authentication_keys} or password." + timeout: "Your session expired. Please sign in again to continue." + unauthenticated: "You need to sign in or sign up before continuing." + unconfirmed: "You have to confirm your email address before continuing." + mailer: + confirmation_instructions: + subject: "Confirmation instructions" + reset_password_instructions: + subject: "Reset password instructions" + unlock_instructions: + subject: "Unlock instructions" + email_changed: + subject: "Email Changed" + password_change: + subject: "Password Changed" + omniauth_callbacks: + failure: "Could not authenticate you from %{kind} because \"%{reason}\"." + success: "Successfully authenticated from %{kind} account." + passwords: + no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." + send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." + updated: "Your password has been changed successfully. You are now signed in." + updated_not_active: "Your password has been changed successfully." + registrations: + destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." + signed_up: "Welcome! You have signed up successfully." + signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." + signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." + signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." + update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address." + updated: "Your account has been updated successfully." + updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again." + sessions: + signed_in: "Signed in successfully." + signed_out: "Signed out successfully." + already_signed_out: "Signed out successfully." + unlocks: + send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." + send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." + unlocked: "Your account has been unlocked successfully. Please sign in to continue." + errors: + messages: + already_confirmed: "was already confirmed, please try signing in" + confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" + expired: "has expired, please request a new one" + not_found: "not found" + not_locked: "was not locked" + not_saved: + one: "1 error prohibited this %{resource} from being saved:" + other: "%{count} errors prohibited this %{resource} from being saved:" diff --git a/config/routes.rb b/config/routes.rb index c9d7ee6..4000ade 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,7 @@ # Copyright (C) 2024 Manuel Bustillo Rails.application.routes.draw do + devise_for :users mount Rswag::Ui::Engine => '/api-docs' mount Rswag::Api::Engine => '/api-docs' resources :groups, only: :index diff --git a/db/migrate/20241130095753_devise_create_users.rb b/db/migrate/20241130095753_devise_create_users.rb new file mode 100644 index 0000000..74745e4 --- /dev/null +++ b/db/migrate/20241130095753_devise_create_users.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +class DeviseCreateUsers < ActiveRecord::Migration[8.0] + def change + create_table :users do |t| + ## Database authenticatable + t.string :email, null: false, default: "" + t.string :encrypted_password, null: false, default: "" + + ## Recoverable + t.string :reset_password_token + t.datetime :reset_password_sent_at + + ## Rememberable + t.datetime :remember_created_at + + ## Trackable + # t.integer :sign_in_count, default: 0, null: false + # t.datetime :current_sign_in_at + # t.datetime :last_sign_in_at + # t.string :current_sign_in_ip + # t.string :last_sign_in_ip + + ## Confirmable + # t.string :confirmation_token + # t.datetime :confirmed_at + # t.datetime :confirmation_sent_at + # t.string :unconfirmed_email # Only if using reconfirmable + + ## Lockable + # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts + # t.string :unlock_token # Only if unlock strategy is :email or :both + # t.datetime :locked_at + + + t.timestamps null: false + end + + add_index :users, :email, unique: true + add_index :users, :reset_password_token, unique: true + # add_index :users, :confirmation_token, unique: true + # add_index :users, :unlock_token, unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index c54ec05..7976090 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2024_11_11_063741) do +ActiveRecord::Schema[8.0].define(version: 2024_11_30_095753) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -188,6 +186,18 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_11_063741) do t.string "name", null: false end + create_table "users", force: :cascade do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + end + add_foreign_key "groups", "groups", column: "parent_id" add_foreign_key "guests", "groups" add_foreign_key "seats", "guests" diff --git a/spec/factories/users.rb b/spec/factories/users.rb new file mode 100644 index 0000000..628434c --- /dev/null +++ b/spec/factories/users.rb @@ -0,0 +1,5 @@ +FactoryBot.define do + factory :user do + + end +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb new file mode 100644 index 0000000..47a31bb --- /dev/null +++ b/spec/models/user_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe User, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 63c7bc8772802cfbceb34198635442d3414ce9e9 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 11:01:44 +0100 Subject: [PATCH 150/283] Refine columns in the users table --- app/models/user.rb | 10 +++++++++- .../20241130095753_devise_create_users.rb | 20 +++++++++---------- db/schema.rb | 10 +++++++++- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 84de3d9..2104185 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -3,18 +3,26 @@ # Table name: users # # id :bigint not null, primary key +# confirmation_sent_at :datetime +# confirmation_token :string +# confirmed_at :datetime # email :string default(""), not null # encrypted_password :string default(""), not null -# remember_created_at :datetime +# failed_attempts :integer default(0), not null +# locked_at :datetime # reset_password_sent_at :datetime # reset_password_token :string +# unconfirmed_email :string +# unlock_token :string # created_at :datetime not null # updated_at :datetime not null # # Indexes # +# index_users_on_confirmation_token (confirmation_token) UNIQUE # index_users_on_email (email) UNIQUE # index_users_on_reset_password_token (reset_password_token) UNIQUE +# index_users_on_unlock_token (unlock_token) UNIQUE # class User < ApplicationRecord devise :database_authenticatable, :registerable, diff --git a/db/migrate/20241130095753_devise_create_users.rb b/db/migrate/20241130095753_devise_create_users.rb index 74745e4..718cea0 100644 --- a/db/migrate/20241130095753_devise_create_users.rb +++ b/db/migrate/20241130095753_devise_create_users.rb @@ -12,7 +12,7 @@ class DeviseCreateUsers < ActiveRecord::Migration[8.0] t.datetime :reset_password_sent_at ## Rememberable - t.datetime :remember_created_at + # t.datetime :remember_created_at ## Trackable # t.integer :sign_in_count, default: 0, null: false @@ -22,15 +22,15 @@ class DeviseCreateUsers < ActiveRecord::Migration[8.0] # t.string :last_sign_in_ip ## Confirmable - # t.string :confirmation_token - # t.datetime :confirmed_at - # t.datetime :confirmation_sent_at - # t.string :unconfirmed_email # Only if using reconfirmable + t.string :confirmation_token + t.datetime :confirmed_at + t.datetime :confirmation_sent_at + t.string :unconfirmed_email # Only if using reconfirmable ## Lockable - # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts - # t.string :unlock_token # Only if unlock strategy is :email or :both - # t.datetime :locked_at + t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts + t.string :unlock_token # Only if unlock strategy is :email or :both + t.datetime :locked_at t.timestamps null: false @@ -38,7 +38,7 @@ class DeviseCreateUsers < ActiveRecord::Migration[8.0] add_index :users, :email, unique: true add_index :users, :reset_password_token, unique: true - # add_index :users, :confirmation_token, unique: true - # add_index :users, :unlock_token, unique: true + add_index :users, :confirmation_token, unique: true + add_index :users, :unlock_token, unique: true end end diff --git a/db/schema.rb b/db/schema.rb index 7976090..4297661 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -191,11 +191,19 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_095753) do t.string "encrypted_password", default: "", null: false t.string "reset_password_token" t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + t.string "unconfirmed_email" + t.integer "failed_attempts", default: 0, null: false + t.string "unlock_token" + t.datetime "locked_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["email"], name: "index_users_on_email", unique: true t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true end add_foreign_key "groups", "groups", column: "parent_id" From 13bdaf0bd20fb74b34a9a0cc4a90a9db9a6fb1c4 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 10:03:46 +0000 Subject: [PATCH 151/283] Add copyright notice --- app/models/user.rb | 2 ++ config/initializers/devise.rb | 2 ++ db/migrate/20241130095753_devise_create_users.rb | 2 ++ db/schema.rb | 2 ++ spec/factories/users.rb | 2 ++ spec/models/user_spec.rb | 2 ++ 6 files changed, 12 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index 2104185..ff94b20 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # == Schema Information # # Table name: users diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 7de951c..77d542f 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Assuming you have not yet modified this file, each configuration option below diff --git a/db/migrate/20241130095753_devise_create_users.rb b/db/migrate/20241130095753_devise_create_users.rb index 718cea0..d1fb02d 100644 --- a/db/migrate/20241130095753_devise_create_users.rb +++ b/db/migrate/20241130095753_devise_create_users.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true class DeviseCreateUsers < ActiveRecord::Migration[8.0] diff --git a/db/schema.rb b/db/schema.rb index 4297661..45b3d87 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 628434c..7839fbe 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + FactoryBot.define do factory :user do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 47a31bb..0277d58 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' RSpec.describe User, type: :model do From ed7207d70705b03b1b50fbf15c8dcf0210f9198b Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 11:03:29 +0100 Subject: [PATCH 152/283] Require user authentication by default --- app/controllers/application_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 57926f3..ef8cf29 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,7 @@ # Copyright (C) 2024 Manuel Bustillo class ApplicationController < ActionController::Base + before_action :authenticate_user! after_action :set_csrf_cookie skip_before_action :verify_authenticity_token, if: :development_swagger? From b8e6df732c5f43c30aefd3ac7bf811292605cedc Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 14:24:02 +0100 Subject: [PATCH 153/283] Generate user model, document some endpoints (missing email verification) --- .../users/registrations_controller.rb | 4 ++ app/controllers/users/sessions_controller.rb | 8 ++++ app/models/user.rb | 2 +- config/routes.rb | 8 +++- .../20241130095753_devise_create_users.rb | 2 +- db/schema.rb | 4 +- spec/requests/expenses_spec.rb | 2 + spec/requests/groups_spec.rb | 1 + spec/requests/guests_spec.rb | 4 ++ spec/requests/schemas.rb | 11 +++++ spec/requests/users/registrations_spec.rb | 33 +++++++++++++ spec/requests/users/sessions_spec.rb | 47 +++++++++++++++++++ spec/swagger_helper.rb | 1 + spec/swagger_response_helper.rb | 23 +++++++++ 14 files changed, 144 insertions(+), 6 deletions(-) create mode 100644 app/controllers/users/registrations_controller.rb create mode 100644 app/controllers/users/sessions_controller.rb create mode 100644 spec/requests/schemas.rb create mode 100644 spec/requests/users/registrations_spec.rb create mode 100644 spec/requests/users/sessions_spec.rb diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb new file mode 100644 index 0000000..538b5f0 --- /dev/null +++ b/app/controllers/users/registrations_controller.rb @@ -0,0 +1,4 @@ +class Users::RegistrationsController < Devise::RegistrationsController + clear_respond_to + respond_to :json +end \ No newline at end of file diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb new file mode 100644 index 0000000..7d78323 --- /dev/null +++ b/app/controllers/users/sessions_controller.rb @@ -0,0 +1,8 @@ +class Users::SessionsController < Devise::SessionsController + clear_respond_to + respond_to :json + + # skip_before_action :authenticate_user!, only: %i[create] + + # skip_before_action :verify_authenticity_token, if: :development_swagger? +end \ No newline at end of file diff --git a/app/models/user.rb b/app/models/user.rb index ff94b20..d338416 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -4,7 +4,7 @@ # # Table name: users # -# id :bigint not null, primary key +# id :uuid not null, primary key # confirmation_sent_at :datetime # confirmation_token :string # confirmed_at :datetime diff --git a/config/routes.rb b/config/routes.rb index 4000ade..ffd2772 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,13 @@ # Copyright (C) 2024 Manuel Bustillo Rails.application.routes.draw do - devise_for :users + devise_scope :user do + post 'users', to: 'users/registrations#create' + + post '/users/sign_in', to: 'users/sessions#create' + delete '/users/sign_out', to: 'users/sessions#destroy' + end + mount Rswag::Ui::Engine => '/api-docs' mount Rswag::Api::Engine => '/api-docs' resources :groups, only: :index diff --git a/db/migrate/20241130095753_devise_create_users.rb b/db/migrate/20241130095753_devise_create_users.rb index d1fb02d..977c72e 100644 --- a/db/migrate/20241130095753_devise_create_users.rb +++ b/db/migrate/20241130095753_devise_create_users.rb @@ -4,7 +4,7 @@ class DeviseCreateUsers < ActiveRecord::Migration[8.0] def change - create_table :users do |t| + create_table :users, id: :uuid do |t| ## Database authenticatable t.string :email, null: false, default: "" t.string :encrypted_password, null: false, default: "" diff --git a/db/schema.rb b/db/schema.rb index 45b3d87..d61fb3a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -188,7 +186,7 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_095753) do t.string "name", null: false end - create_table "users", force: :cascade do |t| + create_table "users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index c96b5cf..5e99097 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -22,6 +22,7 @@ RSpec.describe 'expenses', type: :request do xit end + regular_api_responses end end @@ -44,6 +45,7 @@ RSpec.describe 'expenses', type: :request do response_empty_200 response_422 response_404 + regular_api_responses end end end diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index 597848f..fd014b5 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -28,6 +28,7 @@ RSpec.describe 'groups', type: :request do } xit end + regular_api_responses end end end diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index df26f17..b73fbcb 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -26,6 +26,7 @@ RSpec.describe 'guests', type: :request do } xit end + regular_api_responses end post('create guest') do @@ -50,6 +51,7 @@ RSpec.describe 'guests', type: :request do response_empty_201 response_422 + regular_api_responses end end @@ -77,6 +79,7 @@ RSpec.describe 'guests', type: :request do response_empty_200 response_422 response_404 + regular_api_responses end delete('delete guest') do @@ -86,6 +89,7 @@ RSpec.describe 'guests', type: :request do response_empty_200 response_404 + regular_api_responses end end end diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb new file mode 100644 index 0000000..18e8548 --- /dev/null +++ b/spec/requests/schemas.rb @@ -0,0 +1,11 @@ +module Swagger + module Schema + USER = { + id: { type: :string, format: :uuid }, + email: { type: :string, format: :email }, + created_at: SwaggerResponseHelper::TIMESTAMP, + updated_at: SwaggerResponseHelper::TIMESTAMP + + } + end +end \ No newline at end of file diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb new file mode 100644 index 0000000..aec3464 --- /dev/null +++ b/spec/requests/users/registrations_spec.rb @@ -0,0 +1,33 @@ +require 'swagger_helper' + +RSpec.describe 'users/registrations', type: :request do + + path '/users' do + post('create registration') do + tags 'Users Registrations' + consumes 'application/json' + produces 'application/json' + + parameter name: :body, in: :body, schema: { + type: :object, + required: [:user], + properties: { + user: { + type: :object, + required: %i[email password password_confirmation], + properties: { + email: { type: :string, format: :email}, + password: SwaggerResponseHelper::PASSWORD, + password_confirmation: SwaggerResponseHelper::PASSWORD + } + } + } + } + + response(201, 'created') do + schema type: :object, properties: Swagger::Schema::USER + xit + end + end + end +end diff --git a/spec/requests/users/sessions_spec.rb b/spec/requests/users/sessions_spec.rb new file mode 100644 index 0000000..2984ee9 --- /dev/null +++ b/spec/requests/users/sessions_spec.rb @@ -0,0 +1,47 @@ +require 'swagger_helper' + +RSpec.describe 'users/sessions', type: :request do + + path '/users/sign_in' do + + post('create session') do + tags 'Users Sessions' + consumes 'application/json' + produces 'application/json' + + parameter name: :body, in: :body, schema: { + type: :object, + required: %i[user], + properties: { + user: { + type: :object, + required: %i[email password], + properties: { + email: { type: :string, format: :email }, + password: SwaggerResponseHelper::PASSWORD + } + } + } + } + + response(201, 'created') do + schema type: :object, properties: Swagger::Schema::USER + xit + end + + response_401(message: 'Invalid Email or password.') + end + end + + path '/users/sign_out' do + + delete('delete session') do + tags 'Users Sessions' + consumes 'application/json' + produces 'application/json' + response(204, 'Session destroyed') do + xit + end + end + end +end diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index b87d934..2b19be8 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -4,6 +4,7 @@ require 'rails_helper' require_relative './swagger_response_helper' +require_relative './requests/schemas.rb' include SwaggerResponseHelper diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index 1f84ebd..d7f2e0e 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -1,6 +1,17 @@ # Copyright (C) 2024 Manuel Bustillo module SwaggerResponseHelper + TIMESTAMP_FORMAT = '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z' + TIMESTAMP_EXAMPLE = Time.zone.now.iso8601(3) + + TIMESTAMP = {type: :string,pattern: TIMESTAMP_FORMAT,example: TIMESTAMP_EXAMPLE}.freeze + PASSWORD = { type: :string, minLength: User.password_length.begin, maxLength: User.password_length.end } + + + def regular_api_responses + response_401 + end + def response_422 response(422, 'Validation errors in input parameters') do produces 'application/json' @@ -33,6 +44,18 @@ module SwaggerResponseHelper end end + def response_401(message: nil) + response(401, 'Unauthorized') do + produces 'application/json' + schema type: :object, + required: %i[error], + properties: { + error: { type: :string, example: message || 'You need to sign in or sign up before continuing.' } + } + xit + end + end + private def error_schema From f5038f5b96f12c0a90893f59297db0b5bc19e334 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 14:25:01 +0100 Subject: [PATCH 154/283] Code cleanup --- app/controllers/users/sessions_controller.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 7d78323..f102186 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -1,8 +1,4 @@ class Users::SessionsController < Devise::SessionsController clear_respond_to respond_to :json - - # skip_before_action :authenticate_user!, only: %i[create] - - # skip_before_action :verify_authenticity_token, if: :development_swagger? end \ No newline at end of file From 5458c6dd8cec74f017b1afef8d1c94bd4057202f Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 13:27:21 +0000 Subject: [PATCH 155/283] Add copyright notice --- app/controllers/users/registrations_controller.rb | 2 ++ app/controllers/users/sessions_controller.rb | 2 ++ db/schema.rb | 2 ++ spec/requests/schemas.rb | 2 ++ spec/requests/users/registrations_spec.rb | 2 ++ spec/requests/users/sessions_spec.rb | 2 ++ 6 files changed, 12 insertions(+) diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 538b5f0..09ffe33 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class Users::RegistrationsController < Devise::RegistrationsController clear_respond_to respond_to :json diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index f102186..0de9af5 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class Users::SessionsController < Devise::SessionsController clear_respond_to respond_to :json diff --git a/db/schema.rb b/db/schema.rb index d61fb3a..6e9d747 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index 18e8548..7a49ca0 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + module Swagger module Schema USER = { diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index aec3464..f92222c 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'users/registrations', type: :request do diff --git a/spec/requests/users/sessions_spec.rb b/spec/requests/users/sessions_spec.rb index 2984ee9..ff7c8a3 100644 --- a/spec/requests/users/sessions_spec.rb +++ b/spec/requests/users/sessions_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'users/sessions', type: :request do From b0124fbd26e896c7ea2e34bce3e716989cfdf1f9 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 18:46:25 +0100 Subject: [PATCH 156/283] Configure email confirmation flow --- .../users/confirmations_controller.rb | 18 +++++++++++++++++ config/routes.rb | 3 +++ spec/requests/users/confirmations_spec.rb | 20 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 app/controllers/users/confirmations_controller.rb create mode 100644 spec/requests/users/confirmations_spec.rb diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb new file mode 100644 index 0000000..5708a64 --- /dev/null +++ b/app/controllers/users/confirmations_controller.rb @@ -0,0 +1,18 @@ +class Users::ConfirmationsController < Devise::ConfirmationsController + clear_respond_to + respond_to :json + + def show + super do |resource| + if resource.errors.empty? + render json: resource, status: :ok + else + render json: { + message: 'Record invalid', + errors: resource.errors.full_messages + }, status: :unprocessable_entity + end + return + end + end +end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index ffd2772..4599490 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,11 +1,14 @@ # Copyright (C) 2024 Manuel Bustillo Rails.application.routes.draw do + devise_for :users, skip: [:registration, :session, :confirmation] devise_scope :user do post 'users', to: 'users/registrations#create' post '/users/sign_in', to: 'users/sessions#create' delete '/users/sign_out', to: 'users/sessions#destroy' + + get '/users/confirmation', to: 'users/confirmations#show', as: :confirmation end mount Rswag::Ui::Engine => '/api-docs' diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb new file mode 100644 index 0000000..77355ca --- /dev/null +++ b/spec/requests/users/confirmations_spec.rb @@ -0,0 +1,20 @@ +require 'swagger_helper' + +RSpec.describe 'users/confirmations', type: :request do + + path '/users/confirmation' do + get('confirm user email') do + tags 'Users' + produces 'application/json' + + parameter name: :confirmation_token, in: :query, type: :string, required: true + + response(200, 'confirmed') do + schema Swagger::Schema::USER + xit + end + + response_422 + end + end +end From 598cb553c99fcee51100f768f0269f683a7f46fa Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 17:47:30 +0000 Subject: [PATCH 157/283] Add copyright notice --- app/controllers/users/confirmations_controller.rb | 2 ++ spec/requests/users/confirmations_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index 5708a64..ffcb52c 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class Users::ConfirmationsController < Devise::ConfirmationsController clear_respond_to respond_to :json diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb index 77355ca..e99794e 100644 --- a/spec/requests/users/confirmations_spec.rb +++ b/spec/requests/users/confirmations_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'users/confirmations', type: :request do From b892d4006f3c8ba89a29d9d62f105e2dda7c17a7 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 19:09:04 +0100 Subject: [PATCH 158/283] Configure letter opener to read emails via web UI --- Gemfile | 1 + Gemfile.lock | 13 +++++++++++++ app/controllers/application_controller.rb | 2 +- app/controllers/users/confirmations_controller.rb | 5 ++++- config/environments/development.rb | 6 +++--- config/routes.rb | 3 +++ nginx.conf | 5 +++++ 7 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 24f8631..cc2ec6e 100644 --- a/Gemfile +++ b/Gemfile @@ -35,6 +35,7 @@ end group :development do gem 'rubocop' gem 'web-console' + gem 'letter_opener_web' end gem 'chroma' diff --git a/Gemfile.lock b/Gemfile.lock index 339a1c5..d4af6c3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -88,6 +88,8 @@ GEM bootsnap (1.18.4) msgpack (~> 1.2) builder (3.3.0) + childprocess (5.1.0) + logger (~> 1.5) chroma (0.2.0) coderay (1.1.3) concurrent-ruby (1.3.4) @@ -150,6 +152,16 @@ GEM jsonapi-serializable (0.3.1) jsonapi-renderer (~> 0.2.0) language_server-protocol (3.17.0.3) + launchy (3.0.1) + addressable (~> 2.8) + childprocess (~> 5.0) + letter_opener (1.10.0) + launchy (>= 2.2, < 4) + letter_opener_web (3.0.0) + actionmailer (>= 6.1) + letter_opener (~> 1.9) + railties (>= 6.1) + rexml license_finder (7.2.1) bundler csv (~> 3.2) @@ -386,6 +398,7 @@ DEPENDENCIES importmap-rails jbuilder jsonapi-rails + letter_opener_web license_finder money pg (~> 1.1) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ef8cf29..0d2a0c7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -31,7 +31,7 @@ class ApplicationController < ActionController::Base def development_swagger? Rails.env.test? || - Rails.env.development? && request.headers['referer'].include?('/api-docs/index.html') + Rails.env.development? && request.headers['referer']&.include?('/api-docs/index.html') end def set_csrf_cookie diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index 5708a64..a6e3280 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -5,7 +5,10 @@ class Users::ConfirmationsController < Devise::ConfirmationsController def show super do |resource| if resource.errors.empty? - render json: resource, status: :ok + respond_to do |format| + format.json { render json: resource, status: :ok } + format.any { redirect_to root_path } + end else render json: { message: 'Record invalid', diff --git a/config/environments/development.rb b/config/environments/development.rb index 501a213..b3b6593 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -40,10 +40,10 @@ Rails.application.configure do # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false - config.action_mailer.perform_caching = false - - config.action_mailer.default_url_options = { host: 'libre-wedding-planner.app.localhost' } + config.action_mailer.default_url_options = { host: 'libre-wedding-planner.app.localhost/api' } + config.action_mailer.delivery_method = :letter_opener_web + config.action_mailer.perform_deliveries = true # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log diff --git a/config/routes.rb b/config/routes.rb index 4599490..35fd068 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,7 @@ # Copyright (C) 2024 Manuel Bustillo Rails.application.routes.draw do + mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? devise_for :users, skip: [:registration, :session, :confirmation] devise_scope :user do post 'users', to: 'users/registrations#create' @@ -23,4 +24,6 @@ Rails.application.routes.draw do resources :tables_arrangements, only: %i[index show] get 'up' => 'rails/health#show', as: :rails_health_check + + root to: redirect('/dashboard') end diff --git a/nginx.conf b/nginx.conf index 995c062..06d059b 100644 --- a/nginx.conf +++ b/nginx.conf @@ -7,6 +7,11 @@ server { proxy_set_header Host $http_host; } + location /letter_opener/ { + proxy_pass http://backend:3000/letter_opener/; + proxy_set_header Host $http_host; + } + location / { proxy_pass http://frontend:3000; proxy_set_header Host $http_host; From 918bc0c1a8ffc2b6bdb6b7b6e5f07d8b4b2dfe4a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 19:10:16 +0100 Subject: [PATCH 159/283] Remove noisy log messages --- app/services/vns/engine.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index 65ceb71..f4041c6 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -28,10 +28,7 @@ module VNS @best_solution = @initial_solution @best_score = @target_function.call(@best_solution) - puts "Initial score: #{@best_score.to_f}" - self.class.sequence(@perturbations).each do |perturbation| - puts "Running perturbation: #{perturbation.name}" optimize(perturbation.new(@best_solution)) end @@ -48,8 +45,6 @@ module VNS @best_solution = alternative_solution.deep_dup @best_score = score - puts "New lowest score: #{@best_score.to_f}" - return optimize(perturbation.class.new(@best_solution)) end end From 2889dc5c98104b67eed41831a7fff995d4595833 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 19:12:13 +0100 Subject: [PATCH 160/283] Update README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 93a449f..8e8d48e 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,10 @@ The backend, frontend and workers have hot-reloading enabled, so changes made to Once all containers have started, visit http://libre-wedding-planner.app.localhost/dashboard to load the application. +## Email delivery + +In the development environment, real emails will not be sent. You can visit http://libre-wedding-planner.app.localhost/letter_opener/ to get a list of emails generated by the application. + ## Testing Unit tests can be executed with From 7803df74940d26295efe71ec0a9427815ecc1b7f Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 18:14:58 +0000 Subject: [PATCH 161/283] Add copyright notice --- app/controllers/users/confirmations_controller.rb | 2 ++ spec/requests/users/confirmations_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index a6e3280..660d263 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class Users::ConfirmationsController < Devise::ConfirmationsController clear_respond_to respond_to :json diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb index 77355ca..e99794e 100644 --- a/spec/requests/users/confirmations_spec.rb +++ b/spec/requests/users/confirmations_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'users/confirmations', type: :request do From 5700532ac7a17f20f5f481aa93fa328d49d641ab Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 19:19:22 +0100 Subject: [PATCH 162/283] Create a seed user for the develoment environment --- db/seeds.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/db/seeds.rb b/db/seeds.rb index 42c175e..9590f3a 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -67,4 +67,11 @@ ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new }) 'red'.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) } -Group.roots.each(&:colorize_children) \ No newline at end of file +Group.roots.each(&:colorize_children) + +User.create!( + email: 'development@example.com', + confirmed_at: Time.zone.now, + password: 'supersecretpassword', + password_confirmation: 'supersecretpassword', +) \ No newline at end of file From 24c39f331ae5d1346583b35eece943ead0392bc5 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 19:24:59 +0100 Subject: [PATCH 163/283] Define a simple wedding model --- app/models/wedding.rb | 18 ++++++++++++++++++ db/migrate/20241130182228_create_weddings.rb | 10 ++++++++++ db/schema.rb | 12 +++++++++--- db/seeds.rb | 4 ++++ spec/factories/weddings.rb | 5 +++++ spec/models/wedding_spec.rb | 5 +++++ 6 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 app/models/wedding.rb create mode 100644 db/migrate/20241130182228_create_weddings.rb create mode 100644 spec/factories/weddings.rb create mode 100644 spec/models/wedding_spec.rb diff --git a/app/models/wedding.rb b/app/models/wedding.rb new file mode 100644 index 0000000..32c5578 --- /dev/null +++ b/app/models/wedding.rb @@ -0,0 +1,18 @@ +# == Schema Information +# +# Table name: weddings +# +# id :uuid not null, primary key +# date :date not null +# slug :string not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_weddings_on_slug (slug) UNIQUE +# +class Wedding < ApplicationRecord + validates :date, presence: true + validates :slug, presence: true, uniqueness: true +end diff --git a/db/migrate/20241130182228_create_weddings.rb b/db/migrate/20241130182228_create_weddings.rb new file mode 100644 index 0000000..c8cf1fd --- /dev/null +++ b/db/migrate/20241130182228_create_weddings.rb @@ -0,0 +1,10 @@ +class CreateWeddings < ActiveRecord::Migration[8.0] + def change + create_table :weddings, id: :uuid do |t| + t.string :slug, null: false, index: { unique: true } + t.date :date, null: false + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 6e9d747..41896ca 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2024_11_30_095753) do +ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -208,6 +206,14 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_095753) do t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true end + create_table "weddings", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.string "slug", null: false + t.date "date", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["slug"], name: "index_weddings_on_slug", unique: true + end + add_foreign_key "groups", "groups", column: "parent_id" add_foreign_key "guests", "groups" add_foreign_key "seats", "guests" diff --git a/db/seeds.rb b/db/seeds.rb index 42c175e..e7e414d 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -7,6 +7,10 @@ Expense.delete_all Guest.delete_all Group.delete_all +Wedding.delete_all + +Wedding.create!(date: 1.year.from_now) + Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed') Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed') Expense.create!(name: 'Catering', amount: 200, pricing_type: 'per_person') diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb new file mode 100644 index 0000000..5528d3b --- /dev/null +++ b/spec/factories/weddings.rb @@ -0,0 +1,5 @@ +FactoryBot.define do + factory :wedding do + date { 1.year.from_now } + end +end diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb new file mode 100644 index 0000000..8725ba8 --- /dev/null +++ b/spec/models/wedding_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Wedding, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 9e222f59bed52a33794a8a30482242fc57cb1aa1 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 18:31:48 +0000 Subject: [PATCH 164/283] Add copyright notice --- app/models/wedding.rb | 2 ++ db/migrate/20241130182228_create_weddings.rb | 2 ++ db/schema.rb | 2 ++ spec/factories/weddings.rb | 2 ++ spec/models/wedding_spec.rb | 2 ++ 5 files changed, 10 insertions(+) diff --git a/app/models/wedding.rb b/app/models/wedding.rb index 32c5578..fa6c6e4 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # == Schema Information # # Table name: weddings diff --git a/db/migrate/20241130182228_create_weddings.rb b/db/migrate/20241130182228_create_weddings.rb index c8cf1fd..2151f72 100644 --- a/db/migrate/20241130182228_create_weddings.rb +++ b/db/migrate/20241130182228_create_weddings.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class CreateWeddings < ActiveRecord::Migration[8.0] def change create_table :weddings, id: :uuid do |t| diff --git a/db/schema.rb b/db/schema.rb index 41896ca..436f67b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index 5528d3b..fe8e605 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + FactoryBot.define do factory :wedding do date { 1.year.from_now } diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index 8725ba8..702769f 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'rails_helper' RSpec.describe Wedding, type: :model do From cf6ca5aa17fb6daecb7cfc434fb9debaba816f94 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 19:19:22 +0100 Subject: [PATCH 165/283] Create a seed user for the develoment environment --- db/seeds.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/db/seeds.rb b/db/seeds.rb index e7e414d..d1dafe3 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -71,4 +71,11 @@ ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new }) 'red'.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) } -Group.roots.each(&:colorize_children) \ No newline at end of file +Group.roots.each(&:colorize_children) + +User.create!( + email: 'development@example.com', + confirmed_at: Time.zone.now, + password: 'supersecretpassword', + password_confirmation: 'supersecretpassword', +) \ No newline at end of file From 988e158d99b330de28f76f8046ce5be4e6d897a9 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 19:57:08 +0100 Subject: [PATCH 166/283] Install acts_as_tenant gem and update documentation --- Gemfile | 1 + Gemfile.lock | 3 +++ config/routes.rb | 32 +++++++++++++---------- db/seeds.rb | 2 +- spec/requests/expenses_spec.rb | 7 +++-- spec/requests/groups_spec.rb | 3 ++- spec/requests/guests_spec.rb | 8 ++++-- spec/requests/schemas.rb | 8 ++++++ spec/requests/users/confirmations_spec.rb | 3 ++- spec/requests/users/registrations_spec.rb | 5 ++-- spec/requests/users/sessions_spec.rb | 7 ++--- 11 files changed, 53 insertions(+), 26 deletions(-) diff --git a/Gemfile b/Gemfile index cc2ec6e..ead69aa 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,7 @@ gem 'jsonapi-rails' gem 'rack-cors' gem 'react-rails' gem 'rubytree' +gem 'acts_as_tenant' group :development, :test do gem 'annotaterb' diff --git a/Gemfile.lock b/Gemfile.lock index bfe49bd..7e795fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -72,6 +72,8 @@ GEM securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) + acts_as_tenant (1.0.1) + rails (>= 6.0) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) annotaterb (4.13.0) @@ -387,6 +389,7 @@ PLATFORMS x86_64-linux DEPENDENCIES + acts_as_tenant annotaterb bootsnap chroma diff --git a/config/routes.rb b/config/routes.rb index 35fd068..b407e01 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,26 +2,30 @@ Rails.application.routes.draw do mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? - devise_for :users, skip: [:registration, :session, :confirmation] - devise_scope :user do - post 'users', to: 'users/registrations#create' + scope ":slug", constraints: {slug: /[a-z]+/} do + devise_for :users, skip: [:registration, :session, :confirmation] + devise_scope :user do + post 'users', to: 'users/registrations#create' - post '/users/sign_in', to: 'users/sessions#create' - delete '/users/sign_out', to: 'users/sessions#destroy' + post '/users/sign_in', to: 'users/sessions#create' + delete '/users/sign_out', to: 'users/sessions#destroy' - get '/users/confirmation', to: 'users/confirmations#show', as: :confirmation + get '/users/confirmation', to: 'users/confirmations#show', as: :confirmation + end + + resources :groups, only: :index + resources :guests, only: %i[index create update destroy] do + post :bulk_update, on: :collection + end + resources :expenses, only: %i[index update] do + get :summary, on: :collection + end + resources :tables_arrangements, only: %i[index show] end + mount Rswag::Ui::Engine => '/api-docs' mount Rswag::Api::Engine => '/api-docs' - resources :groups, only: :index - resources :guests, only: %i[index create update destroy] do - post :bulk_update, on: :collection - end - resources :expenses, only: %i[index update] do - get :summary, on: :collection - end - resources :tables_arrangements, only: %i[index show] get 'up' => 'rails/health#show', as: :rails_health_check diff --git a/db/seeds.rb b/db/seeds.rb index d1dafe3..8b1f91a 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -9,7 +9,7 @@ Group.delete_all Wedding.delete_all -Wedding.create!(date: 1.year.from_now) +Wedding.create!(slug: :default, date: 1.year.from_now) Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed') Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed') diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index 5e99097..74cf861 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -3,10 +3,12 @@ require 'swagger_helper' RSpec.describe 'expenses', type: :request do - path '/expenses' do + path '/{slug}/expenses' do get('list expenses') do tags 'Expenses' produces 'application/json' + parameter Swagger::Schema::SLUG + response(200, 'successful') do schema type: :array, items: { @@ -26,12 +28,13 @@ RSpec.describe 'expenses', type: :request do end end - path '/expenses/{id}' do + path '/{slug}/expenses/{id}' do patch('update expense') do tags 'Expenses' consumes 'application/json' produces 'application/json' + parameter Swagger::Schema::SLUG parameter name: 'id', in: :path, type: :string, format: :uuid, description: 'id' parameter name: :body, in: :body, schema: { type: :object, diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index fd014b5..6d5f057 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -3,10 +3,11 @@ require 'swagger_helper' RSpec.describe 'groups', type: :request do - path '/groups' do + path '/{slug}/groups' do get('list groups') do tags 'Groups' produces 'application/json' + parameter Swagger::Schema::SLUG response(200, 'successful') do schema type: :array, items: { diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index b73fbcb..9b542fd 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -3,10 +3,11 @@ require 'swagger_helper' RSpec.describe 'guests', type: :request do - path '/guests' do + path '/{slug}/guests' do get('list guests') do tags 'Guests' produces 'application/json' + parameter Swagger::Schema::SLUG response(200, 'successful') do schema type: :array, items: { @@ -33,6 +34,7 @@ RSpec.describe 'guests', type: :request do tags 'Guests' consumes 'application/json' produces 'application/json' + parameter Swagger::Schema::SLUG parameter name: :body, in: :body, schema: { type: :object, required: %i[guest], @@ -55,11 +57,12 @@ RSpec.describe 'guests', type: :request do end end - path '/guests/{id}' do + path '/{slug}/guests/{id}' do patch('update guest') do tags 'Guests' consumes 'application/json' produces 'application/json' + parameter Swagger::Schema::SLUG parameter name: 'id', in: :path, type: :string, format: :uuid parameter name: :body, in: :body, schema: { type: :object, @@ -85,6 +88,7 @@ RSpec.describe 'guests', type: :request do delete('delete guest') do tags 'Guests' produces 'application/json' + parameter Swagger::Schema::SLUG parameter name: 'id', in: :path, type: :string, format: :uuid response_empty_200 diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index 7a49ca0..ce35ad7 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -9,5 +9,13 @@ module Swagger updated_at: SwaggerResponseHelper::TIMESTAMP } + + SLUG = { + name: 'slug', + in: :path, + type: :string, + example: :default, + description: 'Wedding slug' + } end end \ No newline at end of file diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb index e99794e..12bdfbc 100644 --- a/spec/requests/users/confirmations_spec.rb +++ b/spec/requests/users/confirmations_spec.rb @@ -4,11 +4,12 @@ require 'swagger_helper' RSpec.describe 'users/confirmations', type: :request do - path '/users/confirmation' do + path '/{slug}/users/confirmation' do get('confirm user email') do tags 'Users' produces 'application/json' + parameter Swagger::Schema::SLUG parameter name: :confirmation_token, in: :query, type: :string, required: true response(200, 'confirmed') do diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index f92222c..aa7562f 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -4,12 +4,13 @@ require 'swagger_helper' RSpec.describe 'users/registrations', type: :request do - path '/users' do + path '/{slug}/users' do post('create registration') do tags 'Users Registrations' consumes 'application/json' produces 'application/json' - + + parameter Swagger::Schema::SLUG parameter name: :body, in: :body, schema: { type: :object, required: [:user], diff --git a/spec/requests/users/sessions_spec.rb b/spec/requests/users/sessions_spec.rb index ff7c8a3..a803965 100644 --- a/spec/requests/users/sessions_spec.rb +++ b/spec/requests/users/sessions_spec.rb @@ -4,13 +4,14 @@ require 'swagger_helper' RSpec.describe 'users/sessions', type: :request do - path '/users/sign_in' do + path '/{slug}/users/sign_in' do post('create session') do tags 'Users Sessions' consumes 'application/json' produces 'application/json' + parameter Swagger::Schema::SLUG parameter name: :body, in: :body, schema: { type: :object, required: %i[user], @@ -35,8 +36,8 @@ RSpec.describe 'users/sessions', type: :request do end end - path '/users/sign_out' do - + path '/{slug}/users/sign_out' do + parameter Swagger::Schema::SLUG delete('delete session') do tags 'Users Sessions' consumes 'application/json' From 8bff98b165294e6003ad4ff2e93e81242e4a73c2 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 20:04:17 +0100 Subject: [PATCH 167/283] Create DB associations --- app/models/expense.rb | 10 ++++++++++ app/models/group.rb | 9 +++++++-- app/models/guest.rb | 6 +++++- app/models/seat.rb | 4 ++++ app/models/tables_arrangement.rb | 10 ++++++++++ .../20241130185731_add_wedding_id_to_models.rb | 7 +++++++ db/schema.rb | 17 ++++++++++++++++- 7 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20241130185731_add_wedding_id_to_models.rb diff --git a/app/models/expense.rb b/app/models/expense.rb index 6da98af..5601c30 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -10,8 +10,18 @@ # pricing_type :enum default("fixed"), not null # created_at :datetime not null # updated_at :datetime not null +# wedding_id :uuid not null +# +# Indexes +# +# index_expenses_on_wedding_id (wedding_id) +# +# Foreign Keys +# +# fk_rails_... (wedding_id => weddings.id) # class Expense < ApplicationRecord + acts_as_tenant :wedding enum :pricing_type, fixed: 'fixed', per_person: 'per_person' diff --git a/app/models/group.rb b/app/models/group.rb index fe11e0b..5056b28 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -12,17 +12,22 @@ # created_at :datetime not null # updated_at :datetime not null # parent_id :uuid +# wedding_id :uuid not null # # Indexes # -# index_groups_on_name (name) UNIQUE -# index_groups_on_parent_id (parent_id) +# index_groups_on_name (name) UNIQUE +# index_groups_on_parent_id (parent_id) +# index_groups_on_wedding_id (wedding_id) # # Foreign Keys # # fk_rails_... (parent_id => groups.id) +# fk_rails_... (wedding_id => weddings.id) # class Group < ApplicationRecord + acts_as_tenant :wedding + validates :name, uniqueness: true validates :name, :order, presence: true diff --git a/app/models/guest.rb b/app/models/guest.rb index 40c41be..8983c66 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -11,16 +11,20 @@ # created_at :datetime not null # updated_at :datetime not null # group_id :uuid not null +# wedding_id :uuid not null # # Indexes # -# index_guests_on_group_id (group_id) +# index_guests_on_group_id (group_id) +# index_guests_on_wedding_id (wedding_id) # # Foreign Keys # # fk_rails_... (group_id => groups.id) +# fk_rails_... (wedding_id => weddings.id) # class Guest < ApplicationRecord + acts_as_tenant :wedding belongs_to :group enum :status, { diff --git a/app/models/seat.rb b/app/models/seat.rb index 1f3769c..3f13629 100644 --- a/app/models/seat.rb +++ b/app/models/seat.rb @@ -10,18 +10,22 @@ # updated_at :datetime not null # guest_id :uuid not null # tables_arrangement_id :uuid not null +# wedding_id :uuid not null # # Indexes # # index_seats_on_guest_id (guest_id) # index_seats_on_tables_arrangement_id (tables_arrangement_id) +# index_seats_on_wedding_id (wedding_id) # # Foreign Keys # # fk_rails_... (guest_id => guests.id) # fk_rails_... (tables_arrangement_id => tables_arrangements.id) ON DELETE => cascade +# fk_rails_... (wedding_id => weddings.id) # class Seat < ApplicationRecord + acts_as_tenant :wedding belongs_to :guest belongs_to :table_arrangement end diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index 6e2f621..3080e49 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -9,8 +9,18 @@ # name :string not null # created_at :datetime not null # updated_at :datetime not null +# wedding_id :uuid not null +# +# Indexes +# +# index_tables_arrangements_on_wedding_id (wedding_id) +# +# Foreign Keys +# +# fk_rails_... (wedding_id => weddings.id) # class TablesArrangement < ApplicationRecord + acts_as_tenant :wedding has_many :seats has_many :guests, through: :seats diff --git a/db/migrate/20241130185731_add_wedding_id_to_models.rb b/db/migrate/20241130185731_add_wedding_id_to_models.rb new file mode 100644 index 0000000..bf505b5 --- /dev/null +++ b/db/migrate/20241130185731_add_wedding_id_to_models.rb @@ -0,0 +1,7 @@ +class AddWeddingIdToModels < ActiveRecord::Migration[8.0] + def change + [:expenses, :guests, :seats, :tables_arrangements, :groups].each do |table| + add_reference table, :wedding, type: :uuid, null: false, foreign_key: true + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 436f67b..fd07a1b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do +ActiveRecord::Schema[8.0].define(version: 2024_11_30_185731) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -26,6 +26,8 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do t.enum "pricing_type", default: "fixed", null: false, enum_type: "pricing_types" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.uuid "wedding_id", null: false + t.index ["wedding_id"], name: "index_expenses_on_wedding_id" end create_table "groups", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -36,8 +38,10 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do t.datetime "updated_at", null: false t.uuid "parent_id" t.string "color" + t.uuid "wedding_id", null: false t.index ["name"], name: "index_groups_on_name", unique: true t.index ["parent_id"], name: "index_groups_on_parent_id" + t.index ["wedding_id"], name: "index_groups_on_wedding_id" end create_table "guests", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -47,7 +51,9 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do t.uuid "group_id", null: false t.integer "status", default: 0 t.string "name" + t.uuid "wedding_id", null: false t.index ["group_id"], name: "index_guests_on_group_id" + t.index ["wedding_id"], name: "index_guests_on_wedding_id" end create_table "seats", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -56,8 +62,10 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do t.integer "table_number" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.uuid "wedding_id", null: false t.index ["guest_id"], name: "index_seats_on_guest_id" t.index ["tables_arrangement_id"], name: "index_seats_on_tables_arrangement_id" + t.index ["wedding_id"], name: "index_seats_on_wedding_id" end create_table "solid_queue_blocked_executions", force: :cascade do |t| @@ -186,6 +194,8 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "name", null: false + t.uuid "wedding_id", null: false + t.index ["wedding_id"], name: "index_tables_arrangements_on_wedding_id" end create_table "users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -216,14 +226,19 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_182228) do t.index ["slug"], name: "index_weddings_on_slug", unique: true end + add_foreign_key "expenses", "weddings" add_foreign_key "groups", "groups", column: "parent_id" + add_foreign_key "groups", "weddings" add_foreign_key "guests", "groups" + add_foreign_key "guests", "weddings" add_foreign_key "seats", "guests" add_foreign_key "seats", "tables_arrangements", on_delete: :cascade + add_foreign_key "seats", "weddings" add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "tables_arrangements", "weddings" end From 5b3c1fdfac6efce10e5ecebfbb516bac8d372d1a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 20:06:36 +0100 Subject: [PATCH 168/283] Adapt seeds file to use ActsAsTenant --- db/seeds.rb | 113 ++++++++++++++++++++++++++-------------------------- 1 file changed, 56 insertions(+), 57 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 8b1f91a..5e9886a 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -9,70 +9,69 @@ Group.delete_all Wedding.delete_all -Wedding.create!(slug: :default, date: 1.year.from_now) +ActsAsTenant.with_tenant(Wedding.create!(slug: :default, date: 1.year.from_now)) do + Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed') + Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed') + Expense.create!(name: 'Catering', amount: 200, pricing_type: 'per_person') + Expense.create!(name: 'Flowers', amount: 500, pricing_type: 'fixed') + Expense.create!(name: 'Band', amount: 1000, pricing_type: 'fixed') + Expense.create!(name: 'Wedding planner', amount: 2000, pricing_type: 'fixed') + Expense.create!(name: 'Dress', amount: 1000, pricing_type: 'fixed') + Expense.create!(name: 'Suit', amount: 500, pricing_type: 'fixed') + Expense.create!(name: 'Rings', amount: 1000, pricing_type: 'fixed') + Expense.create!(name: 'Makeup', amount: 200, pricing_type: 'fixed') + Expense.create!(name: 'Hair', amount: 200, pricing_type: 'fixed') + Expense.create!(name: 'Transportation', amount: 3000, pricing_type: 'fixed') + Expense.create!(name: 'Invitations', amount: 200, pricing_type: 'fixed') + Expense.create!(name: 'Cake', amount: 500, pricing_type: 'fixed') -Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed') -Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed') -Expense.create!(name: 'Catering', amount: 200, pricing_type: 'per_person') -Expense.create!(name: 'Flowers', amount: 500, pricing_type: 'fixed') -Expense.create!(name: 'Band', amount: 1000, pricing_type: 'fixed') -Expense.create!(name: 'Wedding planner', amount: 2000, pricing_type: 'fixed') -Expense.create!(name: 'Dress', amount: 1000, pricing_type: 'fixed') -Expense.create!(name: 'Suit', amount: 500, pricing_type: 'fixed') -Expense.create!(name: 'Rings', amount: 1000, pricing_type: 'fixed') -Expense.create!(name: 'Makeup', amount: 200, pricing_type: 'fixed') -Expense.create!(name: 'Hair', amount: 200, pricing_type: 'fixed') -Expense.create!(name: 'Transportation', amount: 3000, pricing_type: 'fixed') -Expense.create!(name: 'Invitations', amount: 200, pricing_type: 'fixed') -Expense.create!(name: 'Cake', amount: 500, pricing_type: 'fixed') - -Group.create!(name: "Jim's guests", icon: 'pi pi-heart').tap do |parent| - parent.children.create!(name: "Jim's family", icon: 'pi pi-users').tap do |family| - family.children.create!(name: "Jim's close family", icon: 'pi pi-home') - family.children.create!(name: "Jim's cousins", icon: 'pi pi-home') - family.children.create!(name: "Jim's relatives", icon: 'pi pi-home') + Group.create!(name: "Jim's guests", icon: 'pi pi-heart').tap do |parent| + parent.children.create!(name: "Jim's family", icon: 'pi pi-users').tap do |family| + family.children.create!(name: "Jim's close family", icon: 'pi pi-home') + family.children.create!(name: "Jim's cousins", icon: 'pi pi-home') + family.children.create!(name: "Jim's relatives", icon: 'pi pi-home') + end + parent.children.create!(name: "Jim's friends", icon: 'pi pi-bullseye') + parent.children.create!(name: "Jim's work", icon: 'pi pi-desktop').tap do |work| + work.children.create!(name: "Jim's besties at work", icon: 'pi pi-briefcase') + end end - parent.children.create!(name: "Jim's friends", icon: 'pi pi-bullseye') - parent.children.create!(name: "Jim's work", icon: 'pi pi-desktop').tap do |work| - work.children.create!(name: "Jim's besties at work", icon: 'pi pi-briefcase') + + Group.create!(name: "Pam's guests", icon: 'pi pi-heart-fill').tap do |parent| + parent.children.create!(name: "Pam's family", icon: 'pi pi-users').tap do |family| + family.children.create!(name: "Pam's close family", icon: 'pi pi-home') + family.children.create!(name: "Pam's cousins", icon: 'pi pi-home') + family.children.create!(name: "Pam's relatives", icon: 'pi pi-home') + end + parent.children.create!(name: "Pam's friends", icon: 'pi pi-bullseye') + parent.children.create!(name: "Pam's work", icon: 'pi pi-desktop').tap do |work| + work.children.create!(name: "Pam's besties at work", icon: 'pi pi-briefcase') + end end -end -Group.create!(name: "Pam's guests", icon: 'pi pi-heart-fill').tap do |parent| - parent.children.create!(name: "Pam's family", icon: 'pi pi-users').tap do |family| - family.children.create!(name: "Pam's close family", icon: 'pi pi-home') - family.children.create!(name: "Pam's cousins", icon: 'pi pi-home') - family.children.create!(name: "Pam's relatives", icon: 'pi pi-home') + Group.create!(name: 'Common guests', icon: 'pi pi-users').tap do |parent| + parent.children.create!(name: 'College friends', icon: 'pi pi-calculator') + parent.children.create!(name: 'High school friends', icon: 'pi pi-crown') + parent.children.create!(name: 'Childhood friends', icon: 'pi pi-envelope') end - parent.children.create!(name: "Pam's friends", icon: 'pi pi-bullseye') - parent.children.create!(name: "Pam's work", icon: 'pi pi-desktop').tap do |work| - work.children.create!(name: "Pam's besties at work", icon: 'pi pi-briefcase') + + groups = Group.all + + NUMBER_OF_GUESTS.times do + Guest.create!( + name: Faker::Name.name, + phone: Faker::PhoneNumber.cell_phone, + group: groups.sample, + status: Guest.statuses.keys.sample + ) end + + ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new }) + + 'red'.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) } + + Group.roots.each(&:colorize_children) end - -Group.create!(name: 'Common guests', icon: 'pi pi-users').tap do |parent| - parent.children.create!(name: 'College friends', icon: 'pi pi-calculator') - parent.children.create!(name: 'High school friends', icon: 'pi pi-crown') - parent.children.create!(name: 'Childhood friends', icon: 'pi pi-envelope') -end - -groups = Group.all - -NUMBER_OF_GUESTS.times do - Guest.create!( - name: Faker::Name.name, - phone: Faker::PhoneNumber.cell_phone, - group: groups.sample, - status: Guest.statuses.keys.sample - ) -end - -ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new }) - -'red'.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) } - -Group.roots.each(&:colorize_children) - User.create!( email: 'development@example.com', confirmed_at: Time.zone.now, From cb90a93ef343ac11faf3e60472e89e20ce93b72a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 19:07:36 +0000 Subject: [PATCH 169/283] Add copyright notice --- db/migrate/20241130185731_add_wedding_id_to_models.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/migrate/20241130185731_add_wedding_id_to_models.rb b/db/migrate/20241130185731_add_wedding_id_to_models.rb index bf505b5..c57fff4 100644 --- a/db/migrate/20241130185731_add_wedding_id_to_models.rb +++ b/db/migrate/20241130185731_add_wedding_id_to_models.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class AddWeddingIdToModels < ActiveRecord::Migration[8.0] def change [:expenses, :guests, :seats, :tables_arrangements, :groups].each do |table| From 63bb32f2a7abbbc98d0a42a2365460f1a93ab3f0 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 21:06:21 +0100 Subject: [PATCH 170/283] Include users in the list of models affected by tenant --- app/models/user.rb | 8 ++++++++ .../20241130185731_add_wedding_id_to_models.rb | 2 +- db/schema.rb | 5 +++-- db/seeds.rb | 13 +++++++------ 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index d338416..43c3a9e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -18,6 +18,7 @@ # unlock_token :string # created_at :datetime not null # updated_at :datetime not null +# wedding_id :uuid not null # # Indexes # @@ -25,8 +26,15 @@ # index_users_on_email (email) UNIQUE # index_users_on_reset_password_token (reset_password_token) UNIQUE # index_users_on_unlock_token (unlock_token) UNIQUE +# index_users_on_wedding_id (wedding_id) +# +# Foreign Keys +# +# fk_rails_... (wedding_id => weddings.id) # class User < ApplicationRecord + acts_as_tenant :wedding + devise :database_authenticatable, :registerable, :recoverable, :validatable, :confirmable, :lockable end diff --git a/db/migrate/20241130185731_add_wedding_id_to_models.rb b/db/migrate/20241130185731_add_wedding_id_to_models.rb index c57fff4..63e5c32 100644 --- a/db/migrate/20241130185731_add_wedding_id_to_models.rb +++ b/db/migrate/20241130185731_add_wedding_id_to_models.rb @@ -2,7 +2,7 @@ class AddWeddingIdToModels < ActiveRecord::Migration[8.0] def change - [:expenses, :guests, :seats, :tables_arrangements, :groups].each do |table| + [:expenses, :guests, :seats, :tables_arrangements, :groups, :users].each do |table| add_reference table, :wedding, type: :uuid, null: false, foreign_key: true end end diff --git a/db/schema.rb b/db/schema.rb index fd07a1b..d70dbfa 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -212,10 +210,12 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_185731) do t.datetime "locked_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.uuid "wedding_id", null: false t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["email"], name: "index_users_on_email", unique: true t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true + t.index ["wedding_id"], name: "index_users_on_wedding_id" end create_table "weddings", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -241,4 +241,5 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_185731) do add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade add_foreign_key "tables_arrangements", "weddings" + add_foreign_key "users", "weddings" end diff --git a/db/seeds.rb b/db/seeds.rb index 5e9886a..206f7da 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -71,10 +71,11 @@ ActsAsTenant.with_tenant(Wedding.create!(slug: :default, date: 1.year.from_now)) 'red'.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) } Group.roots.each(&:colorize_children) + + User.create!( + email: 'development@example.com', + confirmed_at: Time.zone.now, + password: 'supersecretpassword', + password_confirmation: 'supersecretpassword', + ) end -User.create!( - email: 'development@example.com', - confirmed_at: Time.zone.now, - password: 'supersecretpassword', - password_confirmation: 'supersecretpassword', -) \ No newline at end of file From 6d61e8452a3087555bf2844debf7c9a0f333d0bc Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 20:07:45 +0000 Subject: [PATCH 171/283] Add copyright notice --- db/schema.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/schema.rb b/db/schema.rb index d70dbfa..7ff33f3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From be3497ad646ac9a86ff37d71b6e69b27a884369e Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 21:11:25 +0100 Subject: [PATCH 172/283] Configure current tenant in a before_action of the ApplicationController --- app/controllers/application_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0d2a0c7..13400e3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,7 @@ # Copyright (C) 2024 Manuel Bustillo class ApplicationController < ActionController::Base + before_action :set_tenant before_action :authenticate_user! after_action :set_csrf_cookie @@ -29,6 +30,10 @@ class ApplicationController < ActionController::Base private + def set_tenant + ActsAsTenant.current_tenant = Wedding.find_by(slug: params[:slug]) + end + def development_swagger? Rails.env.test? || Rails.env.development? && request.headers['referer']&.include?('/api-docs/index.html') From 8429b3952be8c78331cce99ca3b5cf163892adf6 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 1 Dec 2024 09:58:39 +0100 Subject: [PATCH 173/283] Adapt factories to use a wedding object --- spec/factories/expense.rb | 1 + spec/factories/groups.rb | 1 + spec/factories/guest.rb | 3 ++- spec/factories/table_arrangement.rb | 6 ++++++ spec/factories/users.rb | 2 +- spec/factories/weddings.rb | 1 + spec/models/tables_arrangement_spec.rb | 2 +- 7 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 spec/factories/table_arrangement.rb diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index 9670768..726d94d 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -2,6 +2,7 @@ FactoryBot.define do factory :expense do + wedding sequence(:name) { |i| "Expense #{i}" } pricing_type { "fixed" } amount { 100 } diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 4ebce4e..ccd1156 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -2,6 +2,7 @@ FactoryBot.define do factory :group do + wedding sequence(:name) { |i| "Group #{i}" } order { 1 } end diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index 4c9b58a..28f3b80 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -2,7 +2,8 @@ FactoryBot.define do factory :guest do - association :group + group + wedding name { Faker::Name.name } phone { Faker::PhoneNumber.cell_phone } diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb new file mode 100644 index 0000000..5e914ce --- /dev/null +++ b/spec/factories/table_arrangement.rb @@ -0,0 +1,6 @@ +FactoryBot.define do + factory :tables_arrangement do + wedding + end +end + \ No newline at end of file diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 7839fbe..2aa8a37 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -2,6 +2,6 @@ FactoryBot.define do factory :user do - + wedding end end diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index fe8e605..3680045 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -2,6 +2,7 @@ FactoryBot.define do factory :wedding do + sequence(:slug) { |i| "wedding-#{i}" } date { 1.year.from_now } end end diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index c15971a..4db0859 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' RSpec.describe TablesArrangement, type: :model do describe 'callbacks' do it 'assigns a name before creation' do - expect(described_class.create!.name).to be_present + expect(create(:tables_arrangement).name).to be_present end end end From 70b44e1b96ed49f2e4944a73c60c2ee02073a938 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 1 Dec 2024 09:00:01 +0000 Subject: [PATCH 174/283] Add copyright notice --- spec/factories/table_arrangement.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb index 5e914ce..693e68a 100644 --- a/spec/factories/table_arrangement.rb +++ b/spec/factories/table_arrangement.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + FactoryBot.define do factory :tables_arrangement do wedding From 4d9563cab735154a2fbc417666959e9efd4a974a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 1 Dec 2024 10:41:05 +0100 Subject: [PATCH 175/283] Adapt background job to use acts as tenant --- app/jobs/table_simulator_job.rb | 22 ++++++++++++---------- app/models/guest.rb | 2 +- db/seeds.rb | 5 +++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index ef91719..ced9b2d 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -3,21 +3,23 @@ class TableSimulatorJob < ApplicationJob queue_as :default - def perform(*_args) - engine = VNS::Engine.new + def perform(wedding_id) + ActsAsTenant.with_tenant(Wedding.find(wedding_id)) do + engine = VNS::Engine.new - engine.add_perturbation(Tables::Swap) - engine.add_perturbation(Tables::Shift) + engine.add_perturbation(Tables::Swap) + engine.add_perturbation(Tables::Shift) - initial_solution = Tables::Distribution.new(min_per_table: 8, max_per_table: 10) - initial_solution.random_distribution(Guest.potential.shuffle) + initial_solution = Tables::Distribution.new(min_per_table: 8, max_per_table: 10) + initial_solution.random_distribution(Guest.potential.shuffle) - engine.initial_solution = initial_solution + engine.initial_solution = initial_solution - engine.target_function(&:discomfort) + engine.target_function(&:discomfort) - best_solution = engine.run + best_solution = engine.run - best_solution.save! + best_solution.save! + end end end diff --git a/app/models/guest.rb b/app/models/guest.rb index 8983c66..929cc6e 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -49,6 +49,6 @@ class Guest < ApplicationRecord def recalculate_simulations TablesArrangement.delete_all - ActiveJob.perform_all_later(50.times.map { TableSimulatorJob.new }) + ActiveJob.perform_all_later(50.times.map { TableSimulatorJob.new(wedding_id) }) end end diff --git a/db/seeds.rb b/db/seeds.rb index 206f7da..e493f6b 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,8 +8,9 @@ Guest.delete_all Group.delete_all Wedding.delete_all +wedding = Wedding.create!(slug: :default, date: 1.year.from_now) -ActsAsTenant.with_tenant(Wedding.create!(slug: :default, date: 1.year.from_now)) do +ActsAsTenant.with_tenant(wedding) do Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed') Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed') Expense.create!(name: 'Catering', amount: 200, pricing_type: 'per_person') @@ -66,7 +67,7 @@ ActsAsTenant.with_tenant(Wedding.create!(slug: :default, date: 1.year.from_now)) ) end - ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new }) + ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new(wedding.id) }) 'red'.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) } From 279093ad98d96106c60de9bfea3192c9088f0aec Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 1 Dec 2024 14:03:06 +0100 Subject: [PATCH 176/283] Configure registration endpoint to create a wedding as well --- app/controllers/application_controller.rb | 4 ++++ .../users/registrations_controller.rb | 20 +++++++++++++++++++ app/models/wedding.rb | 2 +- .../mailer/confirmation_instructions.html.erb | 5 +++++ app/views/users/mailer/email_changed.html.erb | 7 +++++++ .../users/mailer/password_change.html.erb | 3 +++ .../reset_password_instructions.html.erb | 8 ++++++++ .../users/mailer/unlock_instructions.html.erb | 7 +++++++ config/initializers/devise.rb | 2 +- config/routes.rb | 2 +- spec/requests/users/registrations_spec.rb | 7 +++++++ 11 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 app/views/users/mailer/confirmation_instructions.html.erb create mode 100644 app/views/users/mailer/email_changed.html.erb create mode 100644 app/views/users/mailer/password_change.html.erb create mode 100644 app/views/users/mailer/reset_password_instructions.html.erb create mode 100644 app/views/users/mailer/unlock_instructions.html.erb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 13400e3..f163c3e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -30,6 +30,10 @@ class ApplicationController < ActionController::Base private + def default_url_options(options = {}) + options.merge(path_params: { slug: ActsAsTenant.current_tenant&.slug }) + end + def set_tenant ActsAsTenant.current_tenant = Wedding.find_by(slug: params[:slug]) end diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 09ffe33..24d8eca 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -3,4 +3,24 @@ class Users::RegistrationsController < Devise::RegistrationsController clear_respond_to respond_to :json + + def create + wedding = Wedding.create(wedding_params) + unless wedding.persisted? + render json: { errors: wedding.errors.full_messages }, status: :unprocessable_entity + return + end + + ActsAsTenant.with_tenant(wedding) do + super do |user| + wedding.destroy unless user.persisted? + end + end + end + + private + + def wedding_params + { slug: params[:slug], **params.expect(wedding: :date) } + end end \ No newline at end of file diff --git a/app/models/wedding.rb b/app/models/wedding.rb index fa6c6e4..abc0999 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -16,5 +16,5 @@ # class Wedding < ApplicationRecord validates :date, presence: true - validates :slug, presence: true, uniqueness: true + validates :slug, presence: true, uniqueness: true, format: { with: /\A[a-z]+\z/ } end diff --git a/app/views/users/mailer/confirmation_instructions.html.erb b/app/views/users/mailer/confirmation_instructions.html.erb new file mode 100644 index 0000000..7b71e44 --- /dev/null +++ b/app/views/users/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

    Welcome <%= @email %>!

    + +

    You can confirm your account email through the link below:

    + +

    <%= link_to 'Confirm my account', confirmation_url(slug: ActsAsTenant.current_tenant&.slug, confirmation_token: @token) %>

    diff --git a/app/views/users/mailer/email_changed.html.erb b/app/views/users/mailer/email_changed.html.erb new file mode 100644 index 0000000..32f4ba8 --- /dev/null +++ b/app/views/users/mailer/email_changed.html.erb @@ -0,0 +1,7 @@ +

    Hello <%= @email %>!

    + +<% if @resource.try(:unconfirmed_email?) %> +

    We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.

    +<% else %> +

    We're contacting you to notify you that your email has been changed to <%= @resource.email %>.

    +<% end %> diff --git a/app/views/users/mailer/password_change.html.erb b/app/views/users/mailer/password_change.html.erb new file mode 100644 index 0000000..b41daf4 --- /dev/null +++ b/app/views/users/mailer/password_change.html.erb @@ -0,0 +1,3 @@ +

    Hello <%= @resource.email %>!

    + +

    We're contacting you to notify you that your password has been changed.

    diff --git a/app/views/users/mailer/reset_password_instructions.html.erb b/app/views/users/mailer/reset_password_instructions.html.erb new file mode 100644 index 0000000..010a079 --- /dev/null +++ b/app/views/users/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

    Hello <%= @resource.email %>!

    + +

    Someone has requested a link to change your password. You can do this through the link below.

    + +

    <%= link_to 'Change my password', edit_password_url(slug: ActsAsTenant.current_tenant&.slug, reset_password_token: @token) %>

    + +

    If you didn't request this, please ignore this email.

    +

    Your password won't change until you access the link above and create a new one.

    diff --git a/app/views/users/mailer/unlock_instructions.html.erb b/app/views/users/mailer/unlock_instructions.html.erb new file mode 100644 index 0000000..313fe8e --- /dev/null +++ b/app/views/users/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

    Hello <%= @resource.email %>!

    + +

    Your account has been locked due to an excessive number of unsuccessful sign in attempts.

    + +

    Click the link below to unlock your account:

    + +

    <%= link_to 'Unlock my account', unlock_url(slug: ActsAsTenant.current_tenant&.slug, unlock_token: @token) %>

    diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 77d542f..5f631ef 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -246,7 +246,7 @@ Devise.setup do |config| # Turn scoped views on. Before rendering "sessions/new", it will first check for # "users/sessions/new". It's turned off by default because it's slower if you # are using only default views. - # config.scoped_views = false + config.scoped_views = true # Configure the default scope given to Warden. By default it's the first # devise role declared in your routes (usually :user). diff --git a/config/routes.rb b/config/routes.rb index b407e01..9659d05 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,7 +2,7 @@ Rails.application.routes.draw do mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? - scope ":slug", constraints: {slug: /[a-z]+/} do + scope ":slug", constraints: { slug: /[a-z]+/ } do devise_for :users, skip: [:registration, :session, :confirmation] devise_scope :user do post 'users', to: 'users/registrations#create' diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index aa7562f..821db72 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -23,6 +23,13 @@ RSpec.describe 'users/registrations', type: :request do password: SwaggerResponseHelper::PASSWORD, password_confirmation: SwaggerResponseHelper::PASSWORD } + }, + wedding: { + type: :object, + required: %i[date], + properties: { + date: { type: :string, format: :date}, + } } } } From 7a80f1f5ef565cfc439f78a15435f420f9739899 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 1 Dec 2024 14:04:03 +0100 Subject: [PATCH 177/283] Make wedding object required for the swagger specs --- spec/requests/users/registrations_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index 821db72..ae0f86d 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -13,7 +13,7 @@ RSpec.describe 'users/registrations', type: :request do parameter Swagger::Schema::SLUG parameter name: :body, in: :body, schema: { type: :object, - required: [:user], + required: [:user, :wedding], properties: { user: { type: :object, From f588b97e182f869faeb37659366ab498fc79b677 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 1 Dec 2024 13:05:22 +0000 Subject: [PATCH 178/283] Add copyright notice --- app/views/users/mailer/confirmation_instructions.html.erb | 2 ++ app/views/users/mailer/email_changed.html.erb | 2 ++ app/views/users/mailer/password_change.html.erb | 2 ++ app/views/users/mailer/reset_password_instructions.html.erb | 2 ++ app/views/users/mailer/unlock_instructions.html.erb | 2 ++ 5 files changed, 10 insertions(+) diff --git a/app/views/users/mailer/confirmation_instructions.html.erb b/app/views/users/mailer/confirmation_instructions.html.erb index 7b71e44..448e3d9 100644 --- a/app/views/users/mailer/confirmation_instructions.html.erb +++ b/app/views/users/mailer/confirmation_instructions.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

    Welcome <%= @email %>!

    You can confirm your account email through the link below:

    diff --git a/app/views/users/mailer/email_changed.html.erb b/app/views/users/mailer/email_changed.html.erb index 32f4ba8..51cfa7a 100644 --- a/app/views/users/mailer/email_changed.html.erb +++ b/app/views/users/mailer/email_changed.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

    Hello <%= @email %>!

    <% if @resource.try(:unconfirmed_email?) %> diff --git a/app/views/users/mailer/password_change.html.erb b/app/views/users/mailer/password_change.html.erb index b41daf4..7bfd484 100644 --- a/app/views/users/mailer/password_change.html.erb +++ b/app/views/users/mailer/password_change.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

    Hello <%= @resource.email %>!

    We're contacting you to notify you that your password has been changed.

    diff --git a/app/views/users/mailer/reset_password_instructions.html.erb b/app/views/users/mailer/reset_password_instructions.html.erb index 010a079..3bc6fcd 100644 --- a/app/views/users/mailer/reset_password_instructions.html.erb +++ b/app/views/users/mailer/reset_password_instructions.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

    Hello <%= @resource.email %>!

    Someone has requested a link to change your password. You can do this through the link below.

    diff --git a/app/views/users/mailer/unlock_instructions.html.erb b/app/views/users/mailer/unlock_instructions.html.erb index 313fe8e..6df5c0a 100644 --- a/app/views/users/mailer/unlock_instructions.html.erb +++ b/app/views/users/mailer/unlock_instructions.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> +

    Hello <%= @resource.email %>!

    Your account has been locked due to an excessive number of unsuccessful sign in attempts.

    From 9d08ef6f18ca56e571dc36d1e68055d12ad622e5 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 1 Dec 2024 18:17:07 +0100 Subject: [PATCH 179/283] Update wedding slug rules to accept numbers and other chars --- app/models/wedding.rb | 4 +++- config/routes.rb | 2 +- spec/models/wedding_spec.rb | 17 ++++++++++++++++- spec/requests/schemas.rb | 1 + 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/models/wedding.rb b/app/models/wedding.rb index abc0999..cee2fb7 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -15,6 +15,8 @@ # index_weddings_on_slug (slug) UNIQUE # class Wedding < ApplicationRecord + SLUG_REGEX = /[a-z\d-]+/ + validates :date, presence: true - validates :slug, presence: true, uniqueness: true, format: { with: /\A[a-z]+\z/ } + validates :slug, presence: true, uniqueness: true, format: { with: /\A#{SLUG_REGEX}\z/ } end diff --git a/config/routes.rb b/config/routes.rb index 9659d05..10810fe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,7 +2,7 @@ Rails.application.routes.draw do mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? - scope ":slug", constraints: { slug: /[a-z]+/ } do + scope ":slug", constraints: { slug: Wedding::SLUG_REGEX } do devise_for :users, skip: [:registration, :session, :confirmation] devise_scope :user do post 'users', to: 'users/registrations#create' diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index 702769f..6ec8a3e 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -3,5 +3,20 @@ require 'rails_helper' RSpec.describe Wedding, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + describe 'validations' do + subject { build(:wedding) } + describe 'slug' do + it { should allow_value('foo').for(:slug) } + it { should allow_value('foo-bar').for(:slug) } + it { should allow_value('foo-123').for(:slug) } + it { should allow_value('foo-123-').for(:slug) } + it { should allow_value('foo--123').for(:slug) } + + it { should_not allow_value('Foo').for(:slug) } + it { should_not allow_value('/foo').for(:slug) } + it { should_not allow_value('foo/123').for(:slug) } + it { should_not allow_value('foo_123').for(:slug) } + it { should_not allow_value('foo/').for(:slug) } + end + end end diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index ce35ad7..6602db8 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -14,6 +14,7 @@ module Swagger name: 'slug', in: :path, type: :string, + pattern: Wedding::SLUG_REGEX, example: :default, description: 'Wedding slug' } From f708191edef2561f64dc1c5a8979a43161efcac4 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 1 Dec 2024 18:21:33 +0100 Subject: [PATCH 180/283] Indicate in the README that the application is multi-tenant --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e8d48e..e1cc204 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,13 @@ The backend service will seed the database with fake data. It's worth noting tha The backend, frontend and workers have hot-reloading enabled, so changes made to the codebase should be reflected in the application on the next request. -Once all containers have started, visit http://libre-wedding-planner.app.localhost/dashboard to load the application. +Once all containers have started, visit http://libre-wedding-planner.app.localhost/default/dashboard to load the application. +## Multitenancy + +LibreWeddingPlanner is designed to manage multiple weddings in a single host. All URLs (in the API and the frontend) are scoped under a slug that is unique per wedding. The slug is made of lowercase letters, numbers, and dashes (-). + +The development environment is seeded with a wedding whose slug is `default`. ## Email delivery In the development environment, real emails will not be sent. You can visit http://libre-wedding-planner.app.localhost/letter_opener/ to get a list of emails generated by the application. From b237239a1f2fdbfb402ba5fe6f2d9c86dad59db1 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 1 Dec 2024 19:42:25 +0100 Subject: [PATCH 181/283] Define an endpoint to retrieve a LibreCaptcha captcha --- Gemfile | 1 + Gemfile.lock | 7 +++++++ app/controllers/captcha_controller.rb | 11 +++++++++++ app/services/libre_captcha.rb | 12 ++++++++++++ config/routes.rb | 3 +++ docker-compose.yml | 6 ++++++ nginx.conf | 5 +++++ spec/requests/captcha_spec.rb | 22 ++++++++++++++++++++++ 8 files changed, 67 insertions(+) create mode 100644 app/controllers/captcha_controller.rb create mode 100644 app/services/libre_captcha.rb create mode 100644 spec/requests/captcha_spec.rb diff --git a/Gemfile b/Gemfile index ead69aa..cb91e69 100644 --- a/Gemfile +++ b/Gemfile @@ -21,6 +21,7 @@ gem 'rack-cors' gem 'react-rails' gem 'rubytree' gem 'acts_as_tenant' +gem 'httparty' group :development, :test do gem 'annotaterb' diff --git a/Gemfile.lock b/Gemfile.lock index 7e795fc..c0660de 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -126,6 +126,10 @@ GEM raabro (~> 1.4) globalid (1.2.1) activesupport (>= 6.1) + httparty (0.22.0) + csv + mini_mime (>= 1.0.0) + multi_xml (>= 0.5.2) i18n (1.14.6) concurrent-ruby (~> 1.0) importmap-rails (2.0.3) @@ -188,6 +192,8 @@ GEM money (6.19.0) i18n (>= 0.6.4, <= 2) msgpack (1.7.2) + multi_xml (0.7.1) + bigdecimal (~> 3.1) net-imap (0.5.1) date net-protocol @@ -398,6 +404,7 @@ DEPENDENCIES devise (~> 4.9) factory_bot_rails faker + httparty importmap-rails jbuilder jsonapi-rails diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb new file mode 100644 index 0000000..79f84ea --- /dev/null +++ b/app/controllers/captcha_controller.rb @@ -0,0 +1,11 @@ +class CaptchaController < ApplicationController + skip_before_action :authenticate_user! + + def create + id = LibreCaptcha.new.get_id + render json: { + id:, + media_url: media_captcha_index_url(id:) + }, status: :created + end +end diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb new file mode 100644 index 0000000..3d49e5a --- /dev/null +++ b/app/services/libre_captcha.rb @@ -0,0 +1,12 @@ +class LibreCaptcha + def get_id + HTTParty.post("http://libre-captcha:8888/v2/captcha", + body: { + input_type: "text", + level: :hard, + media: 'image/png', + size: '350x100' + }.to_json + ).then { |raw| JSON.parse(raw)['id'] } + end +end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 10810fe..1357d9c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -23,6 +23,9 @@ Rails.application.routes.draw do resources :tables_arrangements, only: %i[index show] end + resources :captcha, only: :create do + get 'v2/media', to: 'captcha#media', on: :collection, as: :media + end mount Rswag::Ui::Engine => '/api-docs' mount Rswag::Api::Engine => '/api-docs' diff --git a/docker-compose.yml b/docker-compose.yml index e1a5977..18050d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,6 +36,12 @@ services: - backend volumes: - ../wedding-planner-frontend/:/app + libre-captcha: + image: librecaptcha/lc-core:latest + volumes: + - "./tmp/libre-captcha-data:/lc-core/data" + ports: + - "8888:8888" nginx: image: nginx:latest ports: diff --git a/nginx.conf b/nginx.conf index 06d059b..6371bdd 100644 --- a/nginx.conf +++ b/nginx.conf @@ -12,6 +12,11 @@ server { proxy_set_header Host $http_host; } + location /captcha/ { + proxy_pass http://libre-captcha:8888/; + proxy_set_header Host $http_host; + } + location / { proxy_pass http://frontend:3000; proxy_set_header Host $http_host; diff --git a/spec/requests/captcha_spec.rb b/spec/requests/captcha_spec.rb new file mode 100644 index 0000000..adac1a8 --- /dev/null +++ b/spec/requests/captcha_spec.rb @@ -0,0 +1,22 @@ +require 'swagger_helper' + +RSpec.describe 'captcha', type: :request do + path '/captcha' do + + post('create a CAPTCHA challenge') do + tags 'CAPTCHA' + consumes 'application/json' + produces 'application/json' + + response(201, 'created') do + schema type: :object, + required: %i[id], + properties: { + id: { type: :string, format: :uuid } + media_url: { type: :string, format: :uri } + } + xit + end + end + end +end From be9ca9e6b01e95d6875a334ff04f69f128ed8ac5 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 1 Dec 2024 18:43:28 +0000 Subject: [PATCH 182/283] Add copyright notice --- app/controllers/captcha_controller.rb | 2 ++ app/services/libre_captcha.rb | 2 ++ spec/requests/captcha_spec.rb | 2 ++ 3 files changed, 6 insertions(+) diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 79f84ea..428328d 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class CaptchaController < ApplicationController skip_before_action :authenticate_user! diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb index 3d49e5a..d811437 100644 --- a/app/services/libre_captcha.rb +++ b/app/services/libre_captcha.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class LibreCaptcha def get_id HTTParty.post("http://libre-captcha:8888/v2/captcha", diff --git a/spec/requests/captcha_spec.rb b/spec/requests/captcha_spec.rb index adac1a8..4cde63a 100644 --- a/spec/requests/captcha_spec.rb +++ b/spec/requests/captcha_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'captcha', type: :request do From 5f01741943d77907683fa8ec97ee3e348836ace2 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 1 Dec 2024 19:56:49 +0100 Subject: [PATCH 183/283] Validate the Captcha challenge for account signup --- app/controllers/application_controller.rb | 12 ++++++++++++ app/controllers/users/registrations_controller.rb | 2 ++ app/services/libre_captcha.rb | 6 ++++++ spec/requests/captcha_spec.rb | 4 ++-- spec/requests/schemas.rb | 11 +++++++++++ spec/requests/users/registrations_spec.rb | 3 ++- 6 files changed, 35 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f163c3e..15a4b17 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -30,6 +30,18 @@ class ApplicationController < ActionController::Base private + def validate_captcha! + Rails.logger.info("Captcha params: #{captcha_params}") + + return if LibreCaptcha.new.valid?(id: captcha_params[:id], answer: captcha_params[:answer]) + + render json: { error: 'Incorrect CAPTCHA solution' }, status: :unprocessable_entity + end + + def captcha_params + params.expect(captcha: [:id, :answer]) + end + def default_url_options(options = {}) options.merge(path_params: { slug: ActsAsTenant.current_tenant&.slug }) end diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 24d8eca..4894d4b 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -4,6 +4,8 @@ class Users::RegistrationsController < Devise::RegistrationsController clear_respond_to respond_to :json + before_action :validate_captcha!, only: :create + def create wedding = Wedding.create(wedding_params) unless wedding.persisted? diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb index d811437..8684e9f 100644 --- a/app/services/libre_captcha.rb +++ b/app/services/libre_captcha.rb @@ -11,4 +11,10 @@ class LibreCaptcha }.to_json ).then { |raw| JSON.parse(raw)['id'] } end + + def valid?(id:, answer:) + HTTParty.post("http://libre-captcha:8888/v2/answer", + body: { id:, answer: }.to_json + ).then { |raw| JSON.parse(raw)['result'] == 'True' } + end end \ No newline at end of file diff --git a/spec/requests/captcha_spec.rb b/spec/requests/captcha_spec.rb index 4cde63a..607a2d9 100644 --- a/spec/requests/captcha_spec.rb +++ b/spec/requests/captcha_spec.rb @@ -14,8 +14,8 @@ RSpec.describe 'captcha', type: :request do schema type: :object, required: %i[id], properties: { - id: { type: :string, format: :uuid } - media_url: { type: :string, format: :uri } + id: { type: :string, format: :uuid }, + media_url: { type: :string, format: :uri }, } xit end diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index 6602db8..e1f7b43 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -18,5 +18,16 @@ module Swagger example: :default, description: 'Wedding slug' } + + CAPTCHA = { + captcha: { + type: :object, + required: %i[id answer], + properties: { + id: { type: :string, format: :uuid }, + answer: { type: :string } + } + } + } end end \ No newline at end of file diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index ae0f86d..f29b387 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -30,7 +30,8 @@ RSpec.describe 'users/registrations', type: :request do properties: { date: { type: :string, format: :date}, } - } + }, + **Swagger::Schema::CAPTCHA } } From 71046b9a1c6a4ddb8fa91e0cd1c6c8e948d74248 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 1 Dec 2024 20:01:00 +0100 Subject: [PATCH 184/283] Avoid exposing internal port and unnecessary endpoints --- docker-compose.yml | 2 +- nginx.conf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 18050d1..64b54c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,7 +41,7 @@ services: volumes: - "./tmp/libre-captcha-data:/lc-core/data" ports: - - "8888:8888" + - 8888 nginx: image: nginx:latest ports: diff --git a/nginx.conf b/nginx.conf index 6371bdd..58c2bb9 100644 --- a/nginx.conf +++ b/nginx.conf @@ -12,8 +12,8 @@ server { proxy_set_header Host $http_host; } - location /captcha/ { - proxy_pass http://libre-captcha:8888/; + location /captcha/v2/media/ { + proxy_pass http://libre-captcha:8888/v2/media/; proxy_set_header Host $http_host; } From ef573c5f73b09dbc1cb4aa6b842c78770a32633a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 2 Dec 2024 08:57:10 +0100 Subject: [PATCH 185/283] Require a tenant to be configured for all queries --- config/initializers/acts_as_tenant.rb | 3 +++ db/seeds.rb | 16 +++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 config/initializers/acts_as_tenant.rb diff --git a/config/initializers/acts_as_tenant.rb b/config/initializers/acts_as_tenant.rb new file mode 100644 index 0000000..2813ace --- /dev/null +++ b/config/initializers/acts_as_tenant.rb @@ -0,0 +1,3 @@ +ActsAsTenant.configure do |config| + config.require_tenant = true +end \ No newline at end of file diff --git a/db/seeds.rb b/db/seeds.rb index e493f6b..e0a11a6 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -2,13 +2,15 @@ NUMBER_OF_GUESTS = 50 -TablesArrangement.delete_all -Expense.delete_all -Guest.delete_all -Group.delete_all - -Wedding.delete_all -wedding = Wedding.create!(slug: :default, date: 1.year.from_now) +ActsAsTenant.without_tenant do + TablesArrangement.delete_all + Expense.delete_all + Guest.delete_all + Group.delete_all + + Wedding.delete_all + wedding = Wedding.create!(slug: :default, date: 1.year.from_now) +end ActsAsTenant.with_tenant(wedding) do Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed') From 3fca449461aa1649ac874c39c36b56850f4f2efa Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 2 Dec 2024 09:04:48 +0100 Subject: [PATCH 186/283] Limit visibility per tenant --- app/controllers/application_controller.rb | 3 ++- db/seeds.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 15a4b17..8343f65 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,7 @@ # Copyright (C) 2024 Manuel Bustillo class ApplicationController < ActionController::Base + set_current_tenant_through_filter before_action :set_tenant before_action :authenticate_user! after_action :set_csrf_cookie @@ -47,7 +48,7 @@ class ApplicationController < ActionController::Base end def set_tenant - ActsAsTenant.current_tenant = Wedding.find_by(slug: params[:slug]) + set_current_tenant(Wedding.find_by!(slug: params[:slug])) end def development_swagger? diff --git a/db/seeds.rb b/db/seeds.rb index e0a11a6..9d93073 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -9,9 +9,10 @@ ActsAsTenant.without_tenant do Group.delete_all Wedding.delete_all - wedding = Wedding.create!(slug: :default, date: 1.year.from_now) end +wedding = Wedding.create!(slug: :default, date: 1.year.from_now) + ActsAsTenant.with_tenant(wedding) do Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed') Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed') From 3ea1d1e7ecd068d1542b89a103bd36693252e28b Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 2 Dec 2024 08:05:46 +0000 Subject: [PATCH 187/283] Add copyright notice --- config/initializers/acts_as_tenant.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/initializers/acts_as_tenant.rb b/config/initializers/acts_as_tenant.rb index 2813ace..2117f9c 100644 --- a/config/initializers/acts_as_tenant.rb +++ b/config/initializers/acts_as_tenant.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + ActsAsTenant.configure do |config| config.require_tenant = true end \ No newline at end of file From a96be2a79ef6c9227c1299b1bbd62d4bcd132143 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 2 Dec 2024 20:33:00 +0100 Subject: [PATCH 188/283] Do not require a tenant scope for running tests --- config/initializers/acts_as_tenant.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/acts_as_tenant.rb b/config/initializers/acts_as_tenant.rb index 2117f9c..c535737 100644 --- a/config/initializers/acts_as_tenant.rb +++ b/config/initializers/acts_as_tenant.rb @@ -1,5 +1,5 @@ # Copyright (C) 2024 Manuel Bustillo ActsAsTenant.configure do |config| - config.require_tenant = true + config.require_tenant = !Rails.env.test? end \ No newline at end of file From 6aba5e234f44691966c95b02b6369606ac4a06b0 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 3 Dec 2024 01:06:02 +0000 Subject: [PATCH 189/283] Update dependency factory_bot_rails to v6.4.4 --- Gemfile.lock | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c0660de..af774da 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -176,7 +176,7 @@ GEM tomlrb (>= 1.3, < 2.1) with_env (= 1.1.0) xml-simple (~> 1.1.9) - logger (1.6.1) + logger (1.6.2) loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -204,17 +204,17 @@ GEM net-smtp (0.5.0) net-protocol nio4r (2.7.4) - nokogiri (1.16.7-aarch64-linux) + nokogiri (1.16.8-aarch64-linux) racc (~> 1.4) - nokogiri (1.16.7-arm-linux) + nokogiri (1.16.8-arm-linux) racc (~> 1.4) - nokogiri (1.16.7-arm64-darwin) + nokogiri (1.16.8-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86-linux) + nokogiri (1.16.8-x86-linux) racc (~> 1.4) - nokogiri (1.16.7-x86_64-darwin) + nokogiri (1.16.8-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.16.8-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) parallel (1.26.3) @@ -225,7 +225,8 @@ GEM pry (0.15.0) coderay (~> 1.1) method_source (~> 1.0) - psych (5.2.0) + psych (5.2.1) + date stringio public_suffix (6.0.1) puma (6.5.0) @@ -259,9 +260,9 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) + rails-html-sanitizer (1.6.1) loofah (~> 2.21) - nokogiri (~> 1.14) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) railties (8.0.0) actionpack (= 8.0.0) activesupport (= 8.0.0) From 70e9f742073bf9dd1ffdce21c01b53b537f59e8d Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 4 Dec 2024 01:06:43 +0000 Subject: [PATCH 190/283] Update dependency rubocop to v1.69.1 --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index af774da..4dd1b0a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -324,14 +324,14 @@ GEM rswag-ui (2.16.0) actionpack (>= 5.2, < 8.1) railties (>= 5.2, < 8.1) - rubocop (1.69.0) + rubocop (1.69.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.36.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.36.2) From 2c4befbcf6ddd6b8a318216859ec1001b4b2424d Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 7 Dec 2024 01:06:02 +0000 Subject: [PATCH 191/283] Update dependency solid_queue to v1.1.0 --- Gemfile.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4dd1b0a..dde22ed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -98,7 +98,7 @@ GEM connection_pool (2.4.1) crass (1.0.6) csv (3.3.0) - date (3.4.0) + date (3.4.1) debug (1.9.2) irb (~> 1.10) reline (>= 0.3.8) @@ -136,7 +136,7 @@ GEM actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) - io-console (0.7.2) + io-console (0.8.0) irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) @@ -188,7 +188,7 @@ GEM marcel (1.0.4) method_source (1.1.0) mini_mime (1.1.5) - minitest (5.25.2) + minitest (5.25.4) money (6.19.0) i18n (>= 0.6.4, <= 2) msgpack (1.7.2) @@ -273,7 +273,7 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rdoc (6.7.0) + rdoc (6.8.1) psych (>= 4.0.0) react-rails (3.2.1) babel-transpiler (>= 0.7.0) @@ -340,10 +340,10 @@ GEM rubytree (2.1.0) json (~> 2.0, > 2.3.1) rubyzip (2.3.2) - securerandom (0.3.2) + securerandom (0.4.0) shoulda-matchers (6.4.0) activesupport (>= 5.2.0) - solid_queue (1.0.2) + solid_queue (1.1.0) activejob (>= 7.1) activerecord (>= 7.1) concurrent-ruby (>= 1.3.1) @@ -371,7 +371,7 @@ GEM concurrent-ruby (~> 1.0) unicode-display_width (2.6.0) uri (1.0.2) - useragent (0.16.10) + useragent (0.16.11) warden (1.2.9) rack (>= 2.0.9) web-console (4.2.1) From 8527b20075be430af588c6839aa857c92f2ac1ec Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 7 Dec 2024 12:39:43 +0100 Subject: [PATCH 192/283] Remove wedding date attribute --- app/models/wedding.rb | 2 -- db/migrate/20241207112305_remove_wedding_date.rb | 5 +++++ db/schema.rb | 5 +---- spec/requests/users/registrations_spec.rb | 7 ------- 4 files changed, 6 insertions(+), 13 deletions(-) create mode 100644 db/migrate/20241207112305_remove_wedding_date.rb diff --git a/app/models/wedding.rb b/app/models/wedding.rb index cee2fb7..125c58e 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -5,7 +5,6 @@ # Table name: weddings # # id :uuid not null, primary key -# date :date not null # slug :string not null # created_at :datetime not null # updated_at :datetime not null @@ -17,6 +16,5 @@ class Wedding < ApplicationRecord SLUG_REGEX = /[a-z\d-]+/ - validates :date, presence: true validates :slug, presence: true, uniqueness: true, format: { with: /\A#{SLUG_REGEX}\z/ } end diff --git a/db/migrate/20241207112305_remove_wedding_date.rb b/db/migrate/20241207112305_remove_wedding_date.rb new file mode 100644 index 0000000..2176f55 --- /dev/null +++ b/db/migrate/20241207112305_remove_wedding_date.rb @@ -0,0 +1,5 @@ +class RemoveWeddingDate < ActiveRecord::Migration[8.0] + def change + remove_column :weddings, :date, :date, null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 7ff33f3..f1c5b20 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2024_11_30_185731) do +ActiveRecord::Schema[8.0].define(version: 2024_12_07_112305) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -222,7 +220,6 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_30_185731) do create_table "weddings", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "slug", null: false - t.date "date", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["slug"], name: "index_weddings_on_slug", unique: true diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index f29b387..2cbaeea 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -24,13 +24,6 @@ RSpec.describe 'users/registrations', type: :request do password_confirmation: SwaggerResponseHelper::PASSWORD } }, - wedding: { - type: :object, - required: %i[date], - properties: { - date: { type: :string, format: :date}, - } - }, **Swagger::Schema::CAPTCHA } } From 022b58bb3867a68784e9f32d26898b1a780962be Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 7 Dec 2024 12:43:08 +0100 Subject: [PATCH 193/283] Fix issues with tenant during registration --- app/controllers/captcha_controller.rb | 2 +- app/controllers/users/registrations_controller.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 428328d..351b324 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -2,7 +2,7 @@ class CaptchaController < ApplicationController skip_before_action :authenticate_user! - + skip_before_action :set_tenant def create id = LibreCaptcha.new.get_id render json: { diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 4894d4b..0aae89d 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -7,7 +7,7 @@ class Users::RegistrationsController < Devise::RegistrationsController before_action :validate_captcha!, only: :create def create - wedding = Wedding.create(wedding_params) + wedding = Wedding.create(slug: params[:slug]) unless wedding.persisted? render json: { errors: wedding.errors.full_messages }, status: :unprocessable_entity return @@ -22,7 +22,7 @@ class Users::RegistrationsController < Devise::RegistrationsController private - def wedding_params - { slug: params[:slug], **params.expect(wedding: :date) } + def set_tenant + set_current_tenant(nil) end end \ No newline at end of file From a3f14f4fec8bfb2ee4174ae8073b11cf07086c09 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 7 Dec 2024 19:07:06 +0100 Subject: [PATCH 194/283] Include slug in root_url --- config/routes.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 1357d9c..bd26594 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -21,6 +21,8 @@ Rails.application.routes.draw do get :summary, on: :collection end resources :tables_arrangements, only: %i[index show] + + root to: redirect("/%{slug}") end resources :captcha, only: :create do @@ -31,6 +33,4 @@ Rails.application.routes.draw do mount Rswag::Api::Engine => '/api-docs' get 'up' => 'rails/health#show', as: :rails_health_check - - root to: redirect('/dashboard') end From 9b612ce01d4728e71e03618216cc1a36fbf071a4 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 7 Dec 2024 18:09:21 +0000 Subject: [PATCH 195/283] Add copyright notice --- db/migrate/20241207112305_remove_wedding_date.rb | 2 ++ db/schema.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/db/migrate/20241207112305_remove_wedding_date.rb b/db/migrate/20241207112305_remove_wedding_date.rb index 2176f55..c810ee4 100644 --- a/db/migrate/20241207112305_remove_wedding_date.rb +++ b/db/migrate/20241207112305_remove_wedding_date.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class RemoveWeddingDate < ActiveRecord::Migration[8.0] def change remove_column :weddings, :date, :date, null: false diff --git a/db/schema.rb b/db/schema.rb index f1c5b20..29940a3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From 2ab966faf84b119a39029ae86551d31f9e5b6e3d Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 7 Dec 2024 19:59:59 +0100 Subject: [PATCH 196/283] Fix production DB host --- config/database.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/database.yml b/config/database.yml index 3d30d61..611e16b 100644 --- a/config/database.yml +++ b/config/database.yml @@ -83,6 +83,7 @@ test: # production: <<: *default + host: db database: wedding_planner_production username: wedding_planner password: <%= ENV["WEDDING_PLANNER_DATABASE_PASSWORD"] %> From dfe914a0b821169a09a34e9868836368bbdc3d90 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 7 Dec 2024 20:27:28 +0100 Subject: [PATCH 197/283] Fix build of Docker image --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index cb91e69..e7c867a 100644 --- a/Gemfile +++ b/Gemfile @@ -22,6 +22,7 @@ gem 'react-rails' gem 'rubytree' gem 'acts_as_tenant' gem 'httparty' +gem 'rswag' group :development, :test do gem 'annotaterb' @@ -30,7 +31,6 @@ group :development, :test do gem 'license_finder' gem 'pry' gem 'rspec-rails', '~> 7.1.0' - gem 'rswag' gem 'shoulda-matchers', '~> 6.0' end From 3996ffc85c1fe3a912db14cbb317158fe9bcd8e2 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 7 Dec 2024 22:53:30 +0100 Subject: [PATCH 198/283] Fix tenant-related error retrieving captcha --- app/controllers/captcha_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 428328d..4b7234a 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -10,4 +10,10 @@ class CaptchaController < ApplicationController media_url: media_captcha_index_url(id:) }, status: :created end + + private + + def set_tenant + ActsAsTenant.current_tenant = nil + end end From fdef94be9acb80fcb4fbf35ef218307efbebebb6 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 7 Dec 2024 23:18:23 +0100 Subject: [PATCH 199/283] Revert "Fix tenant-related error retrieving captcha" This reverts commit 3996ffc85c1fe3a912db14cbb317158fe9bcd8e2. --- app/controllers/captcha_controller.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 0ac3548..351b324 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -10,10 +10,4 @@ class CaptchaController < ApplicationController media_url: media_captcha_index_url(id:) }, status: :created end - - private - - def set_tenant - ActsAsTenant.current_tenant = nil - end end From 93d907cdc82b063967b319d30a8ab0045b168767 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 7 Dec 2024 23:43:21 +0100 Subject: [PATCH 200/283] Remove leftovers of the date attribute --- db/seeds.rb | 2 +- spec/factories/weddings.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 9d93073..eb45757 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -11,7 +11,7 @@ ActsAsTenant.without_tenant do Wedding.delete_all end -wedding = Wedding.create!(slug: :default, date: 1.year.from_now) +wedding = Wedding.create!(slug: :default) ActsAsTenant.with_tenant(wedding) do Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed') diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index 3680045..5a765a1 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -3,6 +3,5 @@ FactoryBot.define do factory :wedding do sequence(:slug) { |i| "wedding-#{i}" } - date { 1.year.from_now } end end From 1fb6c483ed36d14bb02f5e59bb6e0b0ab79278b2 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 8 Dec 2024 00:48:42 +0100 Subject: [PATCH 201/283] Temporarily allow insecure cookies --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8343f65..7cb39a8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -59,7 +59,7 @@ class ApplicationController < ActionController::Base def set_csrf_cookie cookies['csrf-token'] = { value: form_authenticity_token, - secure: Rails.env.production?, + secure: false, same_site: :strict } end From 84684b90d774ac8d9bb54ce30210335cb61ff23d Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 8 Dec 2024 08:53:51 +0100 Subject: [PATCH 202/283] Configure allowed hosts --- config/environments/production.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 94a2257..2a94187 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -92,6 +92,9 @@ Rails.application.configure do # "example.com", # Allow requests from example.com # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` # ] + + config.hosts << "app.libreweddingplanner.org" + # Skip DNS rebinding protection for the default health check endpoint. - # config.host_authorization = { exclude: ->(request) { request.path == "/up" } } + config.host_authorization = { exclude: ->(request) { request.path == "/up" } } end From 438de103ec22a6f1bbf3482ec50700a6c11d8c93 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 8 Dec 2024 09:32:34 +0100 Subject: [PATCH 203/283] Define a dummy endpoint to return a valid CSRF token --- app/controllers/tokens_controller.rb | 8 ++++++++ config/routes.rb | 19 ++++++++++--------- spec/requests/tokens_spec.rb | 13 +++++++++++++ 3 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 app/controllers/tokens_controller.rb create mode 100644 spec/requests/tokens_spec.rb diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb new file mode 100644 index 0000000..a065647 --- /dev/null +++ b/app/controllers/tokens_controller.rb @@ -0,0 +1,8 @@ +class TokensController < ApplicationController + skip_before_action :authenticate_user! + skip_before_action :set_tenant + + def show + head :ok + end +end diff --git a/config/routes.rb b/config/routes.rb index bd26594..1075005 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,6 +2,16 @@ Rails.application.routes.draw do mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? + get 'token' => 'tokens#show', as: :token + get 'up' => 'rails/health#show', as: :rails_health_check + + resources :captcha, only: :create do + get 'v2/media', to: 'captcha#media', on: :collection, as: :media + end + + mount Rswag::Ui::Engine => '/api-docs' + mount Rswag::Api::Engine => '/api-docs' + scope ":slug", constraints: { slug: Wedding::SLUG_REGEX } do devise_for :users, skip: [:registration, :session, :confirmation] devise_scope :user do @@ -24,13 +34,4 @@ Rails.application.routes.draw do root to: redirect("/%{slug}") end - - resources :captcha, only: :create do - get 'v2/media', to: 'captcha#media', on: :collection, as: :media - end - - mount Rswag::Ui::Engine => '/api-docs' - mount Rswag::Api::Engine => '/api-docs' - - get 'up' => 'rails/health#show', as: :rails_health_check end diff --git a/spec/requests/tokens_spec.rb b/spec/requests/tokens_spec.rb new file mode 100644 index 0000000..1010def --- /dev/null +++ b/spec/requests/tokens_spec.rb @@ -0,0 +1,13 @@ +require 'swagger_helper' + +RSpec.describe 'tokens', type: :request do + path '/token' do + get('get a cookie with CSRF token') do + tags 'CSRF token' + consumes 'application/json' + produces 'application/json' + + response_empty_200 + end + end +end From 98877166dd9677686868e1e5664e5f1f8cc64bbe Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 8 Dec 2024 08:34:55 +0000 Subject: [PATCH 204/283] Add copyright notice --- app/controllers/tokens_controller.rb | 2 ++ spec/requests/tokens_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb index a065647..c3dabba 100644 --- a/app/controllers/tokens_controller.rb +++ b/app/controllers/tokens_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class TokensController < ApplicationController skip_before_action :authenticate_user! skip_before_action :set_tenant diff --git a/spec/requests/tokens_spec.rb b/spec/requests/tokens_spec.rb index 1010def..5a08e05 100644 --- a/spec/requests/tokens_spec.rb +++ b/spec/requests/tokens_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'tokens', type: :request do From 9e097361d0f547abf6d951540dac894ef685542d Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 8 Dec 2024 11:30:38 +0100 Subject: [PATCH 205/283] Define endpoints to create, update, and delete groups --- app/controllers/groups_controller.rb | 26 +++++++ app/models/group.rb | 2 +- app/models/guest.rb | 2 +- config/routes.rb | 2 +- .../20241208102932_allow_ungrouped_guests.rb | 5 ++ db/schema.rb | 6 +- spec/requests/groups_spec.rb | 67 +++++++++++++++++++ spec/requests/schemas.rb | 14 ++-- 8 files changed, 113 insertions(+), 11 deletions(-) create mode 100644 db/migrate/20241208102932_allow_ungrouped_guests.rb diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 37df884..f04e394 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -4,4 +4,30 @@ class GroupsController < ApplicationController def index render json: Groups::SummaryQuery.new.call.as_json end + + def create + group = Group.create!(**group_params, parent:) + render json: group.as_json(only: %i[id name icon color parent_id]), status: :created + end + + def update + group = Group.find(params[:id]) + group.update!(**group_params, parent:) + render json: group.as_json(only: %i[id name icon color parent_id]), status: :ok + end + + def destroy + Group.find(params[:id]).destroy! + render json: {}, status: :ok + end + + private + + def parent + params[:group][:parent_id].present? ? Group.find(params[:group][:parent_id]) : nil + end + + def group_params + params.expect(group: [:name, :icon, :color]) + end end diff --git a/app/models/group.rb b/app/models/group.rb index 5056b28..a00a671 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -38,7 +38,7 @@ class Group < ApplicationRecord scope :roots, -> { where(parent_id: nil) } - has_many :guests + has_many :guests, dependent: :nullify def colorize_children(generation = 1) derived_colors = generation == 1 ? color.paint.palette.analogous(size: children.count) : color.paint.palette.decreasing_saturation diff --git a/app/models/guest.rb b/app/models/guest.rb index 929cc6e..a418a27 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -10,7 +10,7 @@ # status :integer default("considered") # created_at :datetime not null # updated_at :datetime not null -# group_id :uuid not null +# group_id :uuid # wedding_id :uuid not null # # Indexes diff --git a/config/routes.rb b/config/routes.rb index bd26594..5b2c031 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,7 +13,7 @@ Rails.application.routes.draw do get '/users/confirmation', to: 'users/confirmations#show', as: :confirmation end - resources :groups, only: :index + resources :groups, only: %i[index create update destroy] resources :guests, only: %i[index create update destroy] do post :bulk_update, on: :collection end diff --git a/db/migrate/20241208102932_allow_ungrouped_guests.rb b/db/migrate/20241208102932_allow_ungrouped_guests.rb new file mode 100644 index 0000000..e4bb19a --- /dev/null +++ b/db/migrate/20241208102932_allow_ungrouped_guests.rb @@ -0,0 +1,5 @@ +class AllowUngroupedGuests < ActiveRecord::Migration[8.0] + def change + change_column_null :guests, :group_id, true + end +end diff --git a/db/schema.rb b/db/schema.rb index 29940a3..e8f6c9f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2024_12_07_112305) do +ActiveRecord::Schema[8.0].define(version: 2024_12_08_102932) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -48,7 +46,7 @@ ActiveRecord::Schema[8.0].define(version: 2024_12_07_112305) do t.string "phone" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.uuid "group_id", null: false + t.uuid "group_id" t.integer "status", default: 0 t.string "name" t.uuid "wedding_id", null: false diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index 6d5f057..44f755b 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -31,5 +31,72 @@ RSpec.describe 'groups', type: :request do end regular_api_responses end + + post('create group') do + tags 'Groups' + consumes 'application/json' + produces 'application/json' + parameter Swagger::Schema::SLUG + parameter name: :body, in: :body, schema: { + type: :object, + required: %i[group], + properties: { + group: { + type: :object, + required: %i[name], + properties: Swagger::Schema::GROUP + } + } + } + response(201, 'created') do + schema type: :object, properties: { + id: { type: :string, format: :uuid, required: true }, + **Swagger::Schema::GROUP + } + + xit + end + regular_api_responses + end + + path '/{slug}/groups/{id}' do + put('update group') do + tags 'Groups' + consumes 'application/json' + produces 'application/json' + parameter Swagger::Schema::SLUG + parameter name: :id, in: :path, type: :string, format: :uuid + parameter name: :body, in: :body, schema: { + type: :object, + required: %i[group], + properties: { + group: { + type: :object, + required: %i[name], + properties: Swagger::Schema::GROUP + } + } + } + response(200, 'updated') do + schema type: :object, properties: { + id: { type: :string, format: :uuid, required: true }, + **Swagger::Schema::GROUP + } + + xit + end + regular_api_responses + end + + delete('delete group') do + tags 'Groups' + produces 'application/json' + parameter Swagger::Schema::SLUG + parameter name: :id, in: :path, type: :string, format: :uuid + + response_empty_200 + regular_api_responses + end + end end end diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index e1f7b43..e8e8e9b 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -4,10 +4,16 @@ module Swagger module Schema USER = { id: { type: :string, format: :uuid }, - email: { type: :string, format: :email }, - created_at: SwaggerResponseHelper::TIMESTAMP, - updated_at: SwaggerResponseHelper::TIMESTAMP - + email: { type: :string, format: :email }, + created_at: SwaggerResponseHelper::TIMESTAMP, + updated_at: SwaggerResponseHelper::TIMESTAMP + } + + GROUP = { + name: { type: :string }, + icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' }, + parent_id: { type: :string, format: :uuid }, + color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' } } SLUG = { From 20127398c643dd6f8a5ed2a3e6759b3a2f7d8e41 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 8 Dec 2024 11:39:50 +0100 Subject: [PATCH 206/283] Fix summary query to leverage ActsAsTenant scopes --- Gemfile | 1 + Gemfile.lock | 4 ++++ app/queries/groups/summary_query.rb | 36 +++++++++++------------------ 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/Gemfile b/Gemfile index e7c867a..0a618dd 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,7 @@ gem 'rubytree' gem 'acts_as_tenant' gem 'httparty' gem 'rswag' +gem 'pluck_to_hash' group :development, :test do gem 'annotaterb' diff --git a/Gemfile.lock b/Gemfile.lock index dde22ed..854d1cd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -222,6 +222,9 @@ GEM ast (~> 2.4.1) racc pg (1.5.9) + pluck_to_hash (1.0.2) + activerecord (>= 4.0.2) + activesupport (>= 4.0.2) pry (0.15.0) coderay (~> 1.1) method_source (~> 1.0) @@ -413,6 +416,7 @@ DEPENDENCIES license_finder money pg (~> 1.1) + pluck_to_hash pry puma (>= 5.0) rack-cors diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb index 70fc234..0736496 100644 --- a/app/queries/groups/summary_query.rb +++ b/app/queries/groups/summary_query.rb @@ -3,29 +3,19 @@ module Groups class SummaryQuery def call - ActiveRecord::Base.connection.execute(query).to_a - end - - private - - def query - <<~SQL.squish - SELECT - groups.id, - groups.name, - groups.icon, - groups.parent_id, - groups.color, - count(*) filter (where status IS NOT NULL) as total, - count(*) filter (where status = 0) as considered, - count(*) filter (where status = 10) as invited, - count(*) filter (where status = 20) as confirmed, - count(*) filter (where status = 30) as declined, - count(*) filter (where status = 40) as tentative - FROM groups - LEFT JOIN guests on groups.id = guests.group_id - GROUP BY groups.id - SQL + Group.left_joins(:guests).group(:id).pluck_to_hash( + :id, + :name, + :icon, + :parent_id, + :color, + Arel.sql('count(*) filter (where status IS NOT NULL) as total'), + Arel.sql('count(*) filter (where status = 0) as considered'), + Arel.sql('count(*) filter (where status = 10) as invited'), + Arel.sql('count(*) filter (where status = 20) as confirmed'), + Arel.sql('count(*) filter (where status = 30) as declined'), + Arel.sql('count(*) filter (where status = 40) as tentative'), + ) end end end From 9f0773647f115cf2b875b6f2f93211dbf0f686c6 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 8 Dec 2024 10:41:24 +0000 Subject: [PATCH 207/283] Add copyright notice --- db/migrate/20241208102932_allow_ungrouped_guests.rb | 2 ++ db/schema.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/db/migrate/20241208102932_allow_ungrouped_guests.rb b/db/migrate/20241208102932_allow_ungrouped_guests.rb index e4bb19a..c06d40c 100644 --- a/db/migrate/20241208102932_allow_ungrouped_guests.rb +++ b/db/migrate/20241208102932_allow_ungrouped_guests.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class AllowUngroupedGuests < ActiveRecord::Migration[8.0] def change change_column_null :guests, :group_id, true diff --git a/db/schema.rb b/db/schema.rb index e8f6c9f..0684e19 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From 83e36df14eca044af79e8b714749cfe1cf534881 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 8 Dec 2024 13:10:49 +0100 Subject: [PATCH 208/283] Allow the creation of guests associated to no group --- app/controllers/guests_controller.rb | 2 +- app/models/guest.rb | 2 +- spec/models/guest_spec.rb | 2 +- spec/requests/guests_spec.rb | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index a302541..54975b6 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -5,7 +5,7 @@ require 'csv' class GuestsController < ApplicationController def index render json: Guest.all.includes(:group) - .joins(:group) + .left_joins(:group) .order('groups.name' => :asc, name: :asc) .as_json(only: %i[id name status], include: { group: { only: %i[id name] } }) end diff --git a/app/models/guest.rb b/app/models/guest.rb index a418a27..a0a2992 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -25,7 +25,7 @@ # class Guest < ApplicationRecord acts_as_tenant :wedding - belongs_to :group + belongs_to :group, optional: true enum :status, { considered: 0, diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index b484464..6786271 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -16,7 +16,7 @@ RSpec.describe Guest, type: :model do end end - it { should belong_to(:group) } + it { should belong_to(:group).optional } describe 'scopes' do describe '.potential' do diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index 9b542fd..bc73fbe 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -41,7 +41,7 @@ RSpec.describe 'guests', type: :request do properties: { guest: { type: :object, - required: %i[name group_id status], + required: %i[name status], properties: { name: { type: :string }, group_id: { type: :string, format: :uuid }, @@ -70,6 +70,7 @@ RSpec.describe 'guests', type: :request do properties: { guest: { type: :object, + required: %i[name status], properties: { name: { type: :string }, group_id: { type: :string, format: :uuid }, From 9d90ade40c8c63a958d456fec89037efa281e99a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 8 Dec 2024 14:00:53 +0100 Subject: [PATCH 209/283] Document tables arrangements controller --- spec/requests/schemas.rb | 7 +++ spec/requests/tables_arrangements_spec.rb | 59 +++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 spec/requests/tables_arrangements_spec.rb diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index e8e8e9b..30a9b58 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -9,6 +9,13 @@ module Swagger updated_at: SwaggerResponseHelper::TIMESTAMP } + ID = { + name: 'id', + in: :path, + type: :string, + format: :uuid, + } + GROUP = { name: { type: :string }, icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' }, diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb new file mode 100644 index 0000000..2230d0c --- /dev/null +++ b/spec/requests/tables_arrangements_spec.rb @@ -0,0 +1,59 @@ +require 'swagger_helper' + +RSpec.describe 'tables_arrangements', type: :request do + + path '/{slug}/tables_arrangements' do + get('list tables arrangements') do + tags 'Tables Arrangements' + produces 'application/json' + parameter Swagger::Schema::SLUG + response(200, 'successful') do + schema type: :array, + items: { + type: :object, + required: %i[id name discomfort], + properties: { + id: { type: :string, format: :uuid }, + name: { type: :string }, + discomfort: { type: :integer } + } + } + xit + end + regular_api_responses + end + end + + path '/{slug}/tables_arrangements/{id}' do + get('show tables arrangement') do + tags 'Tables Arrangements' + produces 'application/json' + parameter Swagger::Schema::SLUG + parameter Swagger::Schema::ID + response(200, 'successful') do + schema type: :array, + items: { + type: :object, + required: %i[number guests], + properties: { + number: { type: :integer }, + guests: { + type: :array, + items: { + type: :object, + required: %i[id name color], + properties: { + id: { type: :string, format: :uuid }, + name: { type: :string }, + color: { type: :string } + } + } + } + } + } + xit + end + regular_api_responses + end + end +end From 5cbc81c4982f8d1fd513d861d95522af09d0ca7e Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 8 Dec 2024 13:02:08 +0000 Subject: [PATCH 210/283] Add copyright notice --- spec/requests/tables_arrangements_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index 2230d0c..1581d9a 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'tables_arrangements', type: :request do From dfb50ed2dcfa74b60188645ff4bf2a0b2e4754ca Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 9 Dec 2024 18:14:21 +0100 Subject: [PATCH 211/283] Avoid stack too deep erros due to excessive recursion --- app/services/vns/engine.rb | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index f4041c6..ee50d45 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -29,7 +29,7 @@ module VNS @best_score = @target_function.call(@best_solution) self.class.sequence(@perturbations).each do |perturbation| - optimize(perturbation.new(@best_solution)) + optimize(perturbation) end @best_solution @@ -37,15 +37,22 @@ module VNS private - def optimize(perturbation) - perturbation.each do |alternative_solution| - score = @target_function.call(alternative_solution) - next if score >= @best_score + def optimize(perturbation_klass) + loop do + optimized = false - @best_solution = alternative_solution.deep_dup - @best_score = score + perturbation_klass.new(@best_solution).each do |alternative_solution| + score = @target_function.call(alternative_solution) + next if score >= @best_score - return optimize(perturbation.class.new(@best_solution)) + @best_solution = alternative_solution.deep_dup + @best_score = score + optimized = true + + break + end + + return unless optimized end end end From e8543d8fb41189d447c5ab623981830f3cf11c42 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 9 Dec 2024 18:25:47 +0100 Subject: [PATCH 212/283] Configure librecaptcha configuration for the development environment --- docker-compose.yml | 1 + libre-captcha-config.json | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 libre-captcha-config.json diff --git a/docker-compose.yml b/docker-compose.yml index 64b54c7..df2c035 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -40,6 +40,7 @@ services: image: librecaptcha/lc-core:latest volumes: - "./tmp/libre-captcha-data:/lc-core/data" + - "./libre-captcha-config.json:/lc-core/data/config.json" ports: - 8888 nginx: diff --git a/libre-captcha-config.json b/libre-captcha-config.json new file mode 100644 index 0000000..c9b5d67 --- /dev/null +++ b/libre-captcha-config.json @@ -0,0 +1,29 @@ +{ + "randomSeed": -1534087241, + "port": 8888, + "address": "0.0.0.0", + "captchaExpiryTimeLimit": 5, + "bufferCount": 1000, + "threadDelay": 2, + "playgroundEnabled": false, + "corsHeader": "", + "maxAttemptsRatio": 0.009999999776482582, + "captchas": [ + { + "name": "FilterChallenge", + "allowedLevels": [ + "hard" + ], + "allowedMedia": [ + "image/png" + ], + "allowedInputType": [ + "text" + ], + "allowedSizes": [ + "350x100" + ], + "config": {} + } + ] +} \ No newline at end of file From be40c97f2f0b80faf764f903b0d9f6c81b2d5f2a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 9 Dec 2024 19:28:32 +0100 Subject: [PATCH 213/283] Define and document CRUD endpoints for expenses --- app/controllers/expenses_controller.rb | 10 ++++++ config/routes.rb | 2 +- spec/requests/expenses_spec.rb | 43 ++++++++++++++++++++------ spec/requests/schemas.rb | 6 ++++ 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 297fa80..2a125d9 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -9,11 +9,21 @@ class ExpensesController < ApplicationController render json: Expense.all.order(pricing_type: :asc, amount: :desc).as_json(only: %i[id name amount pricing_type]) end + def create + Expense.create!(expense_params) + render json: {}, status: :created + end + def update Expense.find(params[:id]).update!(expense_params) render json: {}, status: :ok end + def destroy + Expense.find(params[:id]).destroy! + render json: {}, status: :ok + end + private def expense_params diff --git a/config/routes.rb b/config/routes.rb index 5e88161..6b88b41 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -27,7 +27,7 @@ Rails.application.routes.draw do resources :guests, only: %i[index create update destroy] do post :bulk_update, on: :collection end - resources :expenses, only: %i[index update] do + resources :expenses, only: %i[index create update destroy] do get :summary, on: :collection end resources :tables_arrangements, only: %i[index show] diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index 74cf861..068fec5 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -16,9 +16,7 @@ RSpec.describe 'expenses', type: :request do required: %i[id name amount pricing_type], properties: { id: { type: :string, format: :uuid }, - name: { type: :string }, - amount: { type: :number }, - pricing_type: { type: :string, enum: Expense.pricing_types.keys } + **Swagger::Schema::EXPENSE } } @@ -26,10 +24,31 @@ RSpec.describe 'expenses', type: :request do end regular_api_responses end + + post 'create expense' do + tags 'Expenses' + consumes 'application/json' + produces 'application/json' + parameter Swagger::Schema::SLUG + parameter name: :body, in: :body, schema: { + type: :object, + required: %i[expense], + properties: { + expense: { + type: :object, + required: %i[name amount pricing_type], + properties: Swagger::Schema::EXPENSE + } + } + } + + response_empty_201 + response_422 + regular_api_responses + end end path '/{slug}/expenses/{id}' do - patch('update expense') do tags 'Expenses' consumes 'application/json' @@ -38,11 +57,7 @@ RSpec.describe 'expenses', type: :request do parameter name: 'id', in: :path, type: :string, format: :uuid, description: 'id' parameter name: :body, in: :body, schema: { type: :object, - properties: { - name: { type: :string }, - amount: { type: :number, minimum: 0 }, - pricing_type: { type: :string, enum: Expense.pricing_types.keys } - } + properties: Swagger::Schema::EXPENSE } response_empty_200 @@ -50,5 +65,15 @@ RSpec.describe 'expenses', type: :request do response_404 regular_api_responses end + + delete('delete expense') do + tags 'Expenses' + produces 'application/json' + parameter Swagger::Schema::SLUG + parameter Swagger::Schema::ID + response_empty_200 + response_404 + regular_api_responses + end end end diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index 30a9b58..eb51216 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -23,6 +23,12 @@ module Swagger color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' } } + EXPENSE = { + name: { type: :string }, + amount: { type: :number, minimum: 0 }, + pricing_type: { type: :string, enum: Expense.pricing_types.keys } + } + SLUG = { name: 'slug', in: :path, From 98c1c0d18c21fb57096cf8bf58ba1d15822ade36 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 10 Dec 2024 08:41:10 +0100 Subject: [PATCH 214/283] Group attendance properties into a json key --- app/controllers/groups_controller.rb | 13 +++++++++- spec/requests/groups_spec.rb | 38 ++++++++++++++++------------ 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index f04e394..f53ed35 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -2,7 +2,18 @@ class GroupsController < ApplicationController def index - render json: Groups::SummaryQuery.new.call.as_json + query_result = Groups::SummaryQuery.new.call.as_json.map(&:deep_symbolize_keys).map do |group| + { + id: group[:id], + name: group[:name], + icon: group[:icon], + color: group[:color], + parent_id: group[:parent_id], + attendance: group.slice(:total, :considered, :invited, :confirmed, :declined, :tentative) + } + end + + render json: query_result end def create diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index 44f755b..bc6267b 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -10,23 +10,29 @@ RSpec.describe 'groups', type: :request do parameter Swagger::Schema::SLUG response(200, 'successful') do schema type: :array, - items: { - type: :object, - required: %i[id name icon parent_id color total considered invited confirmed declined tentative], - properties: { - id: { type: :string, format: :uuid, required: true }, - name: { type: :string }, - icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' }, - parent_id: { type: :string, format: :uuid }, - color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' }, - total: { type: :integer, minimum: 0, description: 'Total number of guests in any status' }, - considered: { type: :integer, minimum: 0 }, - invited: { type: :integer, minimum: 0 }, - confirmed: { type: :integer, minimum: 0 }, - declined: { type: :integer, minimum: 0 }, - tentative: { type: :integer, minimum: 0 } + items: { + type: :object, + required: %i[id name icon parent_id color attendance], + properties: { + id: { type: :string, format: :uuid, required: true }, + name: { type: :string }, + icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' }, + parent_id: { type: :string, format: :uuid }, + color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' }, + attendance: { + type: :object, + required: %i[total considered invited confirmed declined tentative], + properties: { + total: { type: :integer, minimum: 0, description: 'Total number of guests in any status' }, + considered: { type: :integer, minimum: 0 }, + invited: { type: :integer, minimum: 0 }, + confirmed: { type: :integer, minimum: 0 }, + declined: { type: :integer, minimum: 0 }, + tentative: { type: :integer, minimum: 0 } + } + } + } } - } xit end regular_api_responses From d18adb2806f5dba0495a0c5f4bc4bd2bec381475 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 11 Dec 2024 01:08:44 +0000 Subject: [PATCH 215/283] Update dependency rails to v8.0.0.1 --- Gemfile.lock | 106 +++++++++++++++++++++++++-------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 854d1cd..70c552e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,29 +1,29 @@ GEM remote: https://rubygems.org/ specs: - actioncable (8.0.0) - actionpack (= 8.0.0) - activesupport (= 8.0.0) + actioncable (8.0.0.1) + actionpack (= 8.0.0.1) + activesupport (= 8.0.0.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (8.0.0) - actionpack (= 8.0.0) - activejob (= 8.0.0) - activerecord (= 8.0.0) - activestorage (= 8.0.0) - activesupport (= 8.0.0) + actionmailbox (8.0.0.1) + actionpack (= 8.0.0.1) + activejob (= 8.0.0.1) + activerecord (= 8.0.0.1) + activestorage (= 8.0.0.1) + activesupport (= 8.0.0.1) mail (>= 2.8.0) - actionmailer (8.0.0) - actionpack (= 8.0.0) - actionview (= 8.0.0) - activejob (= 8.0.0) - activesupport (= 8.0.0) + actionmailer (8.0.0.1) + actionpack (= 8.0.0.1) + actionview (= 8.0.0.1) + activejob (= 8.0.0.1) + activesupport (= 8.0.0.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (8.0.0) - actionview (= 8.0.0) - activesupport (= 8.0.0) + actionpack (8.0.0.1) + actionview (= 8.0.0.1) + activesupport (= 8.0.0.1) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) @@ -31,35 +31,35 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (8.0.0) - actionpack (= 8.0.0) - activerecord (= 8.0.0) - activestorage (= 8.0.0) - activesupport (= 8.0.0) + actiontext (8.0.0.1) + actionpack (= 8.0.0.1) + activerecord (= 8.0.0.1) + activestorage (= 8.0.0.1) + activesupport (= 8.0.0.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (8.0.0) - activesupport (= 8.0.0) + actionview (8.0.0.1) + activesupport (= 8.0.0.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (8.0.0) - activesupport (= 8.0.0) + activejob (8.0.0.1) + activesupport (= 8.0.0.1) globalid (>= 0.3.6) - activemodel (8.0.0) - activesupport (= 8.0.0) - activerecord (8.0.0) - activemodel (= 8.0.0) - activesupport (= 8.0.0) + activemodel (8.0.0.1) + activesupport (= 8.0.0.1) + activerecord (8.0.0.1) + activemodel (= 8.0.0.1) + activesupport (= 8.0.0.1) timeout (>= 0.4.0) - activestorage (8.0.0) - actionpack (= 8.0.0) - activejob (= 8.0.0) - activerecord (= 8.0.0) - activesupport (= 8.0.0) + activestorage (8.0.0.1) + actionpack (= 8.0.0.1) + activejob (= 8.0.0.1) + activerecord (= 8.0.0.1) + activesupport (= 8.0.0.1) marcel (~> 1.0) - activesupport (8.0.0) + activesupport (8.0.0.1) base64 benchmark (>= 0.3) bigdecimal @@ -245,20 +245,20 @@ GEM rack (>= 1.3) rackup (2.2.1) rack (>= 3) - rails (8.0.0) - actioncable (= 8.0.0) - actionmailbox (= 8.0.0) - actionmailer (= 8.0.0) - actionpack (= 8.0.0) - actiontext (= 8.0.0) - actionview (= 8.0.0) - activejob (= 8.0.0) - activemodel (= 8.0.0) - activerecord (= 8.0.0) - activestorage (= 8.0.0) - activesupport (= 8.0.0) + rails (8.0.0.1) + actioncable (= 8.0.0.1) + actionmailbox (= 8.0.0.1) + actionmailer (= 8.0.0.1) + actionpack (= 8.0.0.1) + actiontext (= 8.0.0.1) + actionview (= 8.0.0.1) + activejob (= 8.0.0.1) + activemodel (= 8.0.0.1) + activerecord (= 8.0.0.1) + activestorage (= 8.0.0.1) + activesupport (= 8.0.0.1) bundler (>= 1.15.0) - railties (= 8.0.0) + railties (= 8.0.0.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -266,9 +266,9 @@ GEM rails-html-sanitizer (1.6.1) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - railties (8.0.0) - actionpack (= 8.0.0) - activesupport (= 8.0.0) + railties (8.0.0.1) + actionpack (= 8.0.0.1) + activesupport (= 8.0.0.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) From da8f3c7618793676acc50373157982875a9c8ef1 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Wed, 11 Dec 2024 09:00:45 +0100 Subject: [PATCH 216/283] Define an endpoint with a global summary of expenses and attendance --- app/controllers/summary_controller.rb | 27 +++++++ app/queries/expenses/total_query.rb | 36 ++++----- config/routes.rb | 1 + spec/queries/expenses/total_query_spec.rb | 98 +++++++++-------------- spec/requests/summary_spec.rb | 59 ++++++++++++++ 5 files changed, 143 insertions(+), 78 deletions(-) create mode 100644 app/controllers/summary_controller.rb create mode 100644 spec/requests/summary_spec.rb diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb new file mode 100644 index 0000000..83cfea8 --- /dev/null +++ b/app/controllers/summary_controller.rb @@ -0,0 +1,27 @@ +class SummaryController < ApplicationController + def index + expense_summary = Expenses::TotalQuery.new(wedding: ActsAsTenant.current_tenant).call + render json: { + expenses: { + projected: { + total: expense_summary['total_projected'], + guests: expense_summary['projected_guests'] + }, + confirmed: { + total: expense_summary['total_confirmed'], + guests: expense_summary['confirmed_guests'] + }, + status: { + paid: 0 + } + }, + guests: { + total: 200, + confirmed: 100, + declined: 50, + tentative: 25, + invited: 25 + } + } + end +end diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index 5ed4ca9..7dc47d6 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -2,8 +2,15 @@ module Expenses class TotalQuery + private attr_reader :wedding + def initialize(wedding:) + @wedding = wedding + end + def call - ActiveRecord::Base.connection.execute(query).first + ActiveRecord::Base.connection.execute( + ActiveRecord::Base.sanitize_sql_array([query, { wedding_id: wedding.id }]) + ).first end private @@ -12,16 +19,10 @@ module Expenses <<~SQL WITH guest_count AS (#{guest_count_per_status}), expense_summary AS (#{expense_summary}) - SELECT expense_summary.fixed, - expense_summary.fixed_count, - expense_summary.variable, - expense_summary.variable_count, - expense_summary.total_count, - guest_count.confirmed as confirmed_guests, - guest_count.projected as projected_guests, - expense_summary.fixed + expense_summary.variable * guest_count.confirmed as total, - expense_summary.fixed + expense_summary.variable * guest_count.projected as max_projected, - (expense_summary.fixed + expense_summary.variable * guest_count.confirmed) / guest_count.confirmed as per_person + SELECT guest_count.confirmed as confirmed_guests, + guest_count.projected as projected_guests, + expense_summary.fixed + expense_summary.variable * guest_count.confirmed as total_confirmed, + expense_summary.fixed + expense_summary.variable * guest_count.projected as total_projected FROM guest_count, expense_summary; SQL end @@ -29,20 +30,19 @@ module Expenses def expense_summary <<~SQL SELECT coalesce(sum(amount) filter (where pricing_type = 'fixed'), 0) as fixed, - coalesce(count(amount) filter (where pricing_type = 'fixed'), 0) as fixed_count, - coalesce(sum(amount) filter (where pricing_type = 'per_person'), 0) as variable, - coalesce(count(amount) filter (where pricing_type = 'per_person'), 0) as variable_count, - count(*) as total_count + coalesce(sum(amount) filter (where pricing_type = 'per_person'), 0) as variable FROM expenses + WHERE wedding_id = :wedding_id SQL end def guest_count_per_status <<~SQL - SELECT COALESCE(count(*) filter(where status = #{Guest.statuses["confirmed"]}), 0) as confirmed, - COALESCE(count(*) filter(where status IN (#{Guest.statuses.values_at("confirmed", "invited", "tentative").join(",")})), 0) as projected + SELECT COALESCE(count(*) filter(where status = #{Guest.statuses['confirmed']}), 0) as confirmed, + COALESCE(count(*) filter(where status IN (#{Guest.statuses.values_at('confirmed', 'invited', 'tentative').join(',')})), 0) as projected FROM guests + WHERE wedding_id = :wedding_id SQL end end -end \ No newline at end of file +end diff --git a/config/routes.rb b/config/routes.rb index 6b88b41..c3bc335 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,6 +31,7 @@ Rails.application.routes.draw do get :summary, on: :collection end resources :tables_arrangements, only: %i[index show] + resources :summary, only: :index root to: redirect("/%{slug}") end diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index 46cffdf..f721844 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -5,88 +5,66 @@ require 'rails_helper' module Expenses RSpec.describe TotalQuery do describe '#call' do - let(:response) { described_class.new.call } + let(:wedding) { create(:wedding) } + let(:response) { described_class.new(wedding:).call } before do - create_list(:guest, 2, status: :confirmed) - create_list(:guest, 3, status: :considered) - create_list(:guest, 4, status: :invited) - create_list(:guest, 5, status: :tentative) - create_list(:guest, 6, status: :declined) + create_list(:guest, 2, wedding:, status: :confirmed) + create_list(:guest, 3, wedding:, status: :considered) + create_list(:guest, 4, wedding:, status: :invited) + create_list(:guest, 5, wedding:, status: :tentative) + create_list(:guest, 6, wedding:, status: :declined) end - context "when there is no expense" do - it "returns zero in all values", :aggregate_failures do - expect(response["fixed"]).to be_zero - expect(response["fixed_count"]).to be_zero - expect(response["variable"]).to be_zero - expect(response["variable_count"]).to be_zero - expect(response["total"]).to be_zero - expect(response["total_count"]).to be_zero - expect(response["max_projected"]).to be_zero - expect(response["per_person"]).to be_zero - expect(response["confirmed_guests"]).to eq(2) - expect(response["projected_guests"]).to eq(2 + 4 + 5) + context 'when there is no expense' do + it 'returns zero in all values', :aggregate_failures do + expect(response['total_confirmed']).to be_zero + expect(response['total_projected']).to be_zero + expect(response['confirmed_guests']).to eq(2) + expect(response['projected_guests']).to eq(2 + 4 + 5) end end - context "when there are only fixed expenses" do + context 'when there are only fixed expenses' do before do - create(:expense, :fixed, amount: 100) - create(:expense, :fixed, amount: 200) + create(:expense, :fixed, wedding:, amount: 100) + create(:expense, :fixed, wedding:, amount: 200) end - it "returns the sum of fixed expenses", :aggregate_failures do - expect(response["fixed"]).to eq(300) - expect(response["fixed_count"]).to eq(2) - expect(response["variable"]).to be_zero - expect(response["variable_count"]).to be_zero - expect(response["total"]).to eq(300) - expect(response["total_count"]).to eq(2) - expect(response["max_projected"]).to eq(300) - expect(response["per_person"]).to eq(150) - expect(response["confirmed_guests"]).to eq(2) - expect(response["projected_guests"]).to eq(2 + 4 + 5) + it 'returns the sum of fixed expenses', :aggregate_failures do + expect(response['total_confirmed']).to eq(300) + expect(response['total_projected']).to eq(300) + expect(response['confirmed_guests']).to eq(2) + expect(response['projected_guests']).to eq(2 + 4 + 5) end end - context "when there are only variable expenses" do + context 'when there are only variable expenses' do before do - create(:expense, :per_person, amount: 100) - create(:expense, :per_person, amount: 200) + create(:expense, :per_person, wedding:, amount: 100) + create(:expense, :per_person, wedding:, amount: 200) end - it "returns zero in the values and nonzero in the count", :aggregate_failures do - expect(response["fixed"]).to be_zero - expect(response["fixed_count"]).to be_zero - expect(response["variable"]).to eq(300) - expect(response["variable_count"]).to eq(2) - expect(response["total"]).to eq(2*300) - expect(response["total_count"]).to eq(2) - expect(response["max_projected"]).to eq(11*300) - expect(response["confirmed_guests"]).to eq(2) - expect(response["projected_guests"]).to eq(2 + 4 + 5) + it 'returns zero in the values and nonzero in the count', :aggregate_failures do + expect(response['total_confirmed']).to eq(2 * 300) + expect(response['total_projected']).to eq(11 * 300) + expect(response['confirmed_guests']).to eq(2) + expect(response['projected_guests']).to eq(2 + 4 + 5) end end - context "when there are both fixed and variable expenses" do + context 'when there are both fixed and variable expenses' do before do - create(:expense, :fixed, amount: 100) - create(:expense, :fixed, amount: 200) - create(:expense, :per_person, amount: 50) + create(:expense, :fixed, wedding:, amount: 100) + create(:expense, :fixed, wedding:, amount: 200) + create(:expense, :per_person, wedding:, amount: 50) end - it "returns the sum of fixed and variable expenses", :aggregate_failures do - expect(response["fixed"]).to eq(300) - expect(response["fixed_count"]).to eq(2) - expect(response["variable"]).to eq(50) - expect(response["variable_count"]).to eq(1) - expect(response["total"]).to eq(100 + 200 + 50 * 2) - expect(response["total_count"]).to eq(3) - expect(response["max_projected"]).to eq(100 + 200 + 11*50) - expect(response["per_person"]).to eq(200) - expect(response["confirmed_guests"]).to eq(2) - expect(response["projected_guests"]).to eq(2 + 4 + 5) + it 'returns the sum of fixed and variable expenses', :aggregate_failures do + expect(response['total_confirmed']).to eq(100 + 200 + 50 * 2) + expect(response['total_projected']).to eq(100 + 200 + 11 * 50) + expect(response['confirmed_guests']).to eq(2) + expect(response['projected_guests']).to eq(2 + 4 + 5) end end end diff --git a/spec/requests/summary_spec.rb b/spec/requests/summary_spec.rb new file mode 100644 index 0000000..0b3cc3a --- /dev/null +++ b/spec/requests/summary_spec.rb @@ -0,0 +1,59 @@ +require 'swagger_helper' + +RSpec.describe 'summary', type: :request do + path '/{slug}/summary' do + get('list summaries') do + tags 'Summary' + produces 'application/json' + consumes 'application/json' + parameter Swagger::Schema::SLUG + response(200, 'successful') do + schema type: :object, + required: %i[expenses guests], + properties: { + expenses: { + type: :object, + required: %i[projected confirmed status], + properties: { + projected: { + type: :object, + required: %i[total guests], + properties: { + total: { type: :number }, + guests: { type: :number } + } + }, + confirmed: { + type: :object, + required: %i[total guests], + properties: { + total: { type: :number }, + guests: { type: :number } + } + }, + status: { + type: :object, + required: [:paid], + properties: { + paid: { type: :number } + } + } + } + }, + guests: { + type: :object, + required: %i[total confirmed declined tentative invited], + properties: { + total: { type: :number }, + confirmed: { type: :number }, + declined: { type: :number }, + tentative: { type: :number }, + invited: { type: :number } + } + } + } + xit + end + end + end +end From f68caca5a477624e44bbcff224878dcef27b24fa Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Wed, 11 Dec 2024 08:03:02 +0000 Subject: [PATCH 217/283] Add copyright notice --- app/controllers/summary_controller.rb | 2 ++ spec/requests/summary_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb index 83cfea8..f6f3daa 100644 --- a/app/controllers/summary_controller.rb +++ b/app/controllers/summary_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class SummaryController < ApplicationController def index expense_summary = Expenses::TotalQuery.new(wedding: ActsAsTenant.current_tenant).call diff --git a/spec/requests/summary_spec.rb b/spec/requests/summary_spec.rb index 0b3cc3a..2b77892 100644 --- a/spec/requests/summary_spec.rb +++ b/spec/requests/summary_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + require 'swagger_helper' RSpec.describe 'summary', type: :request do From 4e61ee2f22acc8cb0c231c16a0628c132c7ab7ec Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Wed, 11 Dec 2024 23:42:18 +0100 Subject: [PATCH 218/283] Include real data in the guests summary of the dashboard --- app/controllers/summary_controller.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb index f6f3daa..55983dc 100644 --- a/app/controllers/summary_controller.rb +++ b/app/controllers/summary_controller.rb @@ -3,6 +3,7 @@ class SummaryController < ApplicationController def index expense_summary = Expenses::TotalQuery.new(wedding: ActsAsTenant.current_tenant).call + guest_summary = Guest.group(:status).count render json: { expenses: { projected: { @@ -18,11 +19,11 @@ class SummaryController < ApplicationController } }, guests: { - total: 200, - confirmed: 100, - declined: 50, - tentative: 25, - invited: 25 + total: guest_summary.except('considered').values.sum, + confirmed: guest_summary['confirmed'].to_i, + declined: guest_summary['declined'].to_i, + tentative: guest_summary['tentative'].to_i, + invited: guest_summary['invited'].to_i } } end From 998706da97f0491b5355fdeed3dbdf62b7bb70a4 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 15 Dec 2024 01:17:10 +0000 Subject: [PATCH 219/283] Update dependency factory_bot_rails to v6.4.4 --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 70c552e..7dedae8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -137,7 +137,7 @@ GEM activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.8.0) - irb (1.14.1) + irb (1.14.2) rdoc (>= 4.0.0) reline (>= 0.4.2) jbuilder (2.13.0) @@ -176,7 +176,7 @@ GEM tomlrb (>= 1.3, < 2.1) with_env (= 1.1.0) xml-simple (~> 1.1.9) - logger (1.6.2) + logger (1.6.3) loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -263,7 +263,7 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.1) + rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) railties (8.0.0.1) From e44043f5726a6c2fdcad5fc097f22653e69c0fe7 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 15 Dec 2024 01:18:43 +0000 Subject: [PATCH 220/283] Update dependency rubocop to v1.69.2 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7dedae8..0ae293a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -327,7 +327,7 @@ GEM rswag-ui (2.16.0) actionpack (>= 5.2, < 8.1) railties (>= 5.2, < 8.1) - rubocop (1.69.1) + rubocop (1.69.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) From 3bfe88974729c800e0847dac13f427a5082171f5 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 16 Dec 2024 18:52:34 +0100 Subject: [PATCH 221/283] Redo TablesArrangements#show to display arrangement ID and discomfort breakdown --- .../tables_arrangements_controller.rb | 41 +++++++++----- app/jobs/table_simulator_job.rb | 5 +- app/services/tables/discomfort_calculator.rb | 12 ++++- spec/requests/tables_arrangements_spec.rb | 54 +++++++++++++------ .../tables/discomfort_calculator_spec.rb | 31 +++++------ 5 files changed, 96 insertions(+), 47 deletions(-) diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index 87bcc4c..00ba8b1 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -6,18 +6,33 @@ class TablesArrangementsController < ApplicationController end def show - Seat.joins(guest: :group) - .where(tables_arrangement_id: params[:id]) - .order('guests.group_id') - .pluck( - :table_number, - 'guests.name', - 'guests.id', - 'groups.color' - ) - .group_by(&:first) - .transform_values { |table| table.map { |(_, name, id, color)| { id:, name:, color: } } } - .map { |number, guests| { number:, guests: } } - .then { |result| render json: result } + Guest.joins(:seats, :group) + .where(seats: { tables_arrangement_id: params[:id] }) + .select('guests.*', 'groups.color', 'seats.table_number') + .group_by(&:table_number) + .map { |number, guests| format(number:, guests:) } + .then { |result| render json: { id: params[:id], tables: result } } + end + + private + + def format(number:, guests:) + { + number: number, + discomfort: discomfort(guests: guests), + guests: guests.as_json(only: %i[id name color]) + } + end + + def discomfort(guests:) + table = Tables::Table.new(guests) + + table.min_per_table = TableSimulatorJob::MIN_PER_TABLE + table.max_per_table = TableSimulatorJob::MAX_PER_TABLE + calculator = Tables::DiscomfortCalculator.new(table:) + { + discomfort: calculator.calculate, + breakdown: calculator.breakdown + } end end diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index ced9b2d..7cbe659 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -3,6 +3,9 @@ class TableSimulatorJob < ApplicationJob queue_as :default + MIN_PER_TABLE = 8 + MAX_PER_TABLE = 10 + def perform(wedding_id) ActsAsTenant.with_tenant(Wedding.find(wedding_id)) do engine = VNS::Engine.new @@ -10,7 +13,7 @@ class TableSimulatorJob < ApplicationJob engine.add_perturbation(Tables::Swap) engine.add_perturbation(Tables::Shift) - initial_solution = Tables::Distribution.new(min_per_table: 8, max_per_table: 10) + initial_solution = Tables::Distribution.new(min_per_table: MIN_PER_TABLE, max_per_table: MAX_PER_TABLE) initial_solution.random_distribution(Guest.potential.shuffle) engine.initial_solution = initial_solution diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index c21796a..35da8ce 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -8,7 +8,11 @@ module Tables end def calculate - table_size_penalty + 10 * (cohesion_penalty * 1.0 / table.size) + breakdown.values.sum + end + + def breakdown + @breakdown ||= { table_size_penalty:, cohesion_penalty: } end private @@ -28,6 +32,10 @@ module Tables end end + def cohesion_penalty + 10 * (cohesion_discomfort * 1.0 / table.size) + end + # # Calculates the discomfort of the table based on the cohesion of the guests. The total discomfort # is calculated as the sum of the discomfort of each pair of guests. The discomfort of a pair of @@ -35,7 +43,7 @@ module Tables # # @return [Number] Total discomfort of the table. # - def cohesion_penalty + def cohesion_discomfort table.map(&:group_id).tally.to_a.combination(2).sum do |(a, count_a), (b, count_b)| distance = AffinityGroupsHierarchy.instance.distance(a, b) diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index 1581d9a..c48c127 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -3,7 +3,6 @@ require 'swagger_helper' RSpec.describe 'tables_arrangements', type: :request do - path '/{slug}/tables_arrangements' do get('list tables arrangements') do tags 'Tables Arrangements' @@ -33,21 +32,44 @@ RSpec.describe 'tables_arrangements', type: :request do parameter Swagger::Schema::SLUG parameter Swagger::Schema::ID response(200, 'successful') do - schema type: :array, - items: { - type: :object, - required: %i[number guests], - properties: { - number: { type: :integer }, - guests: { - type: :array, - items: { - type: :object, - required: %i[id name color], - properties: { - id: { type: :string, format: :uuid }, - name: { type: :string }, - color: { type: :string } + schema type: :object, + required: %i[id tables], + properties: { + id: { type: :string, format: :uuid }, + tables: { + + type: :array, + items: { + type: :object, + required: %i[number guests discomfort], + properties: { + number: { type: :integer }, + guests: { + type: :array, + items: { + type: :object, + required: %i[id name color], + properties: { + id: { type: :string, format: :uuid }, + name: { type: :string }, + color: { type: :string } + } + } + }, + discomfort: { + type: :object, + required: %i[discomfort breakdown], + properties: { + discomfort: { type: :number }, + breakdown: { + type: :object, + required: %i[table_size_penalty cohesion_penalty], + properties: { + table_size_penalty: { type: :number }, + cohesion_penalty: { type: :number } + } + } + } } } } diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index 99fb3d0..f5da2d1 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -13,13 +13,14 @@ module Tables describe '#calculate' do before do allow(calculator).to receive(:table_size_penalty).and_return(2) - allow(calculator).to receive(:cohesion_penalty).and_return(3) + allow(calculator).to receive(:cohesion_discomfort).and_return(3) end let(:table) { Table.new(create_list(:guest, 6)) } - it 'returns the sum of the table size penalty and the average cohesion penalty' do - expect(calculator.calculate).to eq(2 + 10 * 3 / 6.0) + it 'returns the sum of the table size penalty and the average cohesion penalty', :aggregate_failures do + expect(calculator.calculate).to eq(7) + expect(calculator.breakdown).to eq(table_size_penalty: 2, cohesion_penalty: 5) end end @@ -71,7 +72,7 @@ module Tables end end - describe '#cohesion_penalty' do + describe '#cohesion_discomfort' do before do # Overridden in each test except trivial cases allow(AffinityGroupsHierarchy.instance).to receive(:distance).and_call_original @@ -91,7 +92,7 @@ module Tables context 'when they belong to the same group' do let(:table) { create_list(:guest, 2, group: family) } - it { expect(calculator.send(:cohesion_penalty)).to eq(0) } + it { expect(calculator.send(:cohesion_discomfort)).to eq(0) } end context 'when they belong to completely unrelated groups' do @@ -101,7 +102,7 @@ module Tables create(:guest, group: friends) ] end - it { expect(calculator.send(:cohesion_penalty)).to eq(1) } + it { expect(calculator.send(:cohesion_discomfort)).to eq(1) } end context 'when they belong to groups at a distance of 1' do @@ -112,7 +113,7 @@ module Tables ] end - it { expect(calculator.send(:cohesion_penalty)).to eq(0.5) } + it { expect(calculator.send(:cohesion_discomfort)).to eq(0.5) } end context 'when they belong to groups at a distance of 2' do @@ -123,7 +124,7 @@ module Tables ] end - it { expect(calculator.send(:cohesion_penalty)).to eq(Rational(2, 3)) } + it { expect(calculator.send(:cohesion_discomfort)).to eq(Rational(2, 3)) } end context 'when they belong to groups at a distance of 3' do @@ -134,7 +135,7 @@ module Tables ] end - it { expect(calculator.send(:cohesion_penalty)).to eq(Rational(3, 4)) } + it { expect(calculator.send(:cohesion_discomfort)).to eq(Rational(3, 4)) } end end @@ -148,7 +149,7 @@ module Tables end it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_penalty)).to eq(1 + Rational(1, 2) + Rational(2, 3)) + expect(calculator.send(:cohesion_discomfort)).to eq(1 + Rational(1, 2) + Rational(2, 3)) end end @@ -163,7 +164,7 @@ module Tables end it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_penalty)) + expect(calculator.send(:cohesion_discomfort)) .to eq(1 + Rational(1, 2) + Rational(2, 3) + Rational(3, 4) + Rational(4, 5) + Rational(5, 6)) end end @@ -177,7 +178,7 @@ module Tables end it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_penalty)).to eq(4) + expect(calculator.send(:cohesion_discomfort)).to eq(4) end end @@ -190,7 +191,7 @@ module Tables end it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_penalty)).to eq(8) + expect(calculator.send(:cohesion_discomfort)).to eq(8) end end @@ -204,7 +205,7 @@ module Tables end it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_penalty)).to eq(4 * 1 + 4 * Rational(1, 2) + 4 * Rational(2, 3)) + expect(calculator.send(:cohesion_discomfort)).to eq(4 * 1 + 4 * Rational(1, 2) + 4 * Rational(2, 3)) end end @@ -218,7 +219,7 @@ module Tables end it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_penalty)).to eq(6 * 1 + 2 * Rational(1, 2) + 3 * Rational(2, 3)) + expect(calculator.send(:cohesion_discomfort)).to eq(6 * 1 + 2 * Rational(1, 2) + 3 * Rational(2, 3)) end end end From f1ff39ceb1591e9b2e1aa19033fd51fd376f5c3c Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 17 Dec 2024 01:05:02 +0000 Subject: [PATCH 222/283] Update dependency csv to v3.3.1 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0ae293a..048308e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,7 +97,7 @@ GEM concurrent-ruby (1.3.4) connection_pool (2.4.1) crass (1.0.6) - csv (3.3.0) + csv (3.3.1) date (3.4.1) debug (1.9.2) irb (~> 1.10) From 511273280f87b604c3e2b4244eafaebd2d12447a Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 17 Dec 2024 01:05:31 +0000 Subject: [PATCH 223/283] Update dependency rails to v8.0.1 --- Gemfile.lock | 112 +++++++++++++++++++++++++-------------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 048308e..aead3ed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,29 +1,29 @@ GEM remote: https://rubygems.org/ specs: - actioncable (8.0.0.1) - actionpack (= 8.0.0.1) - activesupport (= 8.0.0.1) + actioncable (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (8.0.0.1) - actionpack (= 8.0.0.1) - activejob (= 8.0.0.1) - activerecord (= 8.0.0.1) - activestorage (= 8.0.0.1) - activesupport (= 8.0.0.1) + actionmailbox (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) mail (>= 2.8.0) - actionmailer (8.0.0.1) - actionpack (= 8.0.0.1) - actionview (= 8.0.0.1) - activejob (= 8.0.0.1) - activesupport (= 8.0.0.1) + actionmailer (8.0.1) + actionpack (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activesupport (= 8.0.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (8.0.0.1) - actionview (= 8.0.0.1) - activesupport (= 8.0.0.1) + actionpack (8.0.1) + actionview (= 8.0.1) + activesupport (= 8.0.1) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) @@ -31,35 +31,35 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (8.0.0.1) - actionpack (= 8.0.0.1) - activerecord (= 8.0.0.1) - activestorage (= 8.0.0.1) - activesupport (= 8.0.0.1) + actiontext (8.0.1) + actionpack (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (8.0.0.1) - activesupport (= 8.0.0.1) + actionview (8.0.1) + activesupport (= 8.0.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (8.0.0.1) - activesupport (= 8.0.0.1) + activejob (8.0.1) + activesupport (= 8.0.1) globalid (>= 0.3.6) - activemodel (8.0.0.1) - activesupport (= 8.0.0.1) - activerecord (8.0.0.1) - activemodel (= 8.0.0.1) - activesupport (= 8.0.0.1) + activemodel (8.0.1) + activesupport (= 8.0.1) + activerecord (8.0.1) + activemodel (= 8.0.1) + activesupport (= 8.0.1) timeout (>= 0.4.0) - activestorage (8.0.0.1) - actionpack (= 8.0.0.1) - activejob (= 8.0.0.1) - activerecord (= 8.0.0.1) - activesupport (= 8.0.0.1) + activestorage (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activesupport (= 8.0.1) marcel (~> 1.0) - activesupport (8.0.0.1) + activesupport (8.0.1) base64 benchmark (>= 0.3) bigdecimal @@ -194,7 +194,7 @@ GEM msgpack (1.7.2) multi_xml (0.7.1) bigdecimal (~> 3.1) - net-imap (0.5.1) + net-imap (0.5.2) date net-protocol net-pop (0.1.2) @@ -245,20 +245,20 @@ GEM rack (>= 1.3) rackup (2.2.1) rack (>= 3) - rails (8.0.0.1) - actioncable (= 8.0.0.1) - actionmailbox (= 8.0.0.1) - actionmailer (= 8.0.0.1) - actionpack (= 8.0.0.1) - actiontext (= 8.0.0.1) - actionview (= 8.0.0.1) - activejob (= 8.0.0.1) - activemodel (= 8.0.0.1) - activerecord (= 8.0.0.1) - activestorage (= 8.0.0.1) - activesupport (= 8.0.0.1) + rails (8.0.1) + actioncable (= 8.0.1) + actionmailbox (= 8.0.1) + actionmailer (= 8.0.1) + actionpack (= 8.0.1) + actiontext (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activemodel (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) bundler (>= 1.15.0) - railties (= 8.0.0.1) + railties (= 8.0.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -266,9 +266,9 @@ GEM rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - railties (8.0.0.1) - actionpack (= 8.0.0.1) - activesupport (= 8.0.0.1) + railties (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -343,7 +343,7 @@ GEM rubytree (2.1.0) json (~> 2.0, > 2.3.1) rubyzip (2.3.2) - securerandom (0.4.0) + securerandom (0.4.1) shoulda-matchers (6.4.0) activesupport (>= 5.2.0) solid_queue (1.1.0) @@ -365,7 +365,7 @@ GEM stringio (3.1.2) thor (1.3.2) tilt (2.4.0) - timeout (0.4.2) + timeout (0.4.3) tomlrb (2.0.3) turbo-rails (2.0.11) actionpack (>= 6.0.0) From 663e26bda33784883f29e844c6a28e9b857727ae Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 19 Dec 2024 01:06:12 +0000 Subject: [PATCH 224/283] Update dependency debug to v1.10.0 --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index aead3ed..f8f5cca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -99,7 +99,7 @@ GEM crass (1.0.6) csv (3.3.1) date (3.4.1) - debug (1.9.2) + debug (1.10.0) irb (~> 1.10) reline (>= 0.3.8) devise (4.9.4) @@ -137,7 +137,7 @@ GEM activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.8.0) - irb (1.14.2) + irb (1.14.3) rdoc (>= 4.0.0) reline (>= 0.4.2) jbuilder (2.13.0) @@ -228,7 +228,7 @@ GEM pry (0.15.0) coderay (~> 1.1) method_source (~> 1.0) - psych (5.2.1) + psych (5.2.2) date stringio public_suffix (6.0.1) @@ -276,7 +276,7 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rdoc (6.8.1) + rdoc (6.10.0) psych (>= 4.0.0) react-rails (3.2.1) babel-transpiler (>= 0.7.0) @@ -289,7 +289,7 @@ GEM redis-client (0.22.2) connection_pool regexp_parser (2.9.3) - reline (0.5.12) + reline (0.6.0) io-console (~> 0.5) responders (3.1.1) actionpack (>= 5.2) From d05900f2a6d5c66e0a2111f409ccfaf08e35f20e Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 21 Dec 2024 09:31:06 +0100 Subject: [PATCH 225/283] Upgrade bundler version and include gem checksums --- Gemfile.lock | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 154 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index f8f5cca..6bd03f0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -435,8 +435,161 @@ DEPENDENCIES tzinfo-data web-console +CHECKSUMS + actioncable (8.0.1) sha256=808bff2a4e3aba36f66f0cd65d7a1579ad52fb65e99304442c46051a79689d9b + actionmailbox (8.0.1) sha256=bbc7db779be857fb6eb5b53f313d3881cd8cda38a150c3aa25f89f2f9977b08c + actionmailer (8.0.1) sha256=7b074e9590e4ec5cebd2fc91d1f9ba4c61bbd4bbd4376f731527da187cd39952 + actionpack (8.0.1) sha256=c764e4bfc0ad9d3505c09ef9b6fbf9eca4292793550c6b7e2ea93167181bfcba + actiontext (8.0.1) sha256=f232d303e854db2098f34d7331fe493a72dc2e53dfce80fbd517c7b93d4b05b2 + actionview (8.0.1) sha256=3005e3de5ca49ea789bf1ad46002d63fe5aa543c61c341239d3c533757e64f8a + activejob (8.0.1) sha256=95acd9a32d498d3a458efbb317f6191fb678758cde0ebb6c68f0b25e0fe3477f + activemodel (8.0.1) sha256=f46292fd6dcc128e18d588854298a933fd9eb22544c412b414ec02821062dc78 + activerecord (8.0.1) sha256=34a7f0610660bb704f0363025d4b8d35ffe8ddc8f5b8147e0809171f724b5306 + activestorage (8.0.1) sha256=91a8f156638568fac971ff25962a617d9c58fdc0e44eb6bd0edff36aff7df205 + activesupport (8.0.1) sha256=fd5bc74641c24ac3541055c2879789198ff42adee3e39c2933289ba008912e37 + acts_as_tenant (1.0.1) sha256=6944e4d64533337938a8817a6b4ff9b11189c9dcc0b1333bb89f3821a4c14c53 + addressable (2.8.7) sha256=462986537cf3735ab5f3c0f557f14155d778f4b43ea4f485a9deb9c8f7c58232 + annotaterb (4.13.0) sha256=6f472912002fefa735665b4132de47d0134ebf1efb76a7ef05f579cc4a6b2ff1 + ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12 + babel-source (5.8.35) sha256=79ef222a9dcb867ac2efa3b0da35b4bcb15a4bfa67b6b2dcbf1e9a29104498d9 + babel-transpiler (0.7.0) sha256=4c06f4ad9e8e1cabe94f99e11df2f140bb72aca9ba067dbb49dc14d9b98d1570 + base64 (0.2.0) sha256=0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507 + bcrypt (3.1.20) sha256=8410f8c7b3ed54a3c00cd2456bf13917d695117f033218e2483b2e40b0784099 + benchmark (0.4.0) sha256=0f12f8c495545e3710c3e4f0480f63f06b4c842cc94cec7f33a956f5180e874a + bigdecimal (3.1.8) sha256=a89467ed5a44f8ae01824af49cbc575871fa078332e8f77ea425725c1ffe27be + bindex (0.8.1) sha256=7b1ecc9dc539ed8bccfc8cb4d2732046227b09d6f37582ff12e50a5047ceb17e + bootsnap (1.18.4) sha256=ac4c42af397f7ee15521820198daeff545e4c360d2772c601fbdc2c07d92af55 + builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f + childprocess (5.1.0) sha256=9a8d484be2fd4096a0e90a0cd3e449a05bc3aa33f8ac9e4d6dcef6ac1455b6ec + chroma (0.2.0) sha256=64bdcd36a4765fbcd45adc64960cc153101300b4918f90ffdd89f4e2eb954b54 + coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b + concurrent-ruby (1.3.4) sha256=d4aa926339b0a86b5b5054a0a8c580163e6f5dcbdfd0f4bb916b1a2570731c32 + connection_pool (2.4.1) sha256=0f40cf997091f1f04ff66da67eabd61a9fe0d4928b9a3645228532512fab62f4 + crass (1.0.6) sha256=dc516022a56e7b3b156099abc81b6d2b08ea1ed12676ac7a5657617f012bd45d + csv (3.3.1) sha256=e5133b9005fd2ca61547509cd8b7eefa94663d5d36c0e73297b0ae0a35e3e767 + date (3.4.1) sha256=bf268e14ef7158009bfeaec40b5fa3c7271906e88b196d958a89d4b408abe64f + debug (1.10.0) sha256=11e28ca74875979e612444104f3972bd5ffb9e79179907d7ad46dba44bd2e7a4 + devise (4.9.4) sha256=920042fe5e704c548aa4eb65ebdd65980b83ffae67feb32c697206bfd975a7f8 + diff-lcs (1.5.1) sha256=273223dfb40685548436d32b4733aa67351769c7dea621da7d9dd4813e63ddfe + drb (2.2.1) sha256=e9d472bf785f558b96b25358bae115646da0dbfd45107ad858b0bc0d935cb340 + erubi (1.13.0) sha256=fca61b47daefd865d0fb50d168634f27ad40181867445badf6427c459c33cd62 + et-orbi (1.2.11) sha256=d26e868cc21db88280a9ec1a50aa3da5d267eb9b2037ba7b831d6c2731f5df64 + execjs (2.9.1) sha256=e8fd066f6df60c8e8fbebc32c6fb356b5212c77374e8416a9019ca4bb154dcfb + factory_bot (6.4.6) sha256=1a9486ce98d318d740d8f5804b885a8265a28f326ecf2bcd4ce9fb27a71a6e04 + factory_bot_rails (6.4.3) sha256=ea73ceac1c0ff3dc11fff390bf2ea8a2604066525ed8ecd3b3bc2c267226dcc8 + faker (3.5.1) sha256=1ad1fbea279d882f486059c23fe3ddb816ccd1d7052c05a45014b4450d859bfc + fugit (1.11.1) sha256=e89485e7be22226d8e9c6da411664d0660284b4b1c08cacb540f505907869868 + globalid (1.2.1) sha256=70bf76711871f843dbba72beb8613229a49429d1866828476f9c9d6ccc327ce9 + httparty (0.22.0) sha256=78652a5c9471cf0093d3b2083c2295c9c8f12b44c65112f1846af2b71430fa6c + i18n (1.14.6) sha256=dc229a74f5d181f09942dd60ab5d6e667f7392c4ee826f35096db36d1fe3614c + importmap-rails (2.0.3) sha256=c56764941f9b637791fb87123b38f206f27cc55ef03cb19894f1994184e98cc8 + io-console (0.8.0) sha256=cd6a9facbc69871d69b2cb8b926fc6ea7ef06f06e505e81a64f14a470fddefa2 + irb (1.14.3) sha256=c457f1f2f1438ae9ce5c5be3981ae2138dec7fb894c7d73777eeeb0a6c0d0752 + jbuilder (2.13.0) sha256=7200a38a1c0081aa81b7a9757e7a299db75bc58cf1fd45ca7919a91627d227d6 + json (2.8.2) sha256=dd4fa6c9c81daecf72b86ea36e56ed8955fdbb4d4dc379c93d313a59344486cf + json-schema (5.0.1) sha256=bef71a82c600a42594911553522e143f7634affc198ed507ef3ded2f920a74a9 + jsonapi-deserializable (0.2.0) sha256=5f0ca2d3f8404cce1584a314e8a3753be32a56054c942adfe997b87e92bce147 + jsonapi-parser (0.1.1) sha256=9ee0dc031e88fc7548d56fab66f9716d1e1c06f972b529b8c4617bc42a097020 + jsonapi-rails (0.4.1) sha256=fa68b927b58f194e8b81f578c0bf18e61575638f45a390f66c832de2e6d179ba + jsonapi-rb (0.5.0) sha256=7922a164278f506c43d56277f6bd0800a0b603cc985f7f63fe7241b2628bd105 + jsonapi-renderer (0.2.2) sha256=b5c44b033d61b4abdb6500fa4ab84807ca0b36ea0e59e47a2c3ca7095a6e447b + jsonapi-serializable (0.3.1) sha256=221e657677659d798e268a33ec97a83ec5ea0e4233f931358db84e88056552e9 + language_server-protocol (3.17.0.3) sha256=3d5c58c02f44a20d972957a9febe386d7e7468ab3900ce6bd2b563dd910c6b3f + launchy (3.0.1) sha256=b7fa60bda0197cf57614e271a250a8ca1f6a34ab889a3c73f67ec5d57c8a7f2c + letter_opener (1.10.0) sha256=2ff33f2e3b5c3c26d1959be54b395c086ca6d44826e8bf41a14ff96fdf1bdbb2 + letter_opener_web (3.0.0) sha256=3f391efe0e8b9b24becfab5537dfb17a5cf5eb532038f947daab58cb4b749860 + license_finder (7.2.1) sha256=179ead19b64b170638b72fd16024233813673ac9d20d5ba75ae0b4444887ef14 + logger (1.6.3) sha256=4533ce015c75d8ae442ecb9dc10e3ca82e9f36c55b829dcde0fc964f4e7ce494 + loofah (2.23.1) sha256=d0a07422cb3b69272e124afa914ef6d517e30d5496b7f1c1fc5b95481f13f75e + mail (2.8.1) sha256=ec3b9fadcf2b3755c78785cb17bc9a0ca9ee9857108a64b6f5cfc9c0b5bfc9ad + marcel (1.0.4) sha256=0d5649feb64b8f19f3d3468b96c680bae9746335d02194270287868a661516a4 + method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5 + mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef + minitest (5.25.4) sha256=9cf2cae25ac4dfc90c988ebc3b917f53c054978b673273da1bd20bcb0778f947 + money (6.19.0) sha256=ec936fa1e42f2783719241ed9fd52725d0efa628f928feea1eb5c37d5de7daf3 + msgpack (1.7.2) sha256=59ab62fd8a4d0dfbde45009f87eb6f158ab2628a7c48886b0256f175166baaa8 + multi_xml (0.7.1) sha256=4fce100c68af588ff91b8ba90a0bb3f0466f06c909f21a32f4962059140ba61b + net-imap (0.5.2) sha256=e955b55e539712518bdb4eb747c6514f9c8d56ec4eb8eb573a82a6885a9effea + net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3 + net-protocol (0.2.2) sha256=aa73e0cba6a125369de9837b8d8ef82a61849360eba0521900e2c3713aa162a8 + net-smtp (0.5.0) sha256=5fc0415e6ea1cc0b3dfea7270438ec22b278ca8d524986a3ae4e5ae8d087b42a + nio4r (2.7.4) sha256=d95dee68e0bb251b8ff90ac3423a511e3b784124e5db7ff5f4813a220ae73ca9 + nokogiri (1.16.8-aarch64-linux) sha256=b1d41cd9abf4180adef496cc8c9fcb5b2e38d39f5e23c8a2445362226a5df6b8 + nokogiri (1.16.8-arm-linux) sha256=8cbd2971624fc073b9430d86475da031903494dcb83c2339e13f7f22a4de6fad + nokogiri (1.16.8-arm64-darwin) sha256=b7aa4e8533a720e432d09b52a2ec089b55cf3ee66c916b44a0d9b6608df7bf8c + nokogiri (1.16.8-x86-linux) sha256=f97760e6320166d48234029bed9e999521a888376bd2b7e04f4c054537154f16 + nokogiri (1.16.8-x86_64-darwin) sha256=6c40d7dc444f752634bf6ee8b53a55c3cfca3f9df52be46b8abcc559ccd49e47 + nokogiri (1.16.8-x86_64-linux) sha256=ed7b1f80713ac968dd93fe2b96fc3df6e448b73bd02dd77d5fc89ba92a1ed6d9 + orm_adapter (0.5.0) sha256=aa5d0be5d540cbb46d3a93e88061f4ece6a25f6e97d6a47122beb84fe595e9b9 + parallel (1.26.3) sha256=d86babb7a2b814be9f4b81587bf0b6ce2da7d45969fab24d8ae4bf2bb4d4c7ef + parser (3.3.6.0) sha256=25d4e67cc4f0f7cab9a2ae1f38e2005b6904d2ea13c34734511d0faad038bc3b + pg (1.5.9) sha256=761efbdf73b66516f0c26fcbe6515dc7500c3f0aa1a1b853feae245433c64fdc + pluck_to_hash (1.0.2) sha256=1599906239716f98262a41493dd7d4cb72e8d83ad3d76d666deacfc5de50a47e + pry (0.15.0) sha256=91e7925ea58c88e671b058a3a939bb529016de5ec57084b000057b2a1fec1930 + psych (5.2.2) sha256=a4a9477c85d3e858086c38cf64e7096abe40d1b1eed248b01020dec0ff9906ab + public_suffix (6.0.1) sha256=61d44e1cab5cbbbe5b31068481cf16976dd0dc1b6b07bd95617ef8c5e3e00c6f + puma (6.5.0) sha256=94d1b75cab7f356d52e4f1b17b9040a090889b341dbeee6ee3703f441dc189f2 + raabro (1.4.0) sha256=d4fa9ff5172391edb92b242eed8be802d1934b1464061ae5e70d80962c5da882 + racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f + rack (3.1.8) sha256=d3fbcbca43dc2b43c9c6d7dfbac01667ae58643c42cea10013d0da970218a1b1 + rack-cors (2.0.2) sha256=415d4e1599891760c5dc9ef0349c7fecdf94f7c6a03e75b2e7c2b54b82adda1b + rack-session (2.0.0) sha256=db04b2063e180369192a9046b4559af311990af38c6a93d4c600cee4eb6d4e81 + rack-test (2.1.0) sha256=0c61fc61904049d691922ea4bb99e28004ed3f43aa5cfd495024cc345f125dfb + rackup (2.2.1) sha256=f737191fd5c5b348b7f0a4412a3b86383f88c43e13b8217b63d4c8d90b9e798d + rails (8.0.1) sha256=c86f4cd7834a67c1e5d04a77d35c88a5f56a20e2022ec416fa52c1af2cdc9491 + rails-dom-testing (2.2.0) sha256=e515712e48df1f687a1d7c380fd7b07b8558faa26464474da64183a7426fa93b + rails-html-sanitizer (1.6.2) sha256=35fce2ca8242da8775c83b6ba9c1bcaad6751d9eb73c1abaa8403475ab89a560 + railties (8.0.1) sha256=8f653c6b1b0721b553045bd0deda1f22074b9ddc2209526e6f7285fcf607ac51 + rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a + rake (13.2.1) sha256=46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d + rdoc (6.10.0) sha256=db665021883ac9df3ba29cdf71aece960749888db1bf9615b4a584cfa3fa3eda + react-rails (3.2.1) sha256=2235db0b240517596b1cb3e26177ab5bc64d3a56579b0415ee242b1691f81f64 + redis (5.3.0) sha256=6bf810c5ae889187f0c45f77db503310980310afa57cf1640d57f419ccda72b1 + redis-client (0.22.2) sha256=31fee4b7cf04109b227327fabeaaf1fc5b652cf48a186a03bc607e40767bacc0 + regexp_parser (2.9.3) sha256=4b620657ed8349d82e1331a076415c79b9dd714a5546162ddd790ea9988f6379 + reline (0.6.0) sha256=57620375dcbe56ec09bac7192bfb7460c716bbf0054dc94345ecaa5438e539d2 + responders (3.1.1) sha256=92f2a87e09028347368639cfb468f5fefa745cb0dc2377ef060db1cdd79a341a + rexml (3.3.9) sha256=d71875b85299f341edf47d44df0212e7658cbdf35aeb69cefdb63f57af3137c9 + rspec-core (3.13.2) sha256=94fbda6e4738e478f1c7532b7cc241272fcdc8b9eac03a97338b1122e4573300 + rspec-expectations (3.13.3) sha256=0e6b5af59b900147698ea0ff80456c4f2e69cac4394fbd392fbd1ca561f66c58 + rspec-mocks (3.13.2) sha256=2327335def0e1665325a9b617e3af9ae20272741d80ac550336309a7c59abdef + rspec-rails (7.1.0) sha256=94585b69c4086ca79afae5cc8d2c5e314f6ad32a88c927f9c065b99596e3ee47 + rspec-support (3.13.1) sha256=48877d4f15b772b7538f3693c22225f2eda490ba65a0515c4e7cf6f2f17de70f + rswag (2.16.0) sha256=f07ce41548b9bb51464c38bc7b95af22fee84b90f2d1197a515a623906353086 + rswag-api (2.16.0) sha256=b653f7bd92e98be18b01ab4525d88950d7b0960e293a99f856b9efcee3ae6074 + rswag-specs (2.16.0) sha256=8ba26085c408b0bd2ed21dc8015c80f417c7d34c63720ab7133c2549b5bd2a91 + rswag-ui (2.16.0) sha256=a1f49e927dceda92e6e6e7c1000f1e217ee66c565f69e28131dc98b33cd3a04f + rubocop (1.69.2) sha256=762fb0f30a379bf6054588d39f1815a2a1df8f067bc0337d3fe500e346924bb8 + rubocop-ast (1.36.2) sha256=566405b7f983eb9aa3b91d28aca6bc6566e356a97f59e89851dd910aef1dd1ca + ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 + rubytree (2.1.0) sha256=30e8759ba060dff0dabf7e40cbaaa4df892fa34cbe9f1b3fbb00e83a3f321e4b + rubyzip (2.3.2) sha256=3f57e3935dc2255c414484fbf8d673b4909d8a6a57007ed754dde39342d2373f + securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 + shoulda-matchers (6.4.0) sha256=9055bb7f4bb342125fb860809798855c630e05ef5e75837b3168b8e6ee1608b0 + solid_queue (1.1.0) sha256=55c7b1d65f2943ec8f3deee36fcb0cae91d5fa60410b294775db9da22be8353c + sprockets (4.2.1) sha256=951b13dd2f2fcae840a7184722689a803e0ff9d2702d902bd844b196da773f97 + sprockets-rails (3.5.2) sha256=a9e88e6ce9f8c912d349aa5401509165ec42326baf9e942a85de4b76dbc4119e + stimulus-rails (1.3.4) sha256=765676ffa1f33af64ce026d26b48e8ffb2e0b94e0f50e9119e11d6107d67cb06 + stringio (3.1.2) sha256=204f1828f85cdb39d57cac4abc6dc44b04505a223f131587f2e20ae3729ba131 + thor (1.3.2) sha256=eef0293b9e24158ccad7ab383ae83534b7ad4ed99c09f96f1a6b036550abbeda + tilt (2.4.0) sha256=df74f29a451daed26591a85e8e0cebb198892cb75b6573394303acda273fba4d + timeout (0.4.3) sha256=9509f079b2b55fe4236d79633bd75e34c1c1e7e3fb4b56cb5fda61f80a0fe30e + tomlrb (2.0.3) sha256=c2736acf24919f793334023a4ff396c0647d93fce702a73c9d348deaa815d4f7 + turbo-rails (2.0.11) sha256=fc47674736372780abd2a4dc0d84bef242f5ca156a457cd7fa6308291e397fcf + tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b + unicode-display_width (2.6.0) sha256=12279874bba6d5e4d2728cef814b19197dbb10d7a7837a869bab65da943b7f5a + uri (1.0.2) sha256=b303504ceb7e5905771fa7fa14b649652fa949df18b5880d69cfb12494791e27 + useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844 + warden (1.2.9) sha256=46684f885d35a69dbb883deabf85a222c8e427a957804719e143005df7a1efd0 + web-console (4.2.1) sha256=e7bcf37a10ea2b4ec4281649d1cee461b32232d0a447e82c786e6841fd22fe20 + websocket-driver (0.7.6) sha256=f69400be7bc197879726ad8e6f5869a61823147372fd8928836a53c2c741d0db + websocket-extensions (0.1.5) sha256=1c6ba63092cda343eb53fc657110c71c754c56484aad42578495227d717a8241 + with_env (1.1.0) sha256=50b3e4f0a6cda8f90d8a6bd87a6261f6c381429abafb161c4c69ad4a0cd0b6e4 + xml-simple (1.1.9) sha256=d21131e519c86f1a5bc2b6d2d57d46e6998e47f18ed249b25cad86433dbd695d + zeitwerk (2.7.1) sha256=0945986050e4907140895378e74df1fe882a2271ed087cc6c6d6b00d415a2756 + RUBY VERSION ruby 3.3.6p108 BUNDLED WITH - 2.5.17 + 2.6.1 From a7e40f3d63f9d1faeae11a5fd2a76e60e69cdb9b Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 23 Dec 2024 01:05:04 +0000 Subject: [PATCH 226/283] Update dependency factory_bot_rails to v6.4.4 --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6bd03f0..4d92021 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -110,7 +110,7 @@ GEM warden (~> 1.2.3) diff-lcs (1.5.1) drb (2.2.1) - erubi (1.13.0) + erubi (1.13.1) et-orbi (1.2.11) tzinfo execjs (2.9.1) @@ -176,7 +176,7 @@ GEM tomlrb (>= 1.3, < 2.1) with_env (= 1.1.0) xml-simple (~> 1.1.9) - logger (1.6.3) + logger (1.6.4) loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -472,7 +472,7 @@ CHECKSUMS devise (4.9.4) sha256=920042fe5e704c548aa4eb65ebdd65980b83ffae67feb32c697206bfd975a7f8 diff-lcs (1.5.1) sha256=273223dfb40685548436d32b4733aa67351769c7dea621da7d9dd4813e63ddfe drb (2.2.1) sha256=e9d472bf785f558b96b25358bae115646da0dbfd45107ad858b0bc0d935cb340 - erubi (1.13.0) sha256=fca61b47daefd865d0fb50d168634f27ad40181867445badf6427c459c33cd62 + erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9 et-orbi (1.2.11) sha256=d26e868cc21db88280a9ec1a50aa3da5d267eb9b2037ba7b831d6c2731f5df64 execjs (2.9.1) sha256=e8fd066f6df60c8e8fbebc32c6fb356b5212c77374e8416a9019ca4bb154dcfb factory_bot (6.4.6) sha256=1a9486ce98d318d740d8f5804b885a8265a28f326ecf2bcd4ce9fb27a71a6e04 @@ -499,7 +499,7 @@ CHECKSUMS letter_opener (1.10.0) sha256=2ff33f2e3b5c3c26d1959be54b395c086ca6d44826e8bf41a14ff96fdf1bdbb2 letter_opener_web (3.0.0) sha256=3f391efe0e8b9b24becfab5537dfb17a5cf5eb532038f947daab58cb4b749860 license_finder (7.2.1) sha256=179ead19b64b170638b72fd16024233813673ac9d20d5ba75ae0b4444887ef14 - logger (1.6.3) sha256=4533ce015c75d8ae442ecb9dc10e3ca82e9f36c55b829dcde0fc964f4e7ce494 + logger (1.6.4) sha256=b627b91c922231050932e7bf8ee886fe54790ba2238a468ead52ba21911f2ee7 loofah (2.23.1) sha256=d0a07422cb3b69272e124afa914ef6d517e30d5496b7f1c1fc5b95481f13f75e mail (2.8.1) sha256=ec3b9fadcf2b3755c78785cb17bc9a0ca9ee9857108a64b6f5cfc9c0b5bfc9ad marcel (1.0.4) sha256=0d5649feb64b8f19f3d3468b96c680bae9746335d02194270287868a661516a4 From 4f2c3ee1a62cc1944445005e26023c411c350d05 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 23 Dec 2024 01:05:11 +0000 Subject: [PATCH 227/283] Update dependency importmap-rails to v2.1.0 --- Gemfile.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6bd03f0..ba6e076 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -110,7 +110,7 @@ GEM warden (~> 1.2.3) diff-lcs (1.5.1) drb (2.2.1) - erubi (1.13.0) + erubi (1.13.1) et-orbi (1.2.11) tzinfo execjs (2.9.1) @@ -132,7 +132,7 @@ GEM multi_xml (>= 0.5.2) i18n (1.14.6) concurrent-ruby (~> 1.0) - importmap-rails (2.0.3) + importmap-rails (2.1.0) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) @@ -176,7 +176,7 @@ GEM tomlrb (>= 1.3, < 2.1) with_env (= 1.1.0) xml-simple (~> 1.1.9) - logger (1.6.3) + logger (1.6.4) loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -204,17 +204,17 @@ GEM net-smtp (0.5.0) net-protocol nio4r (2.7.4) - nokogiri (1.16.8-aarch64-linux) + nokogiri (1.17.2-aarch64-linux) racc (~> 1.4) - nokogiri (1.16.8-arm-linux) + nokogiri (1.17.2-arm-linux) racc (~> 1.4) - nokogiri (1.16.8-arm64-darwin) + nokogiri (1.17.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.8-x86-linux) + nokogiri (1.17.2-x86-linux) racc (~> 1.4) - nokogiri (1.16.8-x86_64-darwin) + nokogiri (1.17.2-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.8-x86_64-linux) + nokogiri (1.17.2-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) parallel (1.26.3) @@ -472,7 +472,7 @@ CHECKSUMS devise (4.9.4) sha256=920042fe5e704c548aa4eb65ebdd65980b83ffae67feb32c697206bfd975a7f8 diff-lcs (1.5.1) sha256=273223dfb40685548436d32b4733aa67351769c7dea621da7d9dd4813e63ddfe drb (2.2.1) sha256=e9d472bf785f558b96b25358bae115646da0dbfd45107ad858b0bc0d935cb340 - erubi (1.13.0) sha256=fca61b47daefd865d0fb50d168634f27ad40181867445badf6427c459c33cd62 + erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9 et-orbi (1.2.11) sha256=d26e868cc21db88280a9ec1a50aa3da5d267eb9b2037ba7b831d6c2731f5df64 execjs (2.9.1) sha256=e8fd066f6df60c8e8fbebc32c6fb356b5212c77374e8416a9019ca4bb154dcfb factory_bot (6.4.6) sha256=1a9486ce98d318d740d8f5804b885a8265a28f326ecf2bcd4ce9fb27a71a6e04 @@ -482,7 +482,7 @@ CHECKSUMS globalid (1.2.1) sha256=70bf76711871f843dbba72beb8613229a49429d1866828476f9c9d6ccc327ce9 httparty (0.22.0) sha256=78652a5c9471cf0093d3b2083c2295c9c8f12b44c65112f1846af2b71430fa6c i18n (1.14.6) sha256=dc229a74f5d181f09942dd60ab5d6e667f7392c4ee826f35096db36d1fe3614c - importmap-rails (2.0.3) sha256=c56764941f9b637791fb87123b38f206f27cc55ef03cb19894f1994184e98cc8 + importmap-rails (2.1.0) sha256=9f10c67d60651a547579f448100d033df311c5d5db578301374aeb774faae741 io-console (0.8.0) sha256=cd6a9facbc69871d69b2cb8b926fc6ea7ef06f06e505e81a64f14a470fddefa2 irb (1.14.3) sha256=c457f1f2f1438ae9ce5c5be3981ae2138dec7fb894c7d73777eeeb0a6c0d0752 jbuilder (2.13.0) sha256=7200a38a1c0081aa81b7a9757e7a299db75bc58cf1fd45ca7919a91627d227d6 @@ -499,7 +499,7 @@ CHECKSUMS letter_opener (1.10.0) sha256=2ff33f2e3b5c3c26d1959be54b395c086ca6d44826e8bf41a14ff96fdf1bdbb2 letter_opener_web (3.0.0) sha256=3f391efe0e8b9b24becfab5537dfb17a5cf5eb532038f947daab58cb4b749860 license_finder (7.2.1) sha256=179ead19b64b170638b72fd16024233813673ac9d20d5ba75ae0b4444887ef14 - logger (1.6.3) sha256=4533ce015c75d8ae442ecb9dc10e3ca82e9f36c55b829dcde0fc964f4e7ce494 + logger (1.6.4) sha256=b627b91c922231050932e7bf8ee886fe54790ba2238a468ead52ba21911f2ee7 loofah (2.23.1) sha256=d0a07422cb3b69272e124afa914ef6d517e30d5496b7f1c1fc5b95481f13f75e mail (2.8.1) sha256=ec3b9fadcf2b3755c78785cb17bc9a0ca9ee9857108a64b6f5cfc9c0b5bfc9ad marcel (1.0.4) sha256=0d5649feb64b8f19f3d3468b96c680bae9746335d02194270287868a661516a4 @@ -514,12 +514,12 @@ CHECKSUMS net-protocol (0.2.2) sha256=aa73e0cba6a125369de9837b8d8ef82a61849360eba0521900e2c3713aa162a8 net-smtp (0.5.0) sha256=5fc0415e6ea1cc0b3dfea7270438ec22b278ca8d524986a3ae4e5ae8d087b42a nio4r (2.7.4) sha256=d95dee68e0bb251b8ff90ac3423a511e3b784124e5db7ff5f4813a220ae73ca9 - nokogiri (1.16.8-aarch64-linux) sha256=b1d41cd9abf4180adef496cc8c9fcb5b2e38d39f5e23c8a2445362226a5df6b8 - nokogiri (1.16.8-arm-linux) sha256=8cbd2971624fc073b9430d86475da031903494dcb83c2339e13f7f22a4de6fad - nokogiri (1.16.8-arm64-darwin) sha256=b7aa4e8533a720e432d09b52a2ec089b55cf3ee66c916b44a0d9b6608df7bf8c - nokogiri (1.16.8-x86-linux) sha256=f97760e6320166d48234029bed9e999521a888376bd2b7e04f4c054537154f16 - nokogiri (1.16.8-x86_64-darwin) sha256=6c40d7dc444f752634bf6ee8b53a55c3cfca3f9df52be46b8abcc559ccd49e47 - nokogiri (1.16.8-x86_64-linux) sha256=ed7b1f80713ac968dd93fe2b96fc3df6e448b73bd02dd77d5fc89ba92a1ed6d9 + nokogiri (1.17.2-aarch64-linux) sha256=585c8cac6380848b7973bacfd0584628d116810e5f209db25e22d0c32313e681 + nokogiri (1.17.2-arm-linux) sha256=3d033ad9b09d5b8a203f0f2156053e93a9327a9c7887c0ceb9fa78c71d27280d + nokogiri (1.17.2-arm64-darwin) sha256=0c5eb06ba1c112d33c2bb29973b07e2f21c4ddb66c67c9386fd97ff1c5d84686 + nokogiri (1.17.2-x86-linux) sha256=8c4dd75e35810bdeb7c74943f383ca665baf6aed8fc2b78c1d305094a72794aa + nokogiri (1.17.2-x86_64-darwin) sha256=dc5977eb3416e1d501b22b0ed4737bf7604121491405865b887975eacfb3e896 + nokogiri (1.17.2-x86_64-linux) sha256=e8614ae8d776bd9adb535ca814375e7ae05d7cfa6aa01909e561484f6d70be0b orm_adapter (0.5.0) sha256=aa5d0be5d540cbb46d3a93e88061f4ece6a25f6e97d6a47122beb84fe595e9b9 parallel (1.26.3) sha256=d86babb7a2b814be9f4b81587bf0b6ce2da7d45969fab24d8ae4bf2bb4d4c7ef parser (3.3.6.0) sha256=25d4e67cc4f0f7cab9a2ae1f38e2005b6904d2ea13c34734511d0faad038bc3b From 1318f34cec95f23c93f5b4cf76a082d550e53b7a Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 24 Dec 2024 01:04:34 +0000 Subject: [PATCH 228/283] Update dependency csv to v3.3.2 --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ba6e076..6e14a77 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,7 +97,7 @@ GEM concurrent-ruby (1.3.4) connection_pool (2.4.1) crass (1.0.6) - csv (3.3.1) + csv (3.3.2) date (3.4.1) debug (1.10.0) irb (~> 1.10) @@ -466,7 +466,7 @@ CHECKSUMS concurrent-ruby (1.3.4) sha256=d4aa926339b0a86b5b5054a0a8c580163e6f5dcbdfd0f4bb916b1a2570731c32 connection_pool (2.4.1) sha256=0f40cf997091f1f04ff66da67eabd61a9fe0d4928b9a3645228532512fab62f4 crass (1.0.6) sha256=dc516022a56e7b3b156099abc81b6d2b08ea1ed12676ac7a5657617f012bd45d - csv (3.3.1) sha256=e5133b9005fd2ca61547509cd8b7eefa94663d5d36c0e73297b0ae0a35e3e767 + csv (3.3.2) sha256=6ff0c135e65e485d1864dde6c1703b60d34cc9e19bed8452834a0b28a519bd4e date (3.4.1) sha256=bf268e14ef7158009bfeaec40b5fa3c7271906e88b196d958a89d4b408abe64f debug (1.10.0) sha256=11e28ca74875979e612444104f3972bd5ffb9e79179907d7ad46dba44bd2e7a4 devise (4.9.4) sha256=920042fe5e704c548aa4eb65ebdd65980b83ffae67feb32c697206bfd975a7f8 From 9ac8b9b78326d899e128cd36b05ff7e7830d6698 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 25 Dec 2024 01:05:11 +0000 Subject: [PATCH 229/283] Update dependency pry to v0.15.2 --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6e14a77..f55a087 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -225,7 +225,7 @@ GEM pluck_to_hash (1.0.2) activerecord (>= 4.0.2) activesupport (>= 4.0.2) - pry (0.15.0) + pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) psych (5.2.2) @@ -525,7 +525,7 @@ CHECKSUMS parser (3.3.6.0) sha256=25d4e67cc4f0f7cab9a2ae1f38e2005b6904d2ea13c34734511d0faad038bc3b pg (1.5.9) sha256=761efbdf73b66516f0c26fcbe6515dc7500c3f0aa1a1b853feae245433c64fdc pluck_to_hash (1.0.2) sha256=1599906239716f98262a41493dd7d4cb72e8d83ad3d76d666deacfc5de50a47e - pry (0.15.0) sha256=91e7925ea58c88e671b058a3a939bb529016de5ec57084b000057b2a1fec1930 + pry (0.15.2) sha256=12d54b8640d3fa29c9211dd4ffb08f3fd8bf7a4fd9b5a73ce5b59c8709385b6b psych (5.2.2) sha256=a4a9477c85d3e858086c38cf64e7096abe40d1b1eed248b01020dec0ff9906ab public_suffix (6.0.1) sha256=61d44e1cab5cbbbe5b31068481cf16976dd0dc1b6b07bd95617ef8c5e3e00c6f puma (6.5.0) sha256=94d1b75cab7f356d52e4f1b17b9040a090889b341dbeee6ee3703f441dc189f2 From 6c6ae62e5a4367a7ce8e02e8adeac93d5d835dc6 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 17 Dec 2024 00:46:01 +0100 Subject: [PATCH 230/283] Define model and endpoints to store affinity between group pairs --- app/controllers/affinities_controller.rb | 36 +++++++++++++ app/models/group.rb | 4 ++ app/models/group_affinity.rb | 38 ++++++++++++++ app/services/tables/discomfort_calculator.rb | 16 +++--- config/routes.rb | 7 ++- .../20241216231415_create_group_affinities.rb | 27 ++++++++++ db/schema.rb | 19 +++++-- docker-compose.yml | 18 ++++++- spec/factories/group_affinities.rb | 7 +++ spec/models/group_affinity_spec.rb | 40 +++++++++++++++ spec/requests/affinities_spec.rb | 50 +++++++++++++++++++ 11 files changed, 250 insertions(+), 12 deletions(-) create mode 100644 app/controllers/affinities_controller.rb create mode 100644 app/models/group_affinity.rb create mode 100644 db/migrate/20241216231415_create_group_affinities.rb create mode 100644 spec/factories/group_affinities.rb create mode 100644 spec/models/group_affinity_spec.rb create mode 100644 spec/requests/affinities_spec.rb diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb new file mode 100644 index 0000000..9a2122c --- /dev/null +++ b/app/controllers/affinities_controller.rb @@ -0,0 +1,36 @@ +# Copyright (C) 2024 Manuel Bustillo + +# frozen_string_literal: true + +class AffinitiesController < ApplicationController + before_action :set_group + + def index + overridden_affinities = @group.affinities + .each_with_object({}) { |affinity, acc| acc[affinity.another_group(@group).id] = affinity.discomfort } + Group.pluck(:id).index_with { |group_id| overridden_affinities[group_id] || GroupAffinity::NEUTRAL } + .then { |affinities| render json: affinities } + end + + def bulk_update + params.expect(affinities: [[:group_id, :discomfort]]).map(&:to_h).map do |affinity| + { + group_a_id: @group.id, + group_b_id: affinity[:group_id], + discomfort: affinity[:discomfort] + } + end.then { |affinities| GroupAffinity.upsert_all(affinities) } + render json: {}, status: :ok + + rescue ActiveRecord::InvalidForeignKey + render json: { error: 'At least one of the group IDs provided does not exist.' }, status: :bad_request + rescue ActiveRecord::StatementInvalid + render json: { error: 'Invalid group ID or discomfort provided.' } + end + + private + + def set_group + @group = Group.find(params[:group_id]) + end +end diff --git a/app/models/group.rb b/app/models/group.rb index a00a671..6552214 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -53,6 +53,10 @@ class Group < ApplicationRecord child.colorize_children(generation + 1) end end + + def affinities + GroupAffinity.where(group_a_id: id).or(GroupAffinity.where(group_b_id: id)) + end private diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb new file mode 100644 index 0000000..c33364c --- /dev/null +++ b/app/models/group_affinity.rb @@ -0,0 +1,38 @@ +# == Schema Information +# +# Table name: group_affinities +# +# id :bigint not null, primary key +# discomfort :float not null +# created_at :datetime not null +# updated_at :datetime not null +# group_a_id :uuid not null +# group_b_id :uuid not null +# +# Indexes +# +# index_group_affinities_on_group_a_id (group_a_id) +# index_group_affinities_on_group_b_id (group_b_id) +# uindex_group_pair (LEAST(group_a_id, group_b_id), GREATEST(group_a_id, group_b_id)) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (group_a_id => groups.id) +# fk_rails_... (group_b_id => groups.id) +# +class GroupAffinity < ApplicationRecord + NEUTRAL = 1 + MIN_DISCOMFORT = 0 + MAX_DISCOMFORT = 2 + + belongs_to :group_a, class_name: 'Group' + belongs_to :group_b, class_name: 'Group' + + validates :discomfort, numericality: { greater_than_or_equal_to: MIN_DISCOMFORT, less_than_or_equal_to: MAX_DISCOMFORT } + + def another_group(group) + return nil if group != group_a && group != group_b + + group == group_a ? group_b : group_a + end +end diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index 35da8ce..c4ef54a 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -2,6 +2,15 @@ module Tables class DiscomfortCalculator + class << self + def cohesion_discomfort(id_a:, id_b:) + distance = AffinityGroupsHierarchy.instance.distance(id_a, id_b) + + return 1 if distance.nil? + Rational(distance, distance + 1) + end + end + private attr_reader :table def initialize(table:) @table = table @@ -45,12 +54,7 @@ module Tables # def cohesion_discomfort table.map(&:group_id).tally.to_a.combination(2).sum do |(a, count_a), (b, count_b)| - distance = AffinityGroupsHierarchy.instance.distance(a, b) - - next count_a * count_b if distance.nil? - next 0 if distance.zero? - - count_a * count_b * Rational(distance, distance + 1) + count_a * count_b * self.class.cohesion_discomfort(id_a: a, id_b: b) end end end diff --git a/config/routes.rb b/config/routes.rb index c3bc335..9e2b004 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -23,7 +23,12 @@ Rails.application.routes.draw do get '/users/confirmation', to: 'users/confirmations#show', as: :confirmation end - resources :groups, only: %i[index create update destroy] + resources :groups, only: %i[index create update destroy] do + resources :affinities, only: %i[index] do + put :bulk_update, on: :collection + end + end + resources :guests, only: %i[index create update destroy] do post :bulk_update, on: :collection end diff --git a/db/migrate/20241216231415_create_group_affinities.rb b/db/migrate/20241216231415_create_group_affinities.rb new file mode 100644 index 0000000..1c6789d --- /dev/null +++ b/db/migrate/20241216231415_create_group_affinities.rb @@ -0,0 +1,27 @@ +class CreateGroupAffinities < ActiveRecord::Migration[8.0] + disable_ddl_transaction! + + def change + create_table :group_affinities, if_not_exists: true do |t| + t.references :group_a, type: :uuid, null: false, foreign_key: { to_table: :groups } + t.references :group_b, type: :uuid, null: false, foreign_key: { to_table: :groups } + t.float :discomfort, null: false + t.timestamps + end + + add_check_constraint :group_affinities, 'group_a_id != group_b_id', name: :check_distinct_groups, if_not_exists: true + add_check_constraint :group_affinities, 'discomfort >= 0 AND discomfort <= 2', if_not_exists: true + + reversible do |dir| + dir.up do + execute <<~SQL + CREATE UNIQUE INDEX CONCURRENTLY uindex_group_pair ON group_affinities (least(group_a_id, group_b_id), greatest(group_a_id, group_b_id)); + SQL + end + + dir.down do + remove_index :group_affinities, name: :uindex_group_pair, if_exists: true + end + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 0684e19..5e4178c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2024_12_08_102932) do +ActiveRecord::Schema[8.0].define(version: 2024_12_16_231415) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -30,6 +28,19 @@ ActiveRecord::Schema[8.0].define(version: 2024_12_08_102932) do t.index ["wedding_id"], name: "index_expenses_on_wedding_id" end + create_table "group_affinities", force: :cascade do |t| + t.uuid "group_a_id", null: false + t.uuid "group_b_id", null: false + t.float "discomfort", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index "LEAST(group_a_id, group_b_id), GREATEST(group_a_id, group_b_id)", name: "uindex_group_pair", unique: true + t.index ["group_a_id"], name: "index_group_affinities_on_group_a_id" + t.index ["group_b_id"], name: "index_group_affinities_on_group_b_id" + t.check_constraint "discomfort >= 0::double precision AND discomfort <= 2::double precision" + t.check_constraint "group_a_id <> group_b_id", name: "check_distinct_groups" + end + create_table "groups", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name", null: false t.string "icon" @@ -228,6 +239,8 @@ ActiveRecord::Schema[8.0].define(version: 2024_12_08_102932) do end add_foreign_key "expenses", "weddings" + add_foreign_key "group_affinities", "groups", column: "group_a_id" + add_foreign_key "group_affinities", "groups", column: "group_b_id" add_foreign_key "groups", "groups", column: "parent_id" add_foreign_key "groups", "weddings" add_foreign_key "guests", "groups" diff --git a/docker-compose.yml b/docker-compose.yml index df2c035..93cff59 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,6 +11,13 @@ services: environment: DATABASE_URL: postgres://postgres:postgres@db:5432/postgres RAILS_ENV: development + tty: true + stdin_open: true + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000/up"] + interval: 10s + timeout: 5s + retries: 5 volumes: - .:/rails workers: @@ -32,6 +39,11 @@ services: dockerfile: Dockerfile.dev ports: - 3000 + healthcheck: + test: wget -qO - http://localhost:3000/api/health || exit 1 + interval: 10s + timeout: 5s + retries: 5 depends_on: - backend volumes: @@ -50,8 +62,10 @@ services: volumes: - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro depends_on: - - frontend - - backend + frontend: + condition: service_healthy + backend: + condition: service_healthy db: image: postgres:17 ports: diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb new file mode 100644 index 0000000..6877218 --- /dev/null +++ b/spec/factories/group_affinities.rb @@ -0,0 +1,7 @@ +FactoryBot.define do + factory :group_affinity do + association :group_a, factory: :group + association :group_b, factory: :group + discomfort { GroupAffinity::NEUTRAL } + end +end diff --git a/spec/models/group_affinity_spec.rb b/spec/models/group_affinity_spec.rb new file mode 100644 index 0000000..d346110 --- /dev/null +++ b/spec/models/group_affinity_spec.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe GroupAffinity, type: :model do + let(:wedding) { create(:wedding) } + let(:group_a) { create(:group, wedding:) } + let(:group_b) { create(:group, wedding:) } + let(:group_c) { create(:group, wedding:) } + + subject { build(:group_affinity, group_a:, group_b: ) } + + describe 'validations' do + it { should validate_numericality_of(:discomfort).is_greater_than_or_equal_to(0).is_less_than_or_equal_to(2) } + end + + describe '.create' do + before do + create(:group_affinity, group_a: group_a, group_b: group_b) + end + + it 'disallows the creation of a group affinity with the same group on both sides' do + expect do + create(:group_affinity, group_a: group_c, group_b: group_c) + end.to raise_error(ActiveRecord::StatementInvalid) + end + + it 'disallows the creation of a group affinity that already exists' do + expect do + create(:group_affinity, group_a: group_a, group_b: group_b) + end.to raise_error(ActiveRecord::StatementInvalid) + end + + it 'disallows the creation of a group affinity with the same groups in reverse order' do + expect do + create(:group_affinity, group_a: group_b, group_b: group_a) + end.to raise_error(ActiveRecord::StatementInvalid) + end + end +end diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb new file mode 100644 index 0000000..a78d569 --- /dev/null +++ b/spec/requests/affinities_spec.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +require 'swagger_helper' + +RSpec.describe 'affinities', type: :request do + path '/{slug}/groups/{group_id}/affinities' do + parameter Swagger::Schema::SLUG + parameter name: 'group_id', in: :path, type: :string, format: :uuid, description: 'group_id' + + get('list affinities') do + tags 'Affinities' + produces 'application/json' + + response(200, 'successful') do + schema type: :object, additionalProperties: { type: :integer, minimum: 0, maximum: 2 } + xit + end + end + end + + path '/{slug}/groups/{group_id}/affinities/bulk_update' do + parameter Swagger::Schema::SLUG + parameter name: 'group_id', in: :path, type: :string, format: :uuid, description: 'group_id' + + put('bulk update affinities') do + tags 'Affinities' + produces 'application/json' + consumes 'application/json' + parameter name: :body, in: :body, schema: { + type: :object, + required: [:affinities], + properties: { + affinities: { + type: :array, + items: { + type: :object, + required: %i[group_id discomfort], + properties: { + group_id: { type: :string, format: :uuid, description: 'ID of the associated group' }, + discomfort: { type: :integer, minimum: 0, maximum: 2 } + } + } + } + } + } + + response_empty_200 + end + end +end From 0780b17f4b4f9a6ab844b91face897edf1252857 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Thu, 26 Dec 2024 19:30:32 +0000 Subject: [PATCH 231/283] Add copyright notice --- app/models/group_affinity.rb | 2 ++ db/migrate/20241216231415_create_group_affinities.rb | 2 ++ db/schema.rb | 2 ++ spec/factories/group_affinities.rb | 2 ++ spec/models/group_affinity_spec.rb | 2 ++ spec/requests/affinities_spec.rb | 2 ++ 6 files changed, 12 insertions(+) diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb index c33364c..31e1503 100644 --- a/app/models/group_affinity.rb +++ b/app/models/group_affinity.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # == Schema Information # # Table name: group_affinities diff --git a/db/migrate/20241216231415_create_group_affinities.rb b/db/migrate/20241216231415_create_group_affinities.rb index 1c6789d..2b03897 100644 --- a/db/migrate/20241216231415_create_group_affinities.rb +++ b/db/migrate/20241216231415_create_group_affinities.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class CreateGroupAffinities < ActiveRecord::Migration[8.0] disable_ddl_transaction! diff --git a/db/schema.rb b/db/schema.rb index 5e4178c..f723b74 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index 6877218..bc57226 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + FactoryBot.define do factory :group_affinity do association :group_a, factory: :group diff --git a/spec/models/group_affinity_spec.rb b/spec/models/group_affinity_spec.rb index d346110..05f9330 100644 --- a/spec/models/group_affinity_spec.rb +++ b/spec/models/group_affinity_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index a78d569..39f6afd 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true require 'swagger_helper' From 5784c89b79331a2670d2d82d9760b99c7d4c41cc Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 14:18:59 +0100 Subject: [PATCH 232/283] Refine endpoint to receive an affinity value and transform it into a discomfort equivalent --- app/controllers/affinities_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index 9a2122c..fab690a 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -8,16 +8,16 @@ class AffinitiesController < ApplicationController def index overridden_affinities = @group.affinities .each_with_object({}) { |affinity, acc| acc[affinity.another_group(@group).id] = affinity.discomfort } - Group.pluck(:id).index_with { |group_id| overridden_affinities[group_id] || GroupAffinity::NEUTRAL } + Group.where.not(id: @group.id).pluck(:id).index_with { |group_id| GroupAffinity::MAX_DISCOMFORT - (overridden_affinities[group_id] || GroupAffinity::NEUTRAL) } .then { |affinities| render json: affinities } end def bulk_update - params.expect(affinities: [[:group_id, :discomfort]]).map(&:to_h).map do |affinity| + params.expect(affinities: [[:group_id, :affinity]]).map(&:to_h).map do |affinity| { group_a_id: @group.id, group_b_id: affinity[:group_id], - discomfort: affinity[:discomfort] + discomfort: GroupAffinity::MAX_DISCOMFORT - affinity[:affinity] } end.then { |affinities| GroupAffinity.upsert_all(affinities) } render json: {}, status: :ok @@ -25,7 +25,7 @@ class AffinitiesController < ApplicationController rescue ActiveRecord::InvalidForeignKey render json: { error: 'At least one of the group IDs provided does not exist.' }, status: :bad_request rescue ActiveRecord::StatementInvalid - render json: { error: 'Invalid group ID or discomfort provided.' } + render json: { error: 'Invalid group ID or discomfort provided.' }, status: :bad_request end private From 9fe649f8b84ac7dc327f612b9b7a174732d8675a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 16:43:58 +0100 Subject: [PATCH 233/283] Update swagger documentation --- spec/requests/affinities_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index 39f6afd..6e113d2 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -36,10 +36,10 @@ RSpec.describe 'affinities', type: :request do type: :array, items: { type: :object, - required: %i[group_id discomfort], + required: %i[group_id affinity], properties: { group_id: { type: :string, format: :uuid, description: 'ID of the associated group' }, - discomfort: { type: :integer, minimum: 0, maximum: 2 } + affinity: { type: :integer, minimum: 0, maximum: 2 } } } } From 5fcac34a521591fbd24fe8b08164473d86cc6cec Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 17:08:57 +0100 Subject: [PATCH 234/283] Install Rubocop extensions --- .rubocop.yml | 13 +++ Gemfile | 20 ++-- Gemfile.lock | 323 +++++++++++++++++++++++++++------------------------ 3 files changed, 196 insertions(+), 160 deletions(-) create mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..c316e05 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,13 @@ +require: + - rubocop-rails + - rubocop-factory_bot + - rubocop-rspec + - rubocop-rspec_rails +AllCops: + NewCops: enable + Exclude: + - 'db/**/*' + - 'config/**/*' + - 'script/**/*' + - 'bin/{rails,rake}' + - '*.yml' \ No newline at end of file diff --git a/Gemfile b/Gemfile index 0a618dd..8471272 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source 'https://rubygems.org' +# frozen_string_literal: true ruby '3.3.6' gem 'bootsnap', require: false @@ -15,15 +15,15 @@ gem 'stimulus-rails' gem 'turbo-rails' gem 'tzinfo-data', platforms: %i[windows jruby] +gem 'acts_as_tenant' gem 'faker' +gem 'httparty' gem 'jsonapi-rails' +gem 'pluck_to_hash' gem 'rack-cors' gem 'react-rails' -gem 'rubytree' -gem 'acts_as_tenant' -gem 'httparty' gem 'rswag' -gem 'pluck_to_hash' +gem 'rubytree' group :development, :test do gem 'annotaterb' @@ -36,12 +36,16 @@ group :development, :test do end group :development do - gem 'rubocop' - gem 'web-console' gem 'letter_opener_web' + gem 'rubocop' + gem 'rubocop-factory_bot', require: false + gem 'rubocop-rails', require: false + gem 'rubocop-rspec', require: false + gem 'rubocop-rspec_rails', require: false + gem 'web-console' end gem 'chroma' gem 'solid_queue', '~> 1.0' -gem "devise", "~> 4.9" +gem 'devise', '~> 4.9' diff --git a/Gemfile.lock b/Gemfile.lock index f55a087..df07989 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,4 @@ GEM - remote: https://rubygems.org/ specs: actioncable (8.0.1) actionpack (= 8.0.1) @@ -339,6 +338,18 @@ GEM unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.36.2) parser (>= 3.3.1.0) + rubocop-factory_bot (2.26.1) + rubocop (~> 1.61) + rubocop-rails (2.28.0) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.52.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rspec (3.3.0) + rubocop (~> 1.61) + rubocop-rspec_rails (2.30.0) + rubocop (~> 1.61) + rubocop-rspec (~> 3, >= 3.0.1) ruby-progressbar (1.13.0) rubytree (2.1.0) json (~> 2.0, > 2.3.1) @@ -426,6 +437,10 @@ DEPENDENCIES rspec-rails (~> 7.1.0) rswag rubocop + rubocop-factory_bot + rubocop-rails + rubocop-rspec + rubocop-rspec_rails rubytree shoulda-matchers (~> 6.0) solid_queue (~> 1.0) @@ -436,157 +451,161 @@ DEPENDENCIES web-console CHECKSUMS - actioncable (8.0.1) sha256=808bff2a4e3aba36f66f0cd65d7a1579ad52fb65e99304442c46051a79689d9b - actionmailbox (8.0.1) sha256=bbc7db779be857fb6eb5b53f313d3881cd8cda38a150c3aa25f89f2f9977b08c - actionmailer (8.0.1) sha256=7b074e9590e4ec5cebd2fc91d1f9ba4c61bbd4bbd4376f731527da187cd39952 - actionpack (8.0.1) sha256=c764e4bfc0ad9d3505c09ef9b6fbf9eca4292793550c6b7e2ea93167181bfcba - actiontext (8.0.1) sha256=f232d303e854db2098f34d7331fe493a72dc2e53dfce80fbd517c7b93d4b05b2 - actionview (8.0.1) sha256=3005e3de5ca49ea789bf1ad46002d63fe5aa543c61c341239d3c533757e64f8a - activejob (8.0.1) sha256=95acd9a32d498d3a458efbb317f6191fb678758cde0ebb6c68f0b25e0fe3477f - activemodel (8.0.1) sha256=f46292fd6dcc128e18d588854298a933fd9eb22544c412b414ec02821062dc78 - activerecord (8.0.1) sha256=34a7f0610660bb704f0363025d4b8d35ffe8ddc8f5b8147e0809171f724b5306 - activestorage (8.0.1) sha256=91a8f156638568fac971ff25962a617d9c58fdc0e44eb6bd0edff36aff7df205 - activesupport (8.0.1) sha256=fd5bc74641c24ac3541055c2879789198ff42adee3e39c2933289ba008912e37 - acts_as_tenant (1.0.1) sha256=6944e4d64533337938a8817a6b4ff9b11189c9dcc0b1333bb89f3821a4c14c53 - addressable (2.8.7) sha256=462986537cf3735ab5f3c0f557f14155d778f4b43ea4f485a9deb9c8f7c58232 - annotaterb (4.13.0) sha256=6f472912002fefa735665b4132de47d0134ebf1efb76a7ef05f579cc4a6b2ff1 - ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12 - babel-source (5.8.35) sha256=79ef222a9dcb867ac2efa3b0da35b4bcb15a4bfa67b6b2dcbf1e9a29104498d9 - babel-transpiler (0.7.0) sha256=4c06f4ad9e8e1cabe94f99e11df2f140bb72aca9ba067dbb49dc14d9b98d1570 - base64 (0.2.0) sha256=0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507 - bcrypt (3.1.20) sha256=8410f8c7b3ed54a3c00cd2456bf13917d695117f033218e2483b2e40b0784099 - benchmark (0.4.0) sha256=0f12f8c495545e3710c3e4f0480f63f06b4c842cc94cec7f33a956f5180e874a - bigdecimal (3.1.8) sha256=a89467ed5a44f8ae01824af49cbc575871fa078332e8f77ea425725c1ffe27be - bindex (0.8.1) sha256=7b1ecc9dc539ed8bccfc8cb4d2732046227b09d6f37582ff12e50a5047ceb17e - bootsnap (1.18.4) sha256=ac4c42af397f7ee15521820198daeff545e4c360d2772c601fbdc2c07d92af55 - builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f - childprocess (5.1.0) sha256=9a8d484be2fd4096a0e90a0cd3e449a05bc3aa33f8ac9e4d6dcef6ac1455b6ec - chroma (0.2.0) sha256=64bdcd36a4765fbcd45adc64960cc153101300b4918f90ffdd89f4e2eb954b54 - coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b - concurrent-ruby (1.3.4) sha256=d4aa926339b0a86b5b5054a0a8c580163e6f5dcbdfd0f4bb916b1a2570731c32 - connection_pool (2.4.1) sha256=0f40cf997091f1f04ff66da67eabd61a9fe0d4928b9a3645228532512fab62f4 - crass (1.0.6) sha256=dc516022a56e7b3b156099abc81b6d2b08ea1ed12676ac7a5657617f012bd45d - csv (3.3.2) sha256=6ff0c135e65e485d1864dde6c1703b60d34cc9e19bed8452834a0b28a519bd4e - date (3.4.1) sha256=bf268e14ef7158009bfeaec40b5fa3c7271906e88b196d958a89d4b408abe64f - debug (1.10.0) sha256=11e28ca74875979e612444104f3972bd5ffb9e79179907d7ad46dba44bd2e7a4 - devise (4.9.4) sha256=920042fe5e704c548aa4eb65ebdd65980b83ffae67feb32c697206bfd975a7f8 - diff-lcs (1.5.1) sha256=273223dfb40685548436d32b4733aa67351769c7dea621da7d9dd4813e63ddfe - drb (2.2.1) sha256=e9d472bf785f558b96b25358bae115646da0dbfd45107ad858b0bc0d935cb340 - erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9 - et-orbi (1.2.11) sha256=d26e868cc21db88280a9ec1a50aa3da5d267eb9b2037ba7b831d6c2731f5df64 - execjs (2.9.1) sha256=e8fd066f6df60c8e8fbebc32c6fb356b5212c77374e8416a9019ca4bb154dcfb - factory_bot (6.4.6) sha256=1a9486ce98d318d740d8f5804b885a8265a28f326ecf2bcd4ce9fb27a71a6e04 - factory_bot_rails (6.4.3) sha256=ea73ceac1c0ff3dc11fff390bf2ea8a2604066525ed8ecd3b3bc2c267226dcc8 - faker (3.5.1) sha256=1ad1fbea279d882f486059c23fe3ddb816ccd1d7052c05a45014b4450d859bfc - fugit (1.11.1) sha256=e89485e7be22226d8e9c6da411664d0660284b4b1c08cacb540f505907869868 - globalid (1.2.1) sha256=70bf76711871f843dbba72beb8613229a49429d1866828476f9c9d6ccc327ce9 - httparty (0.22.0) sha256=78652a5c9471cf0093d3b2083c2295c9c8f12b44c65112f1846af2b71430fa6c - i18n (1.14.6) sha256=dc229a74f5d181f09942dd60ab5d6e667f7392c4ee826f35096db36d1fe3614c - importmap-rails (2.1.0) sha256=9f10c67d60651a547579f448100d033df311c5d5db578301374aeb774faae741 - io-console (0.8.0) sha256=cd6a9facbc69871d69b2cb8b926fc6ea7ef06f06e505e81a64f14a470fddefa2 - irb (1.14.3) sha256=c457f1f2f1438ae9ce5c5be3981ae2138dec7fb894c7d73777eeeb0a6c0d0752 - jbuilder (2.13.0) sha256=7200a38a1c0081aa81b7a9757e7a299db75bc58cf1fd45ca7919a91627d227d6 - json (2.8.2) sha256=dd4fa6c9c81daecf72b86ea36e56ed8955fdbb4d4dc379c93d313a59344486cf - json-schema (5.0.1) sha256=bef71a82c600a42594911553522e143f7634affc198ed507ef3ded2f920a74a9 - jsonapi-deserializable (0.2.0) sha256=5f0ca2d3f8404cce1584a314e8a3753be32a56054c942adfe997b87e92bce147 - jsonapi-parser (0.1.1) sha256=9ee0dc031e88fc7548d56fab66f9716d1e1c06f972b529b8c4617bc42a097020 - jsonapi-rails (0.4.1) sha256=fa68b927b58f194e8b81f578c0bf18e61575638f45a390f66c832de2e6d179ba - jsonapi-rb (0.5.0) sha256=7922a164278f506c43d56277f6bd0800a0b603cc985f7f63fe7241b2628bd105 - jsonapi-renderer (0.2.2) sha256=b5c44b033d61b4abdb6500fa4ab84807ca0b36ea0e59e47a2c3ca7095a6e447b - jsonapi-serializable (0.3.1) sha256=221e657677659d798e268a33ec97a83ec5ea0e4233f931358db84e88056552e9 - language_server-protocol (3.17.0.3) sha256=3d5c58c02f44a20d972957a9febe386d7e7468ab3900ce6bd2b563dd910c6b3f - launchy (3.0.1) sha256=b7fa60bda0197cf57614e271a250a8ca1f6a34ab889a3c73f67ec5d57c8a7f2c - letter_opener (1.10.0) sha256=2ff33f2e3b5c3c26d1959be54b395c086ca6d44826e8bf41a14ff96fdf1bdbb2 - letter_opener_web (3.0.0) sha256=3f391efe0e8b9b24becfab5537dfb17a5cf5eb532038f947daab58cb4b749860 - license_finder (7.2.1) sha256=179ead19b64b170638b72fd16024233813673ac9d20d5ba75ae0b4444887ef14 - logger (1.6.4) sha256=b627b91c922231050932e7bf8ee886fe54790ba2238a468ead52ba21911f2ee7 - loofah (2.23.1) sha256=d0a07422cb3b69272e124afa914ef6d517e30d5496b7f1c1fc5b95481f13f75e - mail (2.8.1) sha256=ec3b9fadcf2b3755c78785cb17bc9a0ca9ee9857108a64b6f5cfc9c0b5bfc9ad - marcel (1.0.4) sha256=0d5649feb64b8f19f3d3468b96c680bae9746335d02194270287868a661516a4 - method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5 - mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef - minitest (5.25.4) sha256=9cf2cae25ac4dfc90c988ebc3b917f53c054978b673273da1bd20bcb0778f947 - money (6.19.0) sha256=ec936fa1e42f2783719241ed9fd52725d0efa628f928feea1eb5c37d5de7daf3 - msgpack (1.7.2) sha256=59ab62fd8a4d0dfbde45009f87eb6f158ab2628a7c48886b0256f175166baaa8 - multi_xml (0.7.1) sha256=4fce100c68af588ff91b8ba90a0bb3f0466f06c909f21a32f4962059140ba61b - net-imap (0.5.2) sha256=e955b55e539712518bdb4eb747c6514f9c8d56ec4eb8eb573a82a6885a9effea - net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3 - net-protocol (0.2.2) sha256=aa73e0cba6a125369de9837b8d8ef82a61849360eba0521900e2c3713aa162a8 - net-smtp (0.5.0) sha256=5fc0415e6ea1cc0b3dfea7270438ec22b278ca8d524986a3ae4e5ae8d087b42a - nio4r (2.7.4) sha256=d95dee68e0bb251b8ff90ac3423a511e3b784124e5db7ff5f4813a220ae73ca9 - nokogiri (1.17.2-aarch64-linux) sha256=585c8cac6380848b7973bacfd0584628d116810e5f209db25e22d0c32313e681 - nokogiri (1.17.2-arm-linux) sha256=3d033ad9b09d5b8a203f0f2156053e93a9327a9c7887c0ceb9fa78c71d27280d - nokogiri (1.17.2-arm64-darwin) sha256=0c5eb06ba1c112d33c2bb29973b07e2f21c4ddb66c67c9386fd97ff1c5d84686 - nokogiri (1.17.2-x86-linux) sha256=8c4dd75e35810bdeb7c74943f383ca665baf6aed8fc2b78c1d305094a72794aa - nokogiri (1.17.2-x86_64-darwin) sha256=dc5977eb3416e1d501b22b0ed4737bf7604121491405865b887975eacfb3e896 - nokogiri (1.17.2-x86_64-linux) sha256=e8614ae8d776bd9adb535ca814375e7ae05d7cfa6aa01909e561484f6d70be0b - orm_adapter (0.5.0) sha256=aa5d0be5d540cbb46d3a93e88061f4ece6a25f6e97d6a47122beb84fe595e9b9 - parallel (1.26.3) sha256=d86babb7a2b814be9f4b81587bf0b6ce2da7d45969fab24d8ae4bf2bb4d4c7ef - parser (3.3.6.0) sha256=25d4e67cc4f0f7cab9a2ae1f38e2005b6904d2ea13c34734511d0faad038bc3b - pg (1.5.9) sha256=761efbdf73b66516f0c26fcbe6515dc7500c3f0aa1a1b853feae245433c64fdc - pluck_to_hash (1.0.2) sha256=1599906239716f98262a41493dd7d4cb72e8d83ad3d76d666deacfc5de50a47e - pry (0.15.2) sha256=12d54b8640d3fa29c9211dd4ffb08f3fd8bf7a4fd9b5a73ce5b59c8709385b6b - psych (5.2.2) sha256=a4a9477c85d3e858086c38cf64e7096abe40d1b1eed248b01020dec0ff9906ab - public_suffix (6.0.1) sha256=61d44e1cab5cbbbe5b31068481cf16976dd0dc1b6b07bd95617ef8c5e3e00c6f - puma (6.5.0) sha256=94d1b75cab7f356d52e4f1b17b9040a090889b341dbeee6ee3703f441dc189f2 - raabro (1.4.0) sha256=d4fa9ff5172391edb92b242eed8be802d1934b1464061ae5e70d80962c5da882 - racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f - rack (3.1.8) sha256=d3fbcbca43dc2b43c9c6d7dfbac01667ae58643c42cea10013d0da970218a1b1 - rack-cors (2.0.2) sha256=415d4e1599891760c5dc9ef0349c7fecdf94f7c6a03e75b2e7c2b54b82adda1b - rack-session (2.0.0) sha256=db04b2063e180369192a9046b4559af311990af38c6a93d4c600cee4eb6d4e81 - rack-test (2.1.0) sha256=0c61fc61904049d691922ea4bb99e28004ed3f43aa5cfd495024cc345f125dfb - rackup (2.2.1) sha256=f737191fd5c5b348b7f0a4412a3b86383f88c43e13b8217b63d4c8d90b9e798d - rails (8.0.1) sha256=c86f4cd7834a67c1e5d04a77d35c88a5f56a20e2022ec416fa52c1af2cdc9491 - rails-dom-testing (2.2.0) sha256=e515712e48df1f687a1d7c380fd7b07b8558faa26464474da64183a7426fa93b - rails-html-sanitizer (1.6.2) sha256=35fce2ca8242da8775c83b6ba9c1bcaad6751d9eb73c1abaa8403475ab89a560 - railties (8.0.1) sha256=8f653c6b1b0721b553045bd0deda1f22074b9ddc2209526e6f7285fcf607ac51 - rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a - rake (13.2.1) sha256=46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d - rdoc (6.10.0) sha256=db665021883ac9df3ba29cdf71aece960749888db1bf9615b4a584cfa3fa3eda - react-rails (3.2.1) sha256=2235db0b240517596b1cb3e26177ab5bc64d3a56579b0415ee242b1691f81f64 - redis (5.3.0) sha256=6bf810c5ae889187f0c45f77db503310980310afa57cf1640d57f419ccda72b1 - redis-client (0.22.2) sha256=31fee4b7cf04109b227327fabeaaf1fc5b652cf48a186a03bc607e40767bacc0 - regexp_parser (2.9.3) sha256=4b620657ed8349d82e1331a076415c79b9dd714a5546162ddd790ea9988f6379 - reline (0.6.0) sha256=57620375dcbe56ec09bac7192bfb7460c716bbf0054dc94345ecaa5438e539d2 - responders (3.1.1) sha256=92f2a87e09028347368639cfb468f5fefa745cb0dc2377ef060db1cdd79a341a - rexml (3.3.9) sha256=d71875b85299f341edf47d44df0212e7658cbdf35aeb69cefdb63f57af3137c9 - rspec-core (3.13.2) sha256=94fbda6e4738e478f1c7532b7cc241272fcdc8b9eac03a97338b1122e4573300 - rspec-expectations (3.13.3) sha256=0e6b5af59b900147698ea0ff80456c4f2e69cac4394fbd392fbd1ca561f66c58 - rspec-mocks (3.13.2) sha256=2327335def0e1665325a9b617e3af9ae20272741d80ac550336309a7c59abdef - rspec-rails (7.1.0) sha256=94585b69c4086ca79afae5cc8d2c5e314f6ad32a88c927f9c065b99596e3ee47 - rspec-support (3.13.1) sha256=48877d4f15b772b7538f3693c22225f2eda490ba65a0515c4e7cf6f2f17de70f - rswag (2.16.0) sha256=f07ce41548b9bb51464c38bc7b95af22fee84b90f2d1197a515a623906353086 - rswag-api (2.16.0) sha256=b653f7bd92e98be18b01ab4525d88950d7b0960e293a99f856b9efcee3ae6074 - rswag-specs (2.16.0) sha256=8ba26085c408b0bd2ed21dc8015c80f417c7d34c63720ab7133c2549b5bd2a91 - rswag-ui (2.16.0) sha256=a1f49e927dceda92e6e6e7c1000f1e217ee66c565f69e28131dc98b33cd3a04f - rubocop (1.69.2) sha256=762fb0f30a379bf6054588d39f1815a2a1df8f067bc0337d3fe500e346924bb8 - rubocop-ast (1.36.2) sha256=566405b7f983eb9aa3b91d28aca6bc6566e356a97f59e89851dd910aef1dd1ca - ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 - rubytree (2.1.0) sha256=30e8759ba060dff0dabf7e40cbaaa4df892fa34cbe9f1b3fbb00e83a3f321e4b - rubyzip (2.3.2) sha256=3f57e3935dc2255c414484fbf8d673b4909d8a6a57007ed754dde39342d2373f - securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 - shoulda-matchers (6.4.0) sha256=9055bb7f4bb342125fb860809798855c630e05ef5e75837b3168b8e6ee1608b0 - solid_queue (1.1.0) sha256=55c7b1d65f2943ec8f3deee36fcb0cae91d5fa60410b294775db9da22be8353c - sprockets (4.2.1) sha256=951b13dd2f2fcae840a7184722689a803e0ff9d2702d902bd844b196da773f97 - sprockets-rails (3.5.2) sha256=a9e88e6ce9f8c912d349aa5401509165ec42326baf9e942a85de4b76dbc4119e - stimulus-rails (1.3.4) sha256=765676ffa1f33af64ce026d26b48e8ffb2e0b94e0f50e9119e11d6107d67cb06 - stringio (3.1.2) sha256=204f1828f85cdb39d57cac4abc6dc44b04505a223f131587f2e20ae3729ba131 - thor (1.3.2) sha256=eef0293b9e24158ccad7ab383ae83534b7ad4ed99c09f96f1a6b036550abbeda - tilt (2.4.0) sha256=df74f29a451daed26591a85e8e0cebb198892cb75b6573394303acda273fba4d - timeout (0.4.3) sha256=9509f079b2b55fe4236d79633bd75e34c1c1e7e3fb4b56cb5fda61f80a0fe30e - tomlrb (2.0.3) sha256=c2736acf24919f793334023a4ff396c0647d93fce702a73c9d348deaa815d4f7 - turbo-rails (2.0.11) sha256=fc47674736372780abd2a4dc0d84bef242f5ca156a457cd7fa6308291e397fcf - tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b - unicode-display_width (2.6.0) sha256=12279874bba6d5e4d2728cef814b19197dbb10d7a7837a869bab65da943b7f5a - uri (1.0.2) sha256=b303504ceb7e5905771fa7fa14b649652fa949df18b5880d69cfb12494791e27 - useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844 - warden (1.2.9) sha256=46684f885d35a69dbb883deabf85a222c8e427a957804719e143005df7a1efd0 - web-console (4.2.1) sha256=e7bcf37a10ea2b4ec4281649d1cee461b32232d0a447e82c786e6841fd22fe20 - websocket-driver (0.7.6) sha256=f69400be7bc197879726ad8e6f5869a61823147372fd8928836a53c2c741d0db - websocket-extensions (0.1.5) sha256=1c6ba63092cda343eb53fc657110c71c754c56484aad42578495227d717a8241 - with_env (1.1.0) sha256=50b3e4f0a6cda8f90d8a6bd87a6261f6c381429abafb161c4c69ad4a0cd0b6e4 - xml-simple (1.1.9) sha256=d21131e519c86f1a5bc2b6d2d57d46e6998e47f18ed249b25cad86433dbd695d - zeitwerk (2.7.1) sha256=0945986050e4907140895378e74df1fe882a2271ed087cc6c6d6b00d415a2756 + actioncable (8.0.1) + actionmailbox (8.0.1) + actionmailer (8.0.1) + actionpack (8.0.1) + actiontext (8.0.1) + actionview (8.0.1) + activejob (8.0.1) + activemodel (8.0.1) + activerecord (8.0.1) + activestorage (8.0.1) + activesupport (8.0.1) + acts_as_tenant (1.0.1) + addressable (2.8.7) + annotaterb (4.13.0) + ast (2.4.2) + babel-source (5.8.35) + babel-transpiler (0.7.0) + base64 (0.2.0) + bcrypt (3.1.20) + benchmark (0.4.0) + bigdecimal (3.1.8) + bindex (0.8.1) + bootsnap (1.18.4) + builder (3.3.0) + childprocess (5.1.0) + chroma (0.2.0) + coderay (1.1.3) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) + crass (1.0.6) + csv (3.3.2) + date (3.4.1) + debug (1.10.0) + devise (4.9.4) + diff-lcs (1.5.1) + drb (2.2.1) + erubi (1.13.1) + et-orbi (1.2.11) + execjs (2.9.1) + factory_bot (6.4.6) + factory_bot_rails (6.4.3) + faker (3.5.1) + fugit (1.11.1) + globalid (1.2.1) + httparty (0.22.0) + i18n (1.14.6) + importmap-rails (2.1.0) + io-console (0.8.0) + irb (1.14.3) + jbuilder (2.13.0) + json (2.8.2) + json-schema (5.0.1) + jsonapi-deserializable (0.2.0) + jsonapi-parser (0.1.1) + jsonapi-rails (0.4.1) + jsonapi-rb (0.5.0) + jsonapi-renderer (0.2.2) + jsonapi-serializable (0.3.1) + language_server-protocol (3.17.0.3) + launchy (3.0.1) + letter_opener (1.10.0) + letter_opener_web (3.0.0) + license_finder (7.2.1) + logger (1.6.4) + loofah (2.23.1) + mail (2.8.1) + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.4) + money (6.19.0) + msgpack (1.7.2) + multi_xml (0.7.1) + net-imap (0.5.2) + net-pop (0.1.2) + net-protocol (0.2.2) + net-smtp (0.5.0) + nio4r (2.7.4) + nokogiri (1.17.2-aarch64-linux) + nokogiri (1.17.2-arm-linux) + nokogiri (1.17.2-arm64-darwin) + nokogiri (1.17.2-x86-linux) + nokogiri (1.17.2-x86_64-darwin) + nokogiri (1.17.2-x86_64-linux) + orm_adapter (0.5.0) + parallel (1.26.3) + parser (3.3.6.0) + pg (1.5.9) + pluck_to_hash (1.0.2) + pry (0.15.2) + psych (5.2.2) + public_suffix (6.0.1) + puma (6.5.0) + raabro (1.4.0) + racc (1.8.1) + rack (3.1.8) + rack-cors (2.0.2) + rack-session (2.0.0) + rack-test (2.1.0) + rackup (2.2.1) + rails (8.0.1) + rails-dom-testing (2.2.0) + rails-html-sanitizer (1.6.2) + railties (8.0.1) + rainbow (3.1.1) + rake (13.2.1) + rdoc (6.10.0) + react-rails (3.2.1) + redis (5.3.0) + redis-client (0.22.2) + regexp_parser (2.9.3) + reline (0.6.0) + responders (3.1.1) + rexml (3.3.9) + rspec-core (3.13.2) + rspec-expectations (3.13.3) + rspec-mocks (3.13.2) + rspec-rails (7.1.0) + rspec-support (3.13.1) + rswag (2.16.0) + rswag-api (2.16.0) + rswag-specs (2.16.0) + rswag-ui (2.16.0) + rubocop (1.69.2) + rubocop-ast (1.36.2) + rubocop-factory_bot (2.26.1) + rubocop-rails (2.28.0) + rubocop-rspec (3.3.0) + rubocop-rspec_rails (2.30.0) + ruby-progressbar (1.13.0) + rubytree (2.1.0) + rubyzip (2.3.2) + securerandom (0.4.1) + shoulda-matchers (6.4.0) + solid_queue (1.1.0) + sprockets (4.2.1) + sprockets-rails (3.5.2) + stimulus-rails (1.3.4) + stringio (3.1.2) + thor (1.3.2) + tilt (2.4.0) + timeout (0.4.3) + tomlrb (2.0.3) + turbo-rails (2.0.11) + tzinfo (2.0.6) + unicode-display_width (2.6.0) + uri (1.0.2) + useragent (0.16.11) + warden (1.2.9) + web-console (4.2.1) + websocket-driver (0.7.6) + websocket-extensions (0.1.5) + with_env (1.1.0) + xml-simple (1.1.9) + zeitwerk (2.7.1) RUBY VERSION ruby 3.3.6p108 From 4d6986397417f71c0abfc26ecbeb1eeb83908385 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 17:27:28 +0100 Subject: [PATCH 235/283] Run Rubocop autocorrect on spec/models --- .rubocop.yml | 6 +++++- spec/models/expense_spec.rb | 12 +++++++----- spec/models/group_affinity_spec.rb | 12 ++++++++---- spec/models/group_spec.rb | 6 ++++-- spec/models/guest_spec.rb | 15 +++++++++----- spec/models/seat_spec.rb | 4 +++- spec/models/tables_arrangement_spec.rb | 4 +++- spec/models/user_spec.rb | 4 +++- spec/models/wedding_spec.rb | 27 ++++++++++++++------------ 9 files changed, 58 insertions(+), 32 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index c316e05..3ec2fa4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -10,4 +10,8 @@ AllCops: - 'config/**/*' - 'script/**/*' - 'bin/{rails,rake}' - - '*.yml' \ No newline at end of file + - '*.yml' +Layout/LineLength: + Max: 120 +RSpec/ExampleLength: + Max: 10 \ No newline at end of file diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index 973ccf2..d6d5f89 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -1,12 +1,14 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe Expense, type: :model do +RSpec.describe Expense do describe 'validations' do - it { should validate_presence_of(:name) } - it { should validate_presence_of(:amount) } - it { should validate_numericality_of(:amount).is_greater_than(0) } - it { should validate_presence_of(:pricing_type) } + it { is_expected.to validate_presence_of(:name) } + it { is_expected.to validate_presence_of(:amount) } + it { is_expected.to validate_numericality_of(:amount).is_greater_than(0) } + it { is_expected.to validate_presence_of(:pricing_type) } end end diff --git a/spec/models/group_affinity_spec.rb b/spec/models/group_affinity_spec.rb index 05f9330..9d56d08 100644 --- a/spec/models/group_affinity_spec.rb +++ b/spec/models/group_affinity_spec.rb @@ -4,16 +4,20 @@ require 'rails_helper' -RSpec.describe GroupAffinity, type: :model do +RSpec.describe GroupAffinity do + subject(:affinity) { build(:group_affinity, group_a:, group_b:) } + let(:wedding) { create(:wedding) } let(:group_a) { create(:group, wedding:) } let(:group_b) { create(:group, wedding:) } let(:group_c) { create(:group, wedding:) } - subject { build(:group_affinity, group_a:, group_b: ) } - describe 'validations' do - it { should validate_numericality_of(:discomfort).is_greater_than_or_equal_to(0).is_less_than_or_equal_to(2) } + it do + expect(affinity).to validate_numericality_of(:discomfort) + .is_greater_than_or_equal_to(0) + .is_less_than_or_equal_to(2) + end end describe '.create' do diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 10102f4..1bf6ae3 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe Group, type: :model do +RSpec.describe Group do describe 'callbacks' do - it 'should set color before create' do + it 'sets color before create' do expect(create(:group).color).to be_present end end diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index 6786271..711e5ca 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -1,12 +1,17 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe Guest, type: :model do +RSpec.describe Guest do describe 'validations' do - it { should validate_presence_of(:name) } + subject(:guest) { build(:guest) } + + it { is_expected.to validate_presence_of(:name) } + it do - should define_enum_for(:status).with_values( + expect(guest).to define_enum_for(:status).with_values( considered: 0, invited: 10, confirmed: 20, @@ -16,7 +21,7 @@ RSpec.describe Guest, type: :model do end end - it { should belong_to(:group).optional } + it { is_expected.to belong_to(:group).optional } describe 'scopes' do describe '.potential' do @@ -27,7 +32,7 @@ RSpec.describe Guest, type: :model do confirmed_guest = create(:guest, status: :confirmed) tentative_guest = create(:guest, status: :tentative) - expect(Guest.potential).to match_array([invited_guest, confirmed_guest, tentative_guest]) + expect(described_class.potential).to contain_exactly(invited_guest, confirmed_guest, tentative_guest) end end end diff --git a/spec/models/seat_spec.rb b/spec/models/seat_spec.rb index 2020f33..86140a2 100644 --- a/spec/models/seat_spec.rb +++ b/spec/models/seat_spec.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe Seat, type: :model do +RSpec.describe Seat do pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index 4db0859..66e61ac 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe TablesArrangement, type: :model do +RSpec.describe TablesArrangement do describe 'callbacks' do it 'assigns a name before creation' do expect(create(:tables_arrangement).name).to be_present diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 0277d58..ae4a2d5 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe User, type: :model do +RSpec.describe User do pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index 6ec8a3e..5664367 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -1,22 +1,25 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe Wedding, type: :model do +RSpec.describe Wedding do describe 'validations' do subject { build(:wedding) } - describe 'slug' do - it { should allow_value('foo').for(:slug) } - it { should allow_value('foo-bar').for(:slug) } - it { should allow_value('foo-123').for(:slug) } - it { should allow_value('foo-123-').for(:slug) } - it { should allow_value('foo--123').for(:slug) } - it { should_not allow_value('Foo').for(:slug) } - it { should_not allow_value('/foo').for(:slug) } - it { should_not allow_value('foo/123').for(:slug) } - it { should_not allow_value('foo_123').for(:slug) } - it { should_not allow_value('foo/').for(:slug) } + describe 'slug' do + it { is_expected.to allow_value('foo').for(:slug) } + it { is_expected.to allow_value('foo-bar').for(:slug) } + it { is_expected.to allow_value('foo-123').for(:slug) } + it { is_expected.to allow_value('foo-123-').for(:slug) } + it { is_expected.to allow_value('foo--123').for(:slug) } + + it { is_expected.not_to allow_value('Foo').for(:slug) } + it { is_expected.not_to allow_value('/foo').for(:slug) } + it { is_expected.not_to allow_value('foo/123').for(:slug) } + it { is_expected.not_to allow_value('foo_123').for(:slug) } + it { is_expected.not_to allow_value('foo/').for(:slug) } end end end From 82f17056be4b63c537720003ef6ff1b692d51de5 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 17:28:16 +0100 Subject: [PATCH 236/283] Run rubocop autocorrect on factory files --- spec/factories/expense.rb | 31 +++++++++++++++-------------- spec/factories/group_affinities.rb | 6 ++++-- spec/factories/groups.rb | 2 ++ spec/factories/guest.rb | 2 ++ spec/factories/table_arrangement.rb | 3 ++- spec/factories/users.rb | 2 ++ spec/factories/weddings.rb | 2 ++ 7 files changed, 30 insertions(+), 18 deletions(-) diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index 726d94d..d2db7cd 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -1,19 +1,20 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do - factory :expense do - wedding - sequence(:name) { |i| "Expense #{i}" } - pricing_type { "fixed" } - amount { 100 } - end - - trait :fixed do - pricing_type { "fixed" } - end - - trait :per_person do - pricing_type { "per_person" } - end + factory :expense do + wedding + sequence(:name) { |i| "Expense #{i}" } + pricing_type { 'fixed' } + amount { 100 } end - \ No newline at end of file + + trait :fixed do + pricing_type { 'fixed' } + end + + trait :per_person do + pricing_type { 'per_person' } + end +end diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index bc57226..217f2a9 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do factory :group_affinity do - association :group_a, factory: :group - association :group_b, factory: :group + group_a factory: %i[group] + group_b factory: %i[group] discomfort { GroupAffinity::NEUTRAL } end end diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index ccd1156..659b125 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index 28f3b80..5a81e22 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb index 693e68a..e91e807 100644 --- a/spec/factories/table_arrangement.rb +++ b/spec/factories/table_arrangement.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do @@ -5,4 +7,3 @@ FactoryBot.define do wedding end end - \ No newline at end of file diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 2aa8a37..fd61bfa 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index 5a765a1..14f7d96 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do From c7b9c83f37c6da967f4341480304d3196a372b47 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 16:31:27 +0000 Subject: [PATCH 237/283] Add copyright notice --- spec/factories/expense.rb | 2 ++ spec/factories/group_affinities.rb | 2 ++ spec/factories/groups.rb | 2 ++ spec/factories/guest.rb | 2 ++ spec/factories/table_arrangement.rb | 2 ++ spec/factories/users.rb | 2 ++ spec/factories/weddings.rb | 2 ++ spec/models/expense_spec.rb | 2 ++ spec/models/group_spec.rb | 2 ++ spec/models/guest_spec.rb | 2 ++ spec/models/seat_spec.rb | 2 ++ spec/models/tables_arrangement_spec.rb | 2 ++ spec/models/user_spec.rb | 2 ++ spec/models/wedding_spec.rb | 2 ++ 14 files changed, 28 insertions(+) diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index d2db7cd..f794723 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index 217f2a9..de2069e 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 659b125..3b73bdb 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index 5a81e22..5fe1ad7 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb index e91e807..fd48313 100644 --- a/spec/factories/table_arrangement.rb +++ b/spec/factories/table_arrangement.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/factories/users.rb b/spec/factories/users.rb index fd61bfa..69b6b6e 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index 14f7d96..70f947a 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index d6d5f89..6858913 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 1bf6ae3..2dbbe0b 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index 711e5ca..30b927e 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/seat_spec.rb b/spec/models/seat_spec.rb index 86140a2..8d77e35 100644 --- a/spec/models/seat_spec.rb +++ b/spec/models/seat_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index 66e61ac..653fe66 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index ae4a2d5..e5bbef4 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index 5664367..5840b0a 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo From b85e2ef93269bdaa4a8c2282637135da3b60b41b Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 17:30:55 +0100 Subject: [PATCH 238/283] Run Rubocop autocorrect on spec/extensions --- spec/extensions/tree_spec.rb | 44 +++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/spec/extensions/tree_spec.rb b/spec/extensions/tree_spec.rb index 6629197..328158d 100644 --- a/spec/extensions/tree_spec.rb +++ b/spec/extensions/tree_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -5,66 +7,66 @@ require 'rails_helper' module Tree RSpec.describe TreeNode do describe '#distance_to_common_ancestor' do - def assert_distance(node_1, node_2, distance) + def assert_distance(node1, node2, distance) aggregate_failures do - expect(node_1.distance_to_common_ancestor(node_2)).to eq(distance) - expect(node_2.distance_to_common_ancestor(node_1)).to eq(distance) + expect(node1.distance_to_common_ancestor(node2)).to eq(distance) + expect(node2.distance_to_common_ancestor(node1)).to eq(distance) end end context 'when the two nodes are the same' do it 'returns 0 when comparing the root itself' do - root = Tree::TreeNode.new('root') + root = described_class.new('root') assert_distance(root, root, 0) end it 'returns 0 when comparing a child to itself' do - root = Tree::TreeNode.new('root') - child = root << Tree::TreeNode.new('child') + root = described_class.new('root') + child = root << described_class.new('child') assert_distance(child, child, 0) end end context 'when the two nodes are siblings' do it 'returns 1 when comparing siblings' do - root = Tree::TreeNode.new('root') - child1 = root << Tree::TreeNode.new('child1') - child2 = root << Tree::TreeNode.new('child2') + root = described_class.new('root') + child1 = root << described_class.new('child1') + child2 = root << described_class.new('child2') assert_distance(child1, child2, 1) end end context 'when one node is parent of the other' do it 'returns 1 when comparing parent to child' do - root = Tree::TreeNode.new('root') - child = root << Tree::TreeNode.new('child') + root = described_class.new('root') + child = root << described_class.new('child') assert_distance(root, child, 1) end end context 'when one node is grandparent of the other' do it 'returns 2 when comparing grandparent to grandchild' do - root = Tree::TreeNode.new('root') - child = root << Tree::TreeNode.new('child') - grandchild = child << Tree::TreeNode.new('grandchild') + root = described_class.new('root') + child = root << described_class.new('child') + grandchild = child << described_class.new('grandchild') assert_distance(root, grandchild, 2) end end context 'when the two nodes are cousins' do it 'returns 2 when comparing cousins' do - root = Tree::TreeNode.new('root') - child1 = root << Tree::TreeNode.new('child1') - child2 = root << Tree::TreeNode.new('child2') - grandchild1 = child1 << Tree::TreeNode.new('grandchild1') - grandchild2 = child2 << Tree::TreeNode.new('grandchild2') + root = described_class.new('root') + child1 = root << described_class.new('child1') + child2 = root << described_class.new('child2') + grandchild1 = child1 << described_class.new('grandchild1') + grandchild2 = child2 << described_class.new('grandchild2') assert_distance(grandchild1, grandchild2, 2) end end context 'when the two nodes are not related' do it 'returns nil' do - root = Tree::TreeNode.new('root') - another_root = Tree::TreeNode.new('another_root') + root = described_class.new('root') + another_root = described_class.new('another_root') assert_distance(root, another_root, nil) end end From 27c7feebeecdc34b20b50527a9b8b93a1a408665 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 17:36:06 +0100 Subject: [PATCH 239/283] Run Rubocop autocorrect on spec/queries --- .rubocop.yml | 2 +- spec/queries/expenses/total_query_spec.rb | 6 ++++-- spec/queries/groups/summary_query_spec.rb | 10 ++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 3ec2fa4..ed6bf9a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,4 +14,4 @@ AllCops: Layout/LineLength: Max: 120 RSpec/ExampleLength: - Max: 10 \ No newline at end of file + Max: 30 \ No newline at end of file diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index f721844..371dc1a 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -61,8 +63,8 @@ module Expenses end it 'returns the sum of fixed and variable expenses', :aggregate_failures do - expect(response['total_confirmed']).to eq(100 + 200 + 50 * 2) - expect(response['total_projected']).to eq(100 + 200 + 11 * 50) + expect(response['total_confirmed']).to eq(100 + 200 + (50 * 2)) + expect(response['total_projected']).to eq(100 + 200 + (11 * 50)) expect(response['confirmed_guests']).to eq(2) expect(response['projected_guests']).to eq(2 + 4 + 5) end diff --git a/spec/queries/groups/summary_query_spec.rb b/spec/queries/groups/summary_query_spec.rb index 6e2c3d2..0aa1490 100644 --- a/spec/queries/groups/summary_query_spec.rb +++ b/spec/queries/groups/summary_query_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -5,7 +7,7 @@ require 'rails_helper' module Groups RSpec.describe SummaryQuery do describe '#call' do - subject { described_class.new.call } + subject(:result) { described_class.new.call } context 'when there are no groups' do it { is_expected.to eq([]) } @@ -17,7 +19,7 @@ module Groups context 'when there are no guests' do it 'returns the summary of groups' do - is_expected.to contain_exactly( + expect(result).to contain_exactly( { 'id' => parent.id, 'name' => 'Friends', 'icon' => 'icon-1', @@ -58,11 +60,11 @@ module Groups create_list(:guest, 8, group: child, status: :invited) create_list(:guest, 9, group: child, status: :confirmed) create_list(:guest, 10, group: child, status: :declined) - create_list(:guest, 11, group: child, status: :tentative) + create_list(:guest, 11, group: child, status: :tentative) # rubocop:disable FactoryBot/ExcessiveCreateList end it 'returns the summary of groups' do - is_expected.to contain_exactly( + expect(result).to contain_exactly( { 'id' => parent.id, 'name' => 'Friends', From c15d0806a80806ff73f81572b80cf4710841194b Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 17:49:00 +0100 Subject: [PATCH 240/283] Add exception to some Rubocop offenses --- spec/requests/schemas.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index eb51216..066405e 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Swagger @@ -7,13 +9,13 @@ module Swagger email: { type: :string, format: :email }, created_at: SwaggerResponseHelper::TIMESTAMP, updated_at: SwaggerResponseHelper::TIMESTAMP - } + }.freeze - ID = { + ID = { # rubocop:disable Style/MutableConstant -- rswag modifies in: :path parameters name: 'id', in: :path, type: :string, - format: :uuid, + format: :uuid } GROUP = { @@ -21,18 +23,18 @@ module Swagger icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' }, parent_id: { type: :string, format: :uuid }, color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' } - } + }.freeze EXPENSE = { name: { type: :string }, amount: { type: :number, minimum: 0 }, pricing_type: { type: :string, enum: Expense.pricing_types.keys } - } + }.freeze - SLUG = { + SLUG = { # rubocop:disable Style/MutableConstant -- rswag modifies in: :path parameters name: 'slug', in: :path, - type: :string, + type: :string, pattern: Wedding::SLUG_REGEX, example: :default, description: 'Wedding slug' @@ -47,6 +49,6 @@ module Swagger answer: { type: :string } } } - } + }.freeze end -end \ No newline at end of file +end From 2fc8a6340beacfae99a5f54b09c7b0a857dcd826 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:07:22 +0100 Subject: [PATCH 241/283] Run Rubocop autocorrect on spec/ --- .rubocop.yml | 6 +- spec/rails_helper.rb | 4 +- spec/requests/affinities_spec.rb | 4 +- spec/requests/captcha_spec.rb | 17 ++-- spec/requests/expenses_spec.rb | 18 ++-- spec/requests/groups_spec.rb | 52 +++++----- spec/requests/guests_spec.rb | 18 ++-- spec/requests/summary_spec.rb | 4 +- spec/requests/tables_arrangements_spec.rb | 4 +- spec/requests/tokens_spec.rb | 14 +-- spec/requests/users/confirmations_spec.rb | 7 +- spec/requests/users/registrations_spec.rb | 11 ++- spec/requests/users/sessions_spec.rb | 8 +- .../tables/discomfort_calculator_spec.rb | 12 ++- spec/services/tables/distribution_spec.rb | 12 ++- spec/services/tables/shift_spec.rb | 4 +- spec/services/tables/swap_spec.rb | 4 +- spec/services/vns/engine_spec.rb | 2 + spec/spec_helper.rb | 94 +++++++++---------- spec/swagger_helper.rb | 6 +- spec/swagger_response_helper.rb | 27 +++--- 21 files changed, 175 insertions(+), 153 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index ed6bf9a..b62b4ea 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,4 +14,8 @@ AllCops: Layout/LineLength: Max: 120 RSpec/ExampleLength: - Max: 30 \ No newline at end of file + Enabled: false +Metrics/ModuleLength: + Enabled: false +RSpec/MultipleMemoizedHelpers: + Enabled: false \ No newline at end of file diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index fa81db3..a68d8b3 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # This file is copied to spec/ when you run 'rails generate rspec:install' @@ -5,7 +7,7 @@ require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require_relative '../config/environment' # Prevent database truncation if the environment is production -abort("The Rails environment is running in production mode!") if Rails.env.production? +abort('The Rails environment is running in production mode!') if Rails.env.production? require 'rspec/rails' # Add additional requires below this line. Rails is not loaded until this point! diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index 6e113d2..c964018 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -4,7 +4,7 @@ require 'swagger_helper' -RSpec.describe 'affinities', type: :request do +RSpec.describe 'affinities' do path '/{slug}/groups/{group_id}/affinities' do parameter Swagger::Schema::SLUG parameter name: 'group_id', in: :path, type: :string, format: :uuid, description: 'group_id' @@ -46,7 +46,7 @@ RSpec.describe 'affinities', type: :request do } } - response_empty_200 + response_empty200 end end end diff --git a/spec/requests/captcha_spec.rb b/spec/requests/captcha_spec.rb index 607a2d9..4441304 100644 --- a/spec/requests/captcha_spec.rb +++ b/spec/requests/captcha_spec.rb @@ -1,22 +1,23 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'captcha', type: :request do +RSpec.describe 'captcha' do path '/captcha' do - post('create a CAPTCHA challenge') do tags 'CAPTCHA' consumes 'application/json' produces 'application/json' - + response(201, 'created') do schema type: :object, - required: %i[id], - properties: { - id: { type: :string, format: :uuid }, - media_url: { type: :string, format: :uri }, - } + required: %i[id], + properties: { + id: { type: :string, format: :uuid }, + media_url: { type: :string, format: :uri } + } xit end end diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index 068fec5..4bfa22f 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'expenses', type: :request do +RSpec.describe 'expenses' do path '/{slug}/expenses' do get('list expenses') do tags 'Expenses' @@ -42,8 +44,8 @@ RSpec.describe 'expenses', type: :request do } } - response_empty_201 - response_422 + response_empty201 + response422 regular_api_responses end end @@ -60,9 +62,9 @@ RSpec.describe 'expenses', type: :request do properties: Swagger::Schema::EXPENSE } - response_empty_200 - response_422 - response_404 + response_empty200 + response422 + response404 regular_api_responses end @@ -71,8 +73,8 @@ RSpec.describe 'expenses', type: :request do produces 'application/json' parameter Swagger::Schema::SLUG parameter Swagger::Schema::ID - response_empty_200 - response_404 + response_empty200 + response404 regular_api_responses end end diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index bc6267b..3496ad5 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'groups', type: :request do +RSpec.describe 'groups' do path '/{slug}/groups' do get('list groups') do tags 'Groups' @@ -10,29 +12,29 @@ RSpec.describe 'groups', type: :request do parameter Swagger::Schema::SLUG response(200, 'successful') do schema type: :array, - items: { - type: :object, - required: %i[id name icon parent_id color attendance], - properties: { - id: { type: :string, format: :uuid, required: true }, - name: { type: :string }, - icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' }, - parent_id: { type: :string, format: :uuid }, - color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' }, - attendance: { - type: :object, - required: %i[total considered invited confirmed declined tentative], - properties: { - total: { type: :integer, minimum: 0, description: 'Total number of guests in any status' }, - considered: { type: :integer, minimum: 0 }, - invited: { type: :integer, minimum: 0 }, - confirmed: { type: :integer, minimum: 0 }, - declined: { type: :integer, minimum: 0 }, - tentative: { type: :integer, minimum: 0 } - } - } - } + items: { + type: :object, + required: %i[id name icon parent_id color attendance], + properties: { + id: { type: :string, format: :uuid, required: true }, + name: { type: :string }, + icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' }, + parent_id: { type: :string, format: :uuid }, + color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' }, + attendance: { + type: :object, + required: %i[total considered invited confirmed declined tentative], + properties: { + total: { type: :integer, minimum: 0, description: 'Total number of guests in any status' }, + considered: { type: :integer, minimum: 0 }, + invited: { type: :integer, minimum: 0 }, + confirmed: { type: :integer, minimum: 0 }, + declined: { type: :integer, minimum: 0 }, + tentative: { type: :integer, minimum: 0 } + } + } } + } xit end regular_api_responses @@ -99,8 +101,8 @@ RSpec.describe 'groups', type: :request do produces 'application/json' parameter Swagger::Schema::SLUG parameter name: :id, in: :path, type: :string, format: :uuid - - response_empty_200 + + response_empty200 regular_api_responses end end diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index bc73fbe..cd52ca0 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'guests', type: :request do +RSpec.describe 'guests' do path '/{slug}/guests' do get('list guests') do tags 'Guests' @@ -51,8 +53,8 @@ RSpec.describe 'guests', type: :request do } } - response_empty_201 - response_422 + response_empty201 + response422 regular_api_responses end end @@ -80,9 +82,9 @@ RSpec.describe 'guests', type: :request do } } - response_empty_200 - response_422 - response_404 + response_empty200 + response422 + response404 regular_api_responses end @@ -92,8 +94,8 @@ RSpec.describe 'guests', type: :request do parameter Swagger::Schema::SLUG parameter name: 'id', in: :path, type: :string, format: :uuid - response_empty_200 - response_404 + response_empty200 + response404 regular_api_responses end end diff --git a/spec/requests/summary_spec.rb b/spec/requests/summary_spec.rb index 2b77892..569e4b9 100644 --- a/spec/requests/summary_spec.rb +++ b/spec/requests/summary_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'summary', type: :request do +RSpec.describe 'summary' do path '/{slug}/summary' do get('list summaries') do tags 'Summary' diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index c48c127..eb4c9cd 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'tables_arrangements', type: :request do +RSpec.describe 'tables_arrangements' do path '/{slug}/tables_arrangements' do get('list tables arrangements') do tags 'Tables Arrangements' diff --git a/spec/requests/tokens_spec.rb b/spec/requests/tokens_spec.rb index 5a08e05..077543d 100644 --- a/spec/requests/tokens_spec.rb +++ b/spec/requests/tokens_spec.rb @@ -1,15 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' - -RSpec.describe 'tokens', type: :request do - path '/token' do - get('get a cookie with CSRF token') do - tags 'CSRF token' - consumes 'application/json' - produces 'application/json' - - response_empty_200 - end - end -end diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb index 12bdfbc..88dd707 100644 --- a/spec/requests/users/confirmations_spec.rb +++ b/spec/requests/users/confirmations_spec.rb @@ -1,9 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'users/confirmations', type: :request do - +RSpec.describe 'users/confirmations' do path '/{slug}/users/confirmation' do get('confirm user email') do tags 'Users' @@ -17,7 +18,7 @@ RSpec.describe 'users/confirmations', type: :request do xit end - response_422 + response422 end end end diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index 2cbaeea..ac423c1 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -1,25 +1,26 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'users/registrations', type: :request do - +RSpec.describe 'users/registrations' do path '/{slug}/users' do post('create registration') do tags 'Users Registrations' consumes 'application/json' produces 'application/json' - + parameter Swagger::Schema::SLUG parameter name: :body, in: :body, schema: { type: :object, - required: [:user, :wedding], + required: %i[user wedding], properties: { user: { type: :object, required: %i[email password password_confirmation], properties: { - email: { type: :string, format: :email}, + email: { type: :string, format: :email }, password: SwaggerResponseHelper::PASSWORD, password_confirmation: SwaggerResponseHelper::PASSWORD } diff --git a/spec/requests/users/sessions_spec.rb b/spec/requests/users/sessions_spec.rb index a803965..1553aed 100644 --- a/spec/requests/users/sessions_spec.rb +++ b/spec/requests/users/sessions_spec.rb @@ -1,11 +1,11 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'users/sessions', type: :request do - +RSpec.describe 'users/sessions' do path '/{slug}/users/sign_in' do - post('create session') do tags 'Users Sessions' consumes 'application/json' @@ -32,7 +32,7 @@ RSpec.describe 'users/sessions', type: :request do xit end - response_401(message: 'Invalid Email or password.') + response401(message: 'Invalid Email or password.') end end diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index f5da2d1..a4eea1d 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -12,8 +14,7 @@ module Tables describe '#calculate' do before do - allow(calculator).to receive(:table_size_penalty).and_return(2) - allow(calculator).to receive(:cohesion_discomfort).and_return(3) + allow(calculator).to receive_messages(table_size_penalty: 2, cohesion_discomfort: 3) end let(:table) { Table.new(create_list(:guest, 6)) } @@ -29,6 +30,7 @@ module Tables table.min_per_table = 5 table.max_per_table = 7 end + context 'when the number of guests is in the lower bound' do let(:table) { Table.new(create_list(:guest, 5)) } @@ -88,6 +90,7 @@ module Tables allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(friends.id, school.id).and_return(4) allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(work.id, school.id).and_return(5) end + context 'when the table contains just two guests' do context 'when they belong to the same group' do let(:table) { create_list(:guest, 2, group: family) } @@ -102,6 +105,7 @@ module Tables create(:guest, group: friends) ] end + it { expect(calculator.send(:cohesion_discomfort)).to eq(1) } end @@ -205,7 +209,7 @@ module Tables end it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_discomfort)).to eq(4 * 1 + 4 * Rational(1, 2) + 4 * Rational(2, 3)) + expect(calculator.send(:cohesion_discomfort)).to eq((4 * 1) + (4 * Rational(1, 2)) + (4 * Rational(2, 3))) end end @@ -219,7 +223,7 @@ module Tables end it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_discomfort)).to eq(6 * 1 + 2 * Rational(1, 2) + 3 * Rational(2, 3)) + expect(calculator.send(:cohesion_discomfort)).to eq((6 * 1) + (2 * Rational(1, 2)) + (3 * Rational(2, 3))) end end end diff --git a/spec/services/tables/distribution_spec.rb b/spec/services/tables/distribution_spec.rb index df88a85..26834c0 100644 --- a/spec/services/tables/distribution_spec.rb +++ b/spec/services/tables/distribution_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -5,19 +7,19 @@ require 'rails_helper' module Tables RSpec.describe Distribution do describe '#random_distribution' do - let(:subject) { described_class.new(min_per_table: 5, max_per_table: 10) } + subject(:distribution) { described_class.new(min_per_table: 5, max_per_table: 10) } context 'when there are fewer people than the minimum per table' do it 'creates one table' do - subject.random_distribution([1, 2, 3, 4]) - expect(subject.tables.count).to eq(1) + distribution.random_distribution([1, 2, 3, 4]) + expect(distribution.tables.count).to eq(1) end end context 'when there are more people than the maximum per table' do it 'creates multiple tables' do - subject.random_distribution([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) - expect(subject.tables.count).to be > 1 + distribution.random_distribution([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) + expect(distribution.tables.count).to be > 1 end end end diff --git a/spec/services/tables/shift_spec.rb b/spec/services/tables/shift_spec.rb index e4c48af..08b2ca1 100644 --- a/spec/services/tables/shift_spec.rb +++ b/spec/services/tables/shift_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -7,7 +9,7 @@ module Tables describe '#each' do let(:shifts) do acc = [] - described_class.new(initial_solution).each do |solution| + described_class.new(initial_solution).each do |solution| # rubocop:disable Style/MapIntoArray -- #map is not implemented acc << solution.tables.map(&:dup) end acc diff --git a/spec/services/tables/swap_spec.rb b/spec/services/tables/swap_spec.rb index 159d998..067d4bc 100644 --- a/spec/services/tables/swap_spec.rb +++ b/spec/services/tables/swap_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -7,7 +9,7 @@ module Tables describe '#each' do let(:swaps) do acc = [] - described_class.new(initial_solution).each do |solution| + described_class.new(initial_solution).each do |solution| # rubocop:disable Style/MapIntoArray -- #map is not implemented acc << solution.tables.map(&:dup) end acc diff --git a/spec/services/vns/engine_spec.rb b/spec/services/vns/engine_spec.rb index d4064f6..b7ff9a5 100644 --- a/spec/services/vns/engine_spec.rb +++ b/spec/services/vns/engine_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 25cfd37..b2f85ad 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # This file was generated by the `rails generate rspec:install` command. Conventionally, all @@ -46,51 +48,49 @@ RSpec.configure do |config| # triggering implicit auto-inclusion in groups with matching metadata. config.shared_context_metadata_behavior = :apply_to_host_groups -# The settings below are suggested to provide a good initial experience -# with RSpec, but feel free to customize to your heart's content. -=begin - # This allows you to limit a spec run to individual examples or groups - # you care about by tagging them with `:focus` metadata. When nothing - # is tagged with `:focus`, all examples get run. RSpec also provides - # aliases for `it`, `describe`, and `context` that include `:focus` - # metadata: `fit`, `fdescribe` and `fcontext`, respectively. - config.filter_run_when_matching :focus - - # Allows RSpec to persist some state between runs in order to support - # the `--only-failures` and `--next-failure` CLI options. We recommend - # you configure your source control system to ignore this file. - config.example_status_persistence_file_path = "spec/examples.txt" - - # Limits the available syntax to the non-monkey patched syntax that is - # recommended. For more details, see: - # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/ - config.disable_monkey_patching! - - # Many RSpec users commonly either run the entire suite or an individual - # file, and it's useful to allow more verbose output when running an - # individual spec file. - if config.files_to_run.one? - # Use the documentation formatter for detailed output, - # unless a formatter has already been configured - # (e.g. via a command-line flag). - config.default_formatter = "doc" - end - - # Print the 10 slowest examples and example groups at the - # end of the spec run, to help surface which specs are running - # particularly slow. - config.profile_examples = 10 - - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = :random - - # Seed global randomization in this process using the `--seed` CLI option. - # Setting this allows you to use `--seed` to deterministically reproduce - # test failures related to randomization by passing the same `--seed` value - # as the one that triggered the failure. - Kernel.srand config.seed -=end + # The settings below are suggested to provide a good initial experience + # with RSpec, but feel free to customize to your heart's content. + # # This allows you to limit a spec run to individual examples or groups + # # you care about by tagging them with `:focus` metadata. When nothing + # # is tagged with `:focus`, all examples get run. RSpec also provides + # # aliases for `it`, `describe`, and `context` that include `:focus` + # # metadata: `fit`, `fdescribe` and `fcontext`, respectively. + # config.filter_run_when_matching :focus + # + # # Allows RSpec to persist some state between runs in order to support + # # the `--only-failures` and `--next-failure` CLI options. We recommend + # # you configure your source control system to ignore this file. + # config.example_status_persistence_file_path = "spec/examples.txt" + # + # # Limits the available syntax to the non-monkey patched syntax that is + # # recommended. For more details, see: + # # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/ + # config.disable_monkey_patching! + # + # # Many RSpec users commonly either run the entire suite or an individual + # # file, and it's useful to allow more verbose output when running an + # # individual spec file. + # if config.files_to_run.one? + # # Use the documentation formatter for detailed output, + # # unless a formatter has already been configured + # # (e.g. via a command-line flag). + # config.default_formatter = "doc" + # end + # + # # Print the 10 slowest examples and example groups at the + # # end of the spec run, to help surface which specs are running + # # particularly slow. + # config.profile_examples = 10 + # + # # Run specs in random order to surface order dependencies. If you find an + # # order dependency and want to debug it, you can fix the order by providing + # # the seed, which is printed after each run. + # # --seed 1234 + # config.order = :random + # + # # Seed global randomization in this process using the `--seed` CLI option. + # # Setting this allows you to use `--seed` to deterministically reproduce + # # test failures related to randomization by passing the same `--seed` value + # # as the one that triggered the failure. + # Kernel.srand config.seed end diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index 2b19be8..2c53057 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -3,10 +3,10 @@ # frozen_string_literal: true require 'rails_helper' -require_relative './swagger_response_helper' -require_relative './requests/schemas.rb' +require_relative 'swagger_response_helper' +require_relative 'requests/schemas' -include SwaggerResponseHelper +include SwaggerResponseHelper # rubocop:disable Style/MixinUsage RSpec.configure do |config| # Specify a root folder where Swagger JSON files are generated diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index d7f2e0e..424818a 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -1,18 +1,19 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module SwaggerResponseHelper TIMESTAMP_FORMAT = '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z' TIMESTAMP_EXAMPLE = Time.zone.now.iso8601(3) - TIMESTAMP = {type: :string,pattern: TIMESTAMP_FORMAT,example: TIMESTAMP_EXAMPLE}.freeze - PASSWORD = { type: :string, minLength: User.password_length.begin, maxLength: User.password_length.end } - + TIMESTAMP = { type: :string, pattern: TIMESTAMP_FORMAT, example: TIMESTAMP_EXAMPLE }.freeze + PASSWORD = { type: :string, minLength: User.password_length.begin, maxLength: User.password_length.end }.freeze def regular_api_responses - response_401 + response401 end - def response_422 + def response422 response(422, 'Validation errors in input parameters') do produces 'application/json' error_schema @@ -20,7 +21,7 @@ module SwaggerResponseHelper end end - def response_empty_200 + def response_empty200 response(200, 'Success') do produces 'application/json' schema type: :object @@ -28,7 +29,7 @@ module SwaggerResponseHelper end end - def response_empty_201 + def response_empty201 response(201, 'Created') do produces 'application/json' schema type: :object @@ -36,7 +37,7 @@ module SwaggerResponseHelper end end - def response_404 + def response404 response(404, 'Record not found') do produces 'application/json' error_schema @@ -44,14 +45,14 @@ module SwaggerResponseHelper end end - def response_401(message: nil) + def response401(message: nil) response(401, 'Unauthorized') do produces 'application/json' schema type: :object, - required: %i[error], - properties: { - error: { type: :string, example: message || 'You need to sign in or sign up before continuing.' } - } + required: %i[error], + properties: { + error: { type: :string, example: message || 'You need to sign in or sign up before continuing.' } + } xit end end From 19dcb551fa771399f78086e57e05f34435b40305 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:13:57 +0100 Subject: [PATCH 242/283] Run Rubocop autocorrect on app/models --- .rubocop.yml | 2 ++ app/models/application_record.rb | 2 ++ app/models/expense.rb | 2 ++ app/models/group.rb | 19 +++++++++++++------ app/models/group_affinity.rb | 5 ++++- app/models/guest.rb | 4 +++- app/models/seat.rb | 2 ++ app/models/tables_arrangement.rb | 4 +++- app/models/user.rb | 2 ++ app/models/wedding.rb | 2 ++ 10 files changed, 35 insertions(+), 9 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b62b4ea..049b22d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -18,4 +18,6 @@ RSpec/ExampleLength: Metrics/ModuleLength: Enabled: false RSpec/MultipleMemoizedHelpers: + Enabled: false +Style/Documentation: Enabled: false \ No newline at end of file diff --git a/app/models/application_record.rb b/app/models/application_record.rb index e93781d..60a445b 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class ApplicationRecord < ActiveRecord::Base diff --git a/app/models/expense.rb b/app/models/expense.rb index 5601c30..5be0315 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information diff --git a/app/models/group.rb b/app/models/group.rb index 6552214..0a2c62a 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information @@ -31,7 +33,7 @@ class Group < ApplicationRecord validates :name, uniqueness: true validates :name, :order, presence: true - has_many :children, class_name: 'Group', foreign_key: 'parent_id' + has_many :children, class_name: 'Group', foreign_key: 'parent_id', dependent: :nullify, inverse_of: :parent belongs_to :parent, class_name: 'Group', optional: true before_create :set_color @@ -41,10 +43,7 @@ class Group < ApplicationRecord has_many :guests, dependent: :nullify def colorize_children(generation = 1) - derived_colors = generation == 1 ? color.paint.palette.analogous(size: children.count) : color.paint.palette.decreasing_saturation - - children.zip(derived_colors) do |child, raw_color| - + children.zip(palette(generation)) do |child, raw_color| final_color = raw_color.paint final_color.brighten(60) if final_color.dark? @@ -53,13 +52,21 @@ class Group < ApplicationRecord child.colorize_children(generation + 1) end end - + def affinities GroupAffinity.where(group_a_id: id).or(GroupAffinity.where(group_b_id: id)) end private + def palette(generation) + if generation == 1 + color.paint.palette.analogous(size: children.count) + else + color.paint.palette.decreasing_saturation + end + end + def set_color return if color.present? diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb index 31e1503..d203589 100644 --- a/app/models/group_affinity.rb +++ b/app/models/group_affinity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information @@ -30,7 +32,8 @@ class GroupAffinity < ApplicationRecord belongs_to :group_a, class_name: 'Group' belongs_to :group_b, class_name: 'Group' - validates :discomfort, numericality: { greater_than_or_equal_to: MIN_DISCOMFORT, less_than_or_equal_to: MAX_DISCOMFORT } + validates :discomfort, + numericality: { greater_than_or_equal_to: MIN_DISCOMFORT, less_than_or_equal_to: MAX_DISCOMFORT } def another_group(group) return nil if group != group_a && group != group_b diff --git a/app/models/guest.rb b/app/models/guest.rb index a0a2992..ed5254e 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information @@ -39,8 +41,8 @@ class Guest < ApplicationRecord scope :potential, -> { where.not(status: %i[declined considered]) } - after_save :recalculate_simulations, if: :saved_change_to_status? after_destroy :recalculate_simulations + after_save :recalculate_simulations, if: :saved_change_to_status? has_many :seats, dependent: :delete_all diff --git a/app/models/seat.rb b/app/models/seat.rb index 3f13629..c4dcefe 100644 --- a/app/models/seat.rb +++ b/app/models/seat.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index 3080e49..2e11c3a 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information @@ -21,7 +23,7 @@ # class TablesArrangement < ApplicationRecord acts_as_tenant :wedding - has_many :seats + has_many :seats, dependent: :delete_all has_many :guests, through: :seats before_create :assign_name diff --git a/app/models/user.rb b/app/models/user.rb index 43c3a9e..80cbf28 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information diff --git a/app/models/wedding.rb b/app/models/wedding.rb index 125c58e..da4a50c 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information From fbc6926402bad4368af16b8757be729799c16ecb Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:16:36 +0100 Subject: [PATCH 243/283] Run Rubocop autocorrect on app/queries --- app/queries/expenses/total_query.rb | 8 +++++--- app/queries/groups/summary_query.rb | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index 7dc47d6..81feea7 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Expenses @@ -16,7 +18,7 @@ module Expenses private def query - <<~SQL + <<~SQL.squish WITH guest_count AS (#{guest_count_per_status}), expense_summary AS (#{expense_summary}) SELECT guest_count.confirmed as confirmed_guests, @@ -28,7 +30,7 @@ module Expenses end def expense_summary - <<~SQL + <<~SQL.squish SELECT coalesce(sum(amount) filter (where pricing_type = 'fixed'), 0) as fixed, coalesce(sum(amount) filter (where pricing_type = 'per_person'), 0) as variable FROM expenses @@ -37,7 +39,7 @@ module Expenses end def guest_count_per_status - <<~SQL + <<~SQL.squish SELECT COALESCE(count(*) filter(where status = #{Guest.statuses['confirmed']}), 0) as confirmed, COALESCE(count(*) filter(where status IN (#{Guest.statuses.values_at('confirmed', 'invited', 'tentative').join(',')})), 0) as projected FROM guests diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb index 0736496..595b6e1 100644 --- a/app/queries/groups/summary_query.rb +++ b/app/queries/groups/summary_query.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Groups @@ -9,13 +11,21 @@ module Groups :icon, :parent_id, :color, + *count_expressions + ) + end + + private + + def count_expressions + [ Arel.sql('count(*) filter (where status IS NOT NULL) as total'), Arel.sql('count(*) filter (where status = 0) as considered'), Arel.sql('count(*) filter (where status = 10) as invited'), Arel.sql('count(*) filter (where status = 20) as confirmed'), Arel.sql('count(*) filter (where status = 30) as declined'), - Arel.sql('count(*) filter (where status = 40) as tentative'), - ) + Arel.sql('count(*) filter (where status = 40) as tentative') + ] end end end From 02fcd03b0e31df1e5013650203389e016876eea7 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:19:58 +0100 Subject: [PATCH 244/283] Run Rubocop autocorrect on app/services --- .rubocop.yml | 6 +++++ app/controllers/captcha_controller.rb | 4 ++- app/services/affinity_groups_hierarchy.rb | 2 ++ app/services/libre_captcha.rb | 26 ++++++++++---------- app/services/tables/discomfort_calculator.rb | 3 +++ app/services/tables/distribution.rb | 2 ++ app/services/tables/shift.rb | 2 ++ app/services/tables/swap.rb | 2 ++ app/services/tables/table.rb | 2 ++ app/services/vns/engine.rb | 2 ++ 10 files changed, 37 insertions(+), 14 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 049b22d..ff07d58 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -20,4 +20,10 @@ Metrics/ModuleLength: RSpec/MultipleMemoizedHelpers: Enabled: false Style/Documentation: + Enabled: false +Metrics/MethodLength: + Max: 20 +Rails/SkipsModelValidations: + Enabled: false +Metrics/AbcSize: Enabled: false \ No newline at end of file diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 351b324..77010bd 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class CaptchaController < ApplicationController skip_before_action :authenticate_user! skip_before_action :set_tenant def create - id = LibreCaptcha.new.get_id + id = LibreCaptcha.new.id render json: { id:, media_url: media_captcha_index_url(id:) diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index e20de97..3e15551 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class AffinityGroupsHierarchy < Array diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb index 8684e9f..cfd8028 100644 --- a/app/services/libre_captcha.rb +++ b/app/services/libre_captcha.rb @@ -1,20 +1,20 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class LibreCaptcha - def get_id - HTTParty.post("http://libre-captcha:8888/v2/captcha", - body: { - input_type: "text", - level: :hard, - media: 'image/png', - size: '350x100' - }.to_json - ).then { |raw| JSON.parse(raw)['id'] } + def id + HTTParty.post('http://libre-captcha:8888/v2/captcha', + body: { + input_type: 'text', + level: :hard, + media: 'image/png', + size: '350x100' + }.to_json).then { |raw| JSON.parse(raw)['id'] } end def valid?(id:, answer:) - HTTParty.post("http://libre-captcha:8888/v2/answer", - body: { id:, answer: }.to_json - ).then { |raw| JSON.parse(raw)['result'] == 'True' } + HTTParty.post('http://libre-captcha:8888/v2/answer', + body: { id:, answer: }.to_json).then { |raw| JSON.parse(raw)['result'] == 'True' } end -end \ No newline at end of file +end diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index c4ef54a..df5eeb4 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Tables @@ -7,6 +9,7 @@ module Tables distance = AffinityGroupsHierarchy.instance.distance(id_a, id_b) return 1 if distance.nil? + Rational(distance, distance + 1) end end diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 9236007..8c8d152 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require_relative '../../extensions/tree_node_extension' diff --git a/app/services/tables/shift.rb b/app/services/tables/shift.rb index 6ae7c94..f3882cc 100644 --- a/app/services/tables/shift.rb +++ b/app/services/tables/shift.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Tables diff --git a/app/services/tables/swap.rb b/app/services/tables/swap.rb index ae74294..e2f7b60 100644 --- a/app/services/tables/swap.rb +++ b/app/services/tables/swap.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Tables diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index 2c50435..7bec30f 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Tables diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index ee50d45..555f7c7 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module VNS From 4fc95185fbba84343cf5985888b483c0228392b1 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:21:16 +0100 Subject: [PATCH 245/283] Run Rubocop autocorrect on app/helpers --- app/helpers/application_helper.rb | 2 ++ app/helpers/expenses_helper.rb | 2 ++ app/helpers/groups_helper.rb | 2 ++ app/helpers/guests_helper.rb | 2 ++ app/helpers/tables_arrangements_helper.rb | 2 ++ 5 files changed, 10 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5e869ad..10aa281 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module ApplicationHelper diff --git a/app/helpers/expenses_helper.rb b/app/helpers/expenses_helper.rb index af8a78e..2806ac9 100644 --- a/app/helpers/expenses_helper.rb +++ b/app/helpers/expenses_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module ExpensesHelper diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 311c1a2..aa6ffcc 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module GroupsHelper diff --git a/app/helpers/guests_helper.rb b/app/helpers/guests_helper.rb index ca740f6..d381a71 100644 --- a/app/helpers/guests_helper.rb +++ b/app/helpers/guests_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module GuestsHelper diff --git a/app/helpers/tables_arrangements_helper.rb b/app/helpers/tables_arrangements_helper.rb index 637e079..1ec0aab 100644 --- a/app/helpers/tables_arrangements_helper.rb +++ b/app/helpers/tables_arrangements_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module TablesArrangementsHelper From 0c7c69ee5eb0cd4099b9bde0118df63dc46f36ee Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:28:28 +0100 Subject: [PATCH 246/283] Run Rubocop autocorrect on app/controllers --- app/controllers/affinities_controller.rb | 19 ++++--- app/controllers/application_controller.rb | 8 +-- app/controllers/expenses_controller.rb | 4 +- app/controllers/groups_controller.rb | 4 +- app/controllers/guests_controller.rb | 4 +- app/controllers/summary_controller.rb | 54 ++++++++++++------- .../tables_arrangements_controller.rb | 4 +- app/controllers/tokens_controller.rb | 2 + .../users/confirmations_controller.rb | 36 +++++++------ .../users/registrations_controller.rb | 40 +++++++------- app/controllers/users/sessions_controller.rb | 12 +++-- 11 files changed, 115 insertions(+), 72 deletions(-) diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index fab690a..f8b7052 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -6,22 +6,27 @@ class AffinitiesController < ApplicationController before_action :set_group def index - overridden_affinities = @group.affinities - .each_with_object({}) { |affinity, acc| acc[affinity.another_group(@group).id] = affinity.discomfort } - Group.where.not(id: @group.id).pluck(:id).index_with { |group_id| GroupAffinity::MAX_DISCOMFORT - (overridden_affinities[group_id] || GroupAffinity::NEUTRAL) } - .then { |affinities| render json: affinities } + overridden = @group.affinities.each_with_object({}) do |affinity, acc| + acc[affinity.another_group(@group).id] = affinity.discomfort + end + Group.where.not(id: @group.id) + .pluck(:id) + .index_with { |group_id| GroupAffinity::MAX_DISCOMFORT - (overridden[group_id] || GroupAffinity::NEUTRAL) } + .then { |affinities| render json: affinities } end def bulk_update - params.expect(affinities: [[:group_id, :affinity]]).map(&:to_h).map do |affinity| + affinities = params.expect(affinities: [%i[group_id affinity]]).map(&:to_h).map do |affinity| { group_a_id: @group.id, group_b_id: affinity[:group_id], discomfort: GroupAffinity::MAX_DISCOMFORT - affinity[:affinity] } - end.then { |affinities| GroupAffinity.upsert_all(affinities) } - render json: {}, status: :ok + end + GroupAffinity.upsert_all(affinities) + + render json: {}, status: :ok rescue ActiveRecord::InvalidForeignKey render json: { error: 'At least one of the group IDs provided does not exist.' }, status: :bad_request rescue ActiveRecord::StatementInvalid diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7cb39a8..e1bebb9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class ApplicationController < ActionController::Base @@ -40,9 +42,9 @@ class ApplicationController < ActionController::Base end def captcha_params - params.expect(captcha: [:id, :answer]) + params.expect(captcha: %i[id answer]) end - + def default_url_options(options = {}) options.merge(path_params: { slug: ActsAsTenant.current_tenant&.slug }) end @@ -53,7 +55,7 @@ class ApplicationController < ActionController::Base def development_swagger? Rails.env.test? || - Rails.env.development? && request.headers['referer']&.include?('/api-docs/index.html') + (Rails.env.development? && request.headers['referer']&.include?('/api-docs/index.html')) end def set_csrf_cookie diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 2a125d9..0b86498 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class ExpensesController < ApplicationController @@ -6,7 +8,7 @@ class ExpensesController < ApplicationController end def index - render json: Expense.all.order(pricing_type: :asc, amount: :desc).as_json(only: %i[id name amount pricing_type]) + render json: Expense.order(pricing_type: :asc, amount: :desc).as_json(only: %i[id name amount pricing_type]) end def create diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index f53ed35..6ba61ca 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class GroupsController < ApplicationController @@ -39,6 +41,6 @@ class GroupsController < ApplicationController end def group_params - params.expect(group: [:name, :icon, :color]) + params.expect(group: %i[name icon color]) end end diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 54975b6..e8b1cd0 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'csv' class GuestsController < ApplicationController def index - render json: Guest.all.includes(:group) + render json: Guest.includes(:group) .left_joins(:group) .order('groups.name' => :asc, name: :asc) .as_json(only: %i[id name status], include: { group: { only: %i[id name] } }) diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb index 55983dc..0959d4d 100644 --- a/app/controllers/summary_controller.rb +++ b/app/controllers/summary_controller.rb @@ -1,29 +1,43 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class SummaryController < ApplicationController def index - expense_summary = Expenses::TotalQuery.new(wedding: ActsAsTenant.current_tenant).call - guest_summary = Guest.group(:status).count render json: { - expenses: { - projected: { - total: expense_summary['total_projected'], - guests: expense_summary['projected_guests'] - }, - confirmed: { - total: expense_summary['total_confirmed'], - guests: expense_summary['confirmed_guests'] - }, - status: { - paid: 0 - } + expenses:, + guests: + } + end + + private + + def guests + guest_summary = Guest.group(:status).count + + { + total: guest_summary.except('considered').values.sum, + confirmed: guest_summary['confirmed'].to_i, + declined: guest_summary['declined'].to_i, + tentative: guest_summary['tentative'].to_i, + invited: guest_summary['invited'].to_i + } + end + + def expenses + expense_summary = Expenses::TotalQuery.new(wedding: ActsAsTenant.current_tenant).call + + { + projected: { + total: expense_summary['total_projected'], + guests: expense_summary['projected_guests'] }, - guests: { - total: guest_summary.except('considered').values.sum, - confirmed: guest_summary['confirmed'].to_i, - declined: guest_summary['declined'].to_i, - tentative: guest_summary['tentative'].to_i, - invited: guest_summary['invited'].to_i + confirmed: { + total: expense_summary['total_confirmed'], + guests: expense_summary['confirmed_guests'] + }, + status: { + paid: 0 } } end diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index 00ba8b1..c042b6c 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class TablesArrangementsController < ApplicationController def index - render json: TablesArrangement.all.order(discomfort: :asc).limit(3).as_json(only: %i[id name discomfort]) + render json: TablesArrangement.order(discomfort: :asc).limit(3).as_json(only: %i[id name discomfort]) end def show diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb index c3dabba..58cf243 100644 --- a/app/controllers/tokens_controller.rb +++ b/app/controllers/tokens_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class TokensController < ApplicationController diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index 660d263..d073fef 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -1,23 +1,27 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo -class Users::ConfirmationsController < Devise::ConfirmationsController - clear_respond_to - respond_to :json +module Users + class ConfirmationsController < Devise::ConfirmationsController + clear_respond_to + respond_to :json - def show - super do |resource| - if resource.errors.empty? - respond_to do |format| - format.json { render json: resource, status: :ok } - format.any { redirect_to root_path } + def show + super do |resource| + if resource.errors.empty? + respond_to do |format| + format.json { render json: resource, status: :ok } + format.any { redirect_to root_path } + end + else + render json: { + message: 'Record invalid', + errors: resource.errors.full_messages + }, status: :unprocessable_entity end - else - render json: { - message: 'Record invalid', - errors: resource.errors.full_messages - }, status: :unprocessable_entity + return end - return end end -end \ No newline at end of file +end diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 0aae89d..7a9560b 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,28 +1,32 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo -class Users::RegistrationsController < Devise::RegistrationsController - clear_respond_to - respond_to :json +module Users + class RegistrationsController < Devise::RegistrationsController + clear_respond_to + respond_to :json - before_action :validate_captcha!, only: :create + before_action :validate_captcha!, only: :create - def create - wedding = Wedding.create(slug: params[:slug]) - unless wedding.persisted? - render json: { errors: wedding.errors.full_messages }, status: :unprocessable_entity - return - end + def create + wedding = Wedding.create(slug: params[:slug]) + unless wedding.persisted? + render json: { errors: wedding.errors.full_messages }, status: :unprocessable_entity + return + end - ActsAsTenant.with_tenant(wedding) do - super do |user| - wedding.destroy unless user.persisted? + ActsAsTenant.with_tenant(wedding) do + super do |user| + wedding.destroy unless user.persisted? + end end end - end - private + private - def set_tenant - set_current_tenant(nil) + def set_tenant + set_current_tenant(nil) + end end -end \ No newline at end of file +end diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 0de9af5..4b7c7d6 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -1,6 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo -class Users::SessionsController < Devise::SessionsController - clear_respond_to - respond_to :json -end \ No newline at end of file +module Users + class SessionsController < Devise::SessionsController + clear_respond_to + respond_to :json + end +end From b16ef1e237f6132f1391cc8d8c871394a2619139 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:30:54 +0100 Subject: [PATCH 247/283] Run Rubocop autocorrect on the rest of the project --- .rubocop.yml | 2 +- Rakefile | 4 +++- app/channels/application_cable/channel.rb | 2 ++ app/channels/application_cable/connection.rb | 2 ++ app/extensions/tree_node_extension.rb | 2 ++ app/jobs/application_job.rb | 2 ++ app/jobs/table_simulator_job.rb | 2 ++ app/mailers/application_mailer.rb | 6 ++++-- app/serializers/serializable_group.rb | 2 ++ app/serializers/serializable_guest.rb | 2 ++ config.ru | 4 +++- lib/tasks/annotate_rb.rake | 6 ++++-- 12 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index ff07d58..ca1ed81 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,7 +9,7 @@ AllCops: - 'db/**/*' - 'config/**/*' - 'script/**/*' - - 'bin/{rails,rake}' + - 'bin/*' - '*.yml' Layout/LineLength: Max: 120 diff --git a/Rakefile b/Rakefile index 9a5ea73..488c551 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,8 @@ +# frozen_string_literal: true + # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require_relative "config/application" +require_relative 'config/application' Rails.application.load_tasks diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index 3073f1e..12b8f3d 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module ApplicationCable diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 1cc97c6..02dcb5d 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module ApplicationCable diff --git a/app/extensions/tree_node_extension.rb b/app/extensions/tree_node_extension.rb index 630b011..80104c3 100644 --- a/app/extensions/tree_node_extension.rb +++ b/app/extensions/tree_node_extension.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module TreeNodeExtension diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 3498a49..438f83d 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class ApplicationJob < ActiveJob::Base diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index 7cbe659..fe46a6d 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class TableSimulatorJob < ApplicationJob diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 94e1656..dc388c7 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class ApplicationMailer < ActionMailer::Base - default from: "from@example.com" - layout "mailer" + default from: 'from@example.com' + layout 'mailer' end diff --git a/app/serializers/serializable_group.rb b/app/serializers/serializable_group.rb index f7cc103..f0c18e9 100644 --- a/app/serializers/serializable_group.rb +++ b/app/serializers/serializable_group.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class SerializableGroup < JSONAPI::Serializable::Resource diff --git a/app/serializers/serializable_guest.rb b/app/serializers/serializable_guest.rb index e411307..9c34d8d 100644 --- a/app/serializers/serializable_guest.rb +++ b/app/serializers/serializable_guest.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class SerializableGuest < JSONAPI::Serializable::Resource diff --git a/config.ru b/config.ru index 4a3c09a..6dc8321 100644 --- a/config.ru +++ b/config.ru @@ -1,6 +1,8 @@ +# frozen_string_literal: true + # This file is used by Rack-based servers to start the application. -require_relative "config/environment" +require_relative 'config/environment' run Rails.application Rails.application.load_server diff --git a/lib/tasks/annotate_rb.rake b/lib/tasks/annotate_rb.rake index 1ad0ec3..e8368b2 100644 --- a/lib/tasks/annotate_rb.rake +++ b/lib/tasks/annotate_rb.rake @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # This rake task was added by annotate_rb gem. # Can set `ANNOTATERB_SKIP_ON_DB_TASKS` to be anything to skip this -if Rails.env.development? && ENV["ANNOTATERB_SKIP_ON_DB_TASKS"].nil? - require "annotate_rb" +if Rails.env.development? && ENV['ANNOTATERB_SKIP_ON_DB_TASKS'].nil? + require 'annotate_rb' AnnotateRb::Core.load_rake_tasks end From cb10d50d9eb60b6c43485488dcac4e7b87629c73 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:32:46 +0100 Subject: [PATCH 248/283] Rename .github -> .gitea --- {.github => .gitea}/workflows/build.yml | 0 {.github => .gitea}/workflows/copyright_notice.yml | 0 {.github => .gitea}/workflows/license_finder.yml | 0 {.github => .gitea}/workflows/tests.yml | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {.github => .gitea}/workflows/build.yml (100%) rename {.github => .gitea}/workflows/copyright_notice.yml (100%) rename {.github => .gitea}/workflows/license_finder.yml (100%) rename {.github => .gitea}/workflows/tests.yml (100%) diff --git a/.github/workflows/build.yml b/.gitea/workflows/build.yml similarity index 100% rename from .github/workflows/build.yml rename to .gitea/workflows/build.yml diff --git a/.github/workflows/copyright_notice.yml b/.gitea/workflows/copyright_notice.yml similarity index 100% rename from .github/workflows/copyright_notice.yml rename to .gitea/workflows/copyright_notice.yml diff --git a/.github/workflows/license_finder.yml b/.gitea/workflows/license_finder.yml similarity index 100% rename from .github/workflows/license_finder.yml rename to .gitea/workflows/license_finder.yml diff --git a/.github/workflows/tests.yml b/.gitea/workflows/tests.yml similarity index 100% rename from .github/workflows/tests.yml rename to .gitea/workflows/tests.yml From 20cca87cddd9d822678024919596e8ff0adaf8b2 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:35:04 +0100 Subject: [PATCH 249/283] Run rubocop checks as part of CI --- .gitea/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index 36f5b06..c07776a 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Run unit tests +name: Run unit tests and Rubocop on: push: branches: @@ -24,6 +24,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - uses: ruby/setup-ruby@v1.202.0 - run: bundle install + - run: bundle exec rubocop --force-exclusion --parallel - name: Wait until Postgres is ready to accept connections run: | apt-get update && apt-get install -f -y postgresql-client From 5f2778c97ab91e02b8fb2b8cea8cd197cdb3bea8 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:35:42 +0100 Subject: [PATCH 250/283] Restore original name --- .gitea/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index c07776a..6166ed7 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Run unit tests and Rubocop +name: Run unit tests on: push: branches: From 55e6cfcd364ec0fd24b73f71fb472c7181fa39dc Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:37:47 +0100 Subject: [PATCH 251/283] Fix order of Ruby's magic string comment and Copyright assignment --- app/channels/application_cable/channel.rb | 4 ++-- app/channels/application_cable/connection.rb | 4 ++-- app/controllers/application_controller.rb | 4 ++-- app/controllers/captcha_controller.rb | 4 ++-- app/controllers/expenses_controller.rb | 4 ++-- app/controllers/groups_controller.rb | 4 ++-- app/controllers/guests_controller.rb | 4 ++-- app/controllers/summary_controller.rb | 4 ++-- app/controllers/tables_arrangements_controller.rb | 4 ++-- app/controllers/tokens_controller.rb | 4 ++-- app/controllers/users/confirmations_controller.rb | 4 ++-- app/controllers/users/registrations_controller.rb | 4 ++-- app/controllers/users/sessions_controller.rb | 4 ++-- app/extensions/tree_node_extension.rb | 4 ++-- app/helpers/application_helper.rb | 4 ++-- app/helpers/expenses_helper.rb | 4 ++-- app/helpers/groups_helper.rb | 4 ++-- app/helpers/guests_helper.rb | 4 ++-- app/helpers/tables_arrangements_helper.rb | 4 ++-- app/jobs/application_job.rb | 4 ++-- app/jobs/table_simulator_job.rb | 4 ++-- app/mailers/application_mailer.rb | 4 ++-- app/models/application_record.rb | 4 ++-- app/models/expense.rb | 4 ++-- app/models/group.rb | 4 ++-- app/models/group_affinity.rb | 4 ++-- app/models/guest.rb | 4 ++-- app/models/seat.rb | 4 ++-- app/models/tables_arrangement.rb | 4 ++-- app/models/user.rb | 4 ++-- app/models/wedding.rb | 4 ++-- app/queries/expenses/total_query.rb | 4 ++-- app/queries/groups/summary_query.rb | 4 ++-- app/serializers/serializable_group.rb | 4 ++-- app/serializers/serializable_guest.rb | 4 ++-- app/services/affinity_groups_hierarchy.rb | 4 ++-- app/services/libre_captcha.rb | 4 ++-- app/services/tables/discomfort_calculator.rb | 4 ++-- app/services/tables/distribution.rb | 4 ++-- app/services/tables/shift.rb | 4 ++-- app/services/tables/swap.rb | 4 ++-- app/services/tables/table.rb | 4 ++-- app/services/vns/engine.rb | 4 ++-- spec/extensions/tree_spec.rb | 4 ++-- spec/factories/expense.rb | 4 ++-- spec/factories/group_affinities.rb | 4 ++-- spec/factories/groups.rb | 4 ++-- spec/factories/guest.rb | 4 ++-- spec/factories/table_arrangement.rb | 4 ++-- spec/factories/users.rb | 4 ++-- spec/factories/weddings.rb | 4 ++-- spec/models/expense_spec.rb | 4 ++-- spec/models/group_spec.rb | 4 ++-- spec/models/guest_spec.rb | 2 -- spec/models/seat_spec.rb | 4 ++-- spec/models/tables_arrangement_spec.rb | 4 ++-- spec/models/user_spec.rb | 4 ++-- spec/models/wedding_spec.rb | 4 ++-- spec/queries/expenses/total_query_spec.rb | 4 ++-- spec/queries/groups/summary_query_spec.rb | 4 ++-- spec/rails_helper.rb | 4 ++-- spec/requests/captcha_spec.rb | 4 ++-- spec/requests/expenses_spec.rb | 4 ++-- spec/requests/groups_spec.rb | 4 ++-- spec/requests/guests_spec.rb | 4 ++-- spec/requests/schemas.rb | 4 ++-- spec/requests/summary_spec.rb | 4 ++-- spec/requests/tables_arrangements_spec.rb | 4 ++-- spec/requests/tokens_spec.rb | 4 ++-- spec/requests/users/confirmations_spec.rb | 4 ++-- spec/requests/users/registrations_spec.rb | 4 ++-- spec/requests/users/sessions_spec.rb | 4 ++-- spec/services/tables/discomfort_calculator_spec.rb | 4 ++-- spec/services/tables/distribution_spec.rb | 4 ++-- spec/services/tables/shift_spec.rb | 4 ++-- spec/services/tables/swap_spec.rb | 4 ++-- spec/services/vns/engine_spec.rb | 4 ++-- spec/spec_helper.rb | 4 ++-- spec/swagger_response_helper.rb | 4 ++-- 79 files changed, 156 insertions(+), 158 deletions(-) diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index 12b8f3d..72b2bf5 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module ApplicationCable class Channel < ActionCable::Channel::Base end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 02dcb5d..d45ff4d 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module ApplicationCable class Connection < ActionCable::Connection::Base end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e1bebb9..b1baa15 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class ApplicationController < ActionController::Base set_current_tenant_through_filter before_action :set_tenant diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 77010bd..57dac61 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class CaptchaController < ApplicationController skip_before_action :authenticate_user! skip_before_action :set_tenant diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 0b86498..6e1b63b 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class ExpensesController < ApplicationController def summary render json: Expenses::TotalQuery.new.call diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 6ba61ca..77a347f 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class GroupsController < ApplicationController def index query_result = Groups::SummaryQuery.new.call.as_json.map(&:deep_symbolize_keys).map do |group| diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index e8b1cd0..e7f9ff0 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'csv' class GuestsController < ApplicationController diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb index 0959d4d..e165127 100644 --- a/app/controllers/summary_controller.rb +++ b/app/controllers/summary_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class SummaryController < ApplicationController def index render json: { diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index c042b6c..23b99ba 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class TablesArrangementsController < ApplicationController def index render json: TablesArrangement.order(discomfort: :asc).limit(3).as_json(only: %i[id name discomfort]) diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb index 58cf243..5a8490d 100644 --- a/app/controllers/tokens_controller.rb +++ b/app/controllers/tokens_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class TokensController < ApplicationController skip_before_action :authenticate_user! skip_before_action :set_tenant diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index d073fef..7e5c048 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Users class ConfirmationsController < Devise::ConfirmationsController clear_respond_to diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 7a9560b..0849d96 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Users class RegistrationsController < Devise::RegistrationsController clear_respond_to diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 4b7c7d6..5e3ad06 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Users class SessionsController < Devise::SessionsController clear_respond_to diff --git a/app/extensions/tree_node_extension.rb b/app/extensions/tree_node_extension.rb index 80104c3..9bd1ed4 100644 --- a/app/extensions/tree_node_extension.rb +++ b/app/extensions/tree_node_extension.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module TreeNodeExtension def distance_to_common_ancestor(another_node) return 0 if self == another_node diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 10aa281..1bc40d8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,6 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module ApplicationHelper end diff --git a/app/helpers/expenses_helper.rb b/app/helpers/expenses_helper.rb index 2806ac9..287c70f 100644 --- a/app/helpers/expenses_helper.rb +++ b/app/helpers/expenses_helper.rb @@ -1,6 +1,6 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module ExpensesHelper end diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index aa6ffcc..b0492f2 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -1,6 +1,6 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module GroupsHelper end diff --git a/app/helpers/guests_helper.rb b/app/helpers/guests_helper.rb index d381a71..849ddb8 100644 --- a/app/helpers/guests_helper.rb +++ b/app/helpers/guests_helper.rb @@ -1,6 +1,6 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module GuestsHelper end diff --git a/app/helpers/tables_arrangements_helper.rb b/app/helpers/tables_arrangements_helper.rb index 1ec0aab..bd95809 100644 --- a/app/helpers/tables_arrangements_helper.rb +++ b/app/helpers/tables_arrangements_helper.rb @@ -1,6 +1,6 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module TablesArrangementsHelper end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 438f83d..02ef80e 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index fe46a6d..50fe728 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class TableSimulatorJob < ApplicationJob queue_as :default diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index dc388c7..b168ff3 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class ApplicationMailer < ActionMailer::Base default from: 'from@example.com' layout 'mailer' diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 60a445b..1a28db5 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class ApplicationRecord < ActiveRecord::Base primary_abstract_class end diff --git a/app/models/expense.rb b/app/models/expense.rb index 5be0315..a34cfc5 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: expenses diff --git a/app/models/group.rb b/app/models/group.rb index 0a2c62a..ddf6e52 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: groups diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb index d203589..1e85485 100644 --- a/app/models/group_affinity.rb +++ b/app/models/group_affinity.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: group_affinities diff --git a/app/models/guest.rb b/app/models/guest.rb index ed5254e..8687767 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: guests diff --git a/app/models/seat.rb b/app/models/seat.rb index c4dcefe..a00ec99 100644 --- a/app/models/seat.rb +++ b/app/models/seat.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: seats diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index 2e11c3a..72f13d5 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: tables_arrangements diff --git a/app/models/user.rb b/app/models/user.rb index 80cbf28..5a9683e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: users diff --git a/app/models/wedding.rb b/app/models/wedding.rb index da4a50c..c94d83d 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: weddings diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index 81feea7..fc46a6b 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Expenses class TotalQuery private attr_reader :wedding diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb index 595b6e1..28fe6a5 100644 --- a/app/queries/groups/summary_query.rb +++ b/app/queries/groups/summary_query.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Groups class SummaryQuery def call diff --git a/app/serializers/serializable_group.rb b/app/serializers/serializable_group.rb index f0c18e9..eb30b10 100644 --- a/app/serializers/serializable_group.rb +++ b/app/serializers/serializable_group.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class SerializableGroup < JSONAPI::Serializable::Resource type 'group' diff --git a/app/serializers/serializable_guest.rb b/app/serializers/serializable_guest.rb index 9c34d8d..981e58b 100644 --- a/app/serializers/serializable_guest.rb +++ b/app/serializers/serializable_guest.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class SerializableGuest < JSONAPI::Serializable::Resource type 'guest' diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index 3e15551..310bac8 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class AffinityGroupsHierarchy < Array include Singleton diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb index cfd8028..314c186 100644 --- a/app/services/libre_captcha.rb +++ b/app/services/libre_captcha.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class LibreCaptcha def id HTTParty.post('http://libre-captcha:8888/v2/captcha', diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index df5eeb4..48dacce 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Tables class DiscomfortCalculator class << self diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 8c8d152..04d1e6a 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require_relative '../../extensions/tree_node_extension' module Tables diff --git a/app/services/tables/shift.rb b/app/services/tables/shift.rb index f3882cc..2326b1e 100644 --- a/app/services/tables/shift.rb +++ b/app/services/tables/shift.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Tables class Shift private attr_reader :initial_solution diff --git a/app/services/tables/swap.rb b/app/services/tables/swap.rb index e2f7b60..1fe6944 100644 --- a/app/services/tables/swap.rb +++ b/app/services/tables/swap.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Tables class Swap private attr_reader :initial_solution diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index 7bec30f..8877e7c 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Tables class Table < Set attr_accessor :discomfort, :min_per_table, :max_per_table diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index 555f7c7..9f600df 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module VNS class Engine class << self diff --git a/spec/extensions/tree_spec.rb b/spec/extensions/tree_spec.rb index 328158d..1d3e6d0 100644 --- a/spec/extensions/tree_spec.rb +++ b/spec/extensions/tree_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Tree diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index f794723..e122a43 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :expense do wedding diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index de2069e..f5f2b65 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :group_affinity do group_a factory: %i[group] diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 3b73bdb..84ae9ec 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :group do wedding diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index 5fe1ad7..25a5c5e 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :guest do group diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb index fd48313..19c5f14 100644 --- a/spec/factories/table_arrangement.rb +++ b/spec/factories/table_arrangement.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :tables_arrangement do wedding diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 69b6b6e..3616935 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :user do wedding diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index 70f947a..1e6f555 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :wedding do sequence(:slug) { |i| "wedding-#{i}" } diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index 6858913..b002e78 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe Expense do diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 2dbbe0b..f7e7fd3 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe Group do diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index 30b927e..a63da70 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -2,8 +2,6 @@ # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe Guest do diff --git a/spec/models/seat_spec.rb b/spec/models/seat_spec.rb index 8d77e35..40e63f2 100644 --- a/spec/models/seat_spec.rb +++ b/spec/models/seat_spec.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe Seat do diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index 653fe66..493318c 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe TablesArrangement do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index e5bbef4..ae1be79 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe User do diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index 5840b0a..84db4f1 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe Wedding do diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index 371dc1a..7847abe 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Expenses diff --git a/spec/queries/groups/summary_query_spec.rb b/spec/queries/groups/summary_query_spec.rb index 0aa1490..1ef1a33 100644 --- a/spec/queries/groups/summary_query_spec.rb +++ b/spec/queries/groups/summary_query_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Groups diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index a68d8b3..7058316 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' diff --git a/spec/requests/captcha_spec.rb b/spec/requests/captcha_spec.rb index 4441304..17dc9bf 100644 --- a/spec/requests/captcha_spec.rb +++ b/spec/requests/captcha_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'captcha' do diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index 4bfa22f..557f2e3 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'expenses' do diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index 3496ad5..30c512e 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'groups' do diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index cd52ca0..1ef80d4 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'guests' do diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index 066405e..ee914b3 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Swagger module Schema USER = { diff --git a/spec/requests/summary_spec.rb b/spec/requests/summary_spec.rb index 569e4b9..f39ab7a 100644 --- a/spec/requests/summary_spec.rb +++ b/spec/requests/summary_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'summary' do diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index eb4c9cd..34c686f 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'tables_arrangements' do diff --git a/spec/requests/tokens_spec.rb b/spec/requests/tokens_spec.rb index 077543d..406e041 100644 --- a/spec/requests/tokens_spec.rb +++ b/spec/requests/tokens_spec.rb @@ -1,5 +1,5 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb index 88dd707..8628683 100644 --- a/spec/requests/users/confirmations_spec.rb +++ b/spec/requests/users/confirmations_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'users/confirmations' do diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index ac423c1..f1dd82c 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'users/registrations' do diff --git a/spec/requests/users/sessions_spec.rb b/spec/requests/users/sessions_spec.rb index 1553aed..775f56c 100644 --- a/spec/requests/users/sessions_spec.rb +++ b/spec/requests/users/sessions_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'users/sessions' do diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index a4eea1d..3851bbf 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Tables RSpec.describe DiscomfortCalculator do diff --git a/spec/services/tables/distribution_spec.rb b/spec/services/tables/distribution_spec.rb index 26834c0..d22b817 100644 --- a/spec/services/tables/distribution_spec.rb +++ b/spec/services/tables/distribution_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Tables diff --git a/spec/services/tables/shift_spec.rb b/spec/services/tables/shift_spec.rb index 08b2ca1..590d62b 100644 --- a/spec/services/tables/shift_spec.rb +++ b/spec/services/tables/shift_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Tables diff --git a/spec/services/tables/swap_spec.rb b/spec/services/tables/swap_spec.rb index 067d4bc..94ccced 100644 --- a/spec/services/tables/swap_spec.rb +++ b/spec/services/tables/swap_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Tables diff --git a/spec/services/vns/engine_spec.rb b/spec/services/vns/engine_spec.rb index b7ff9a5..e3f379c 100644 --- a/spec/services/vns/engine_spec.rb +++ b/spec/services/vns/engine_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module VNS diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b2f85ad..2aa37f6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index 424818a..b3f3e0b 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module SwaggerResponseHelper TIMESTAMP_FORMAT = '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z' TIMESTAMP_EXAMPLE = Time.zone.now.iso8601(3) From eded3946de85f5406ffd450f3c096a17cd95c355 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:39:14 +0100 Subject: [PATCH 252/283] Restore source in gemfile --- Gemfile | 2 + Gemfile.lock | 311 ++++++++++++++++++++++++++------------------------- 2 files changed, 158 insertions(+), 155 deletions(-) diff --git a/Gemfile b/Gemfile index 8471272..2a789df 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,7 @@ # frozen_string_literal: true +source 'https://rubygems.org' + ruby '3.3.6' gem 'bootsnap', require: false gem 'csv' diff --git a/Gemfile.lock b/Gemfile.lock index df07989..edd02e2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,4 +1,5 @@ GEM + remote: https://rubygems.org/ specs: actioncable (8.0.1) actionpack (= 8.0.1) @@ -451,161 +452,161 @@ DEPENDENCIES web-console CHECKSUMS - actioncable (8.0.1) - actionmailbox (8.0.1) - actionmailer (8.0.1) - actionpack (8.0.1) - actiontext (8.0.1) - actionview (8.0.1) - activejob (8.0.1) - activemodel (8.0.1) - activerecord (8.0.1) - activestorage (8.0.1) - activesupport (8.0.1) - acts_as_tenant (1.0.1) - addressable (2.8.7) - annotaterb (4.13.0) - ast (2.4.2) - babel-source (5.8.35) - babel-transpiler (0.7.0) - base64 (0.2.0) - bcrypt (3.1.20) - benchmark (0.4.0) - bigdecimal (3.1.8) - bindex (0.8.1) - bootsnap (1.18.4) - builder (3.3.0) - childprocess (5.1.0) - chroma (0.2.0) - coderay (1.1.3) - concurrent-ruby (1.3.4) - connection_pool (2.4.1) - crass (1.0.6) - csv (3.3.2) - date (3.4.1) - debug (1.10.0) - devise (4.9.4) - diff-lcs (1.5.1) - drb (2.2.1) - erubi (1.13.1) - et-orbi (1.2.11) - execjs (2.9.1) - factory_bot (6.4.6) - factory_bot_rails (6.4.3) - faker (3.5.1) - fugit (1.11.1) - globalid (1.2.1) - httparty (0.22.0) - i18n (1.14.6) - importmap-rails (2.1.0) - io-console (0.8.0) - irb (1.14.3) - jbuilder (2.13.0) - json (2.8.2) - json-schema (5.0.1) - jsonapi-deserializable (0.2.0) - jsonapi-parser (0.1.1) - jsonapi-rails (0.4.1) - jsonapi-rb (0.5.0) - jsonapi-renderer (0.2.2) - jsonapi-serializable (0.3.1) - language_server-protocol (3.17.0.3) - launchy (3.0.1) - letter_opener (1.10.0) - letter_opener_web (3.0.0) - license_finder (7.2.1) - logger (1.6.4) - loofah (2.23.1) - mail (2.8.1) - marcel (1.0.4) - method_source (1.1.0) - mini_mime (1.1.5) - minitest (5.25.4) - money (6.19.0) - msgpack (1.7.2) - multi_xml (0.7.1) - net-imap (0.5.2) - net-pop (0.1.2) - net-protocol (0.2.2) - net-smtp (0.5.0) - nio4r (2.7.4) - nokogiri (1.17.2-aarch64-linux) - nokogiri (1.17.2-arm-linux) - nokogiri (1.17.2-arm64-darwin) - nokogiri (1.17.2-x86-linux) - nokogiri (1.17.2-x86_64-darwin) - nokogiri (1.17.2-x86_64-linux) - orm_adapter (0.5.0) - parallel (1.26.3) - parser (3.3.6.0) - pg (1.5.9) - pluck_to_hash (1.0.2) - pry (0.15.2) - psych (5.2.2) - public_suffix (6.0.1) - puma (6.5.0) - raabro (1.4.0) - racc (1.8.1) - rack (3.1.8) - rack-cors (2.0.2) - rack-session (2.0.0) - rack-test (2.1.0) - rackup (2.2.1) - rails (8.0.1) - rails-dom-testing (2.2.0) - rails-html-sanitizer (1.6.2) - railties (8.0.1) - rainbow (3.1.1) - rake (13.2.1) - rdoc (6.10.0) - react-rails (3.2.1) - redis (5.3.0) - redis-client (0.22.2) - regexp_parser (2.9.3) - reline (0.6.0) - responders (3.1.1) - rexml (3.3.9) - rspec-core (3.13.2) - rspec-expectations (3.13.3) - rspec-mocks (3.13.2) - rspec-rails (7.1.0) - rspec-support (3.13.1) - rswag (2.16.0) - rswag-api (2.16.0) - rswag-specs (2.16.0) - rswag-ui (2.16.0) - rubocop (1.69.2) - rubocop-ast (1.36.2) - rubocop-factory_bot (2.26.1) - rubocop-rails (2.28.0) - rubocop-rspec (3.3.0) - rubocop-rspec_rails (2.30.0) - ruby-progressbar (1.13.0) - rubytree (2.1.0) - rubyzip (2.3.2) - securerandom (0.4.1) - shoulda-matchers (6.4.0) - solid_queue (1.1.0) - sprockets (4.2.1) - sprockets-rails (3.5.2) - stimulus-rails (1.3.4) - stringio (3.1.2) - thor (1.3.2) - tilt (2.4.0) - timeout (0.4.3) - tomlrb (2.0.3) - turbo-rails (2.0.11) - tzinfo (2.0.6) - unicode-display_width (2.6.0) - uri (1.0.2) - useragent (0.16.11) - warden (1.2.9) - web-console (4.2.1) - websocket-driver (0.7.6) - websocket-extensions (0.1.5) - with_env (1.1.0) - xml-simple (1.1.9) - zeitwerk (2.7.1) + actioncable (8.0.1) sha256=808bff2a4e3aba36f66f0cd65d7a1579ad52fb65e99304442c46051a79689d9b + actionmailbox (8.0.1) sha256=bbc7db779be857fb6eb5b53f313d3881cd8cda38a150c3aa25f89f2f9977b08c + actionmailer (8.0.1) sha256=7b074e9590e4ec5cebd2fc91d1f9ba4c61bbd4bbd4376f731527da187cd39952 + actionpack (8.0.1) sha256=c764e4bfc0ad9d3505c09ef9b6fbf9eca4292793550c6b7e2ea93167181bfcba + actiontext (8.0.1) sha256=f232d303e854db2098f34d7331fe493a72dc2e53dfce80fbd517c7b93d4b05b2 + actionview (8.0.1) sha256=3005e3de5ca49ea789bf1ad46002d63fe5aa543c61c341239d3c533757e64f8a + activejob (8.0.1) sha256=95acd9a32d498d3a458efbb317f6191fb678758cde0ebb6c68f0b25e0fe3477f + activemodel (8.0.1) sha256=f46292fd6dcc128e18d588854298a933fd9eb22544c412b414ec02821062dc78 + activerecord (8.0.1) sha256=34a7f0610660bb704f0363025d4b8d35ffe8ddc8f5b8147e0809171f724b5306 + activestorage (8.0.1) sha256=91a8f156638568fac971ff25962a617d9c58fdc0e44eb6bd0edff36aff7df205 + activesupport (8.0.1) sha256=fd5bc74641c24ac3541055c2879789198ff42adee3e39c2933289ba008912e37 + acts_as_tenant (1.0.1) sha256=6944e4d64533337938a8817a6b4ff9b11189c9dcc0b1333bb89f3821a4c14c53 + addressable (2.8.7) sha256=462986537cf3735ab5f3c0f557f14155d778f4b43ea4f485a9deb9c8f7c58232 + annotaterb (4.13.0) sha256=6f472912002fefa735665b4132de47d0134ebf1efb76a7ef05f579cc4a6b2ff1 + ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12 + babel-source (5.8.35) sha256=79ef222a9dcb867ac2efa3b0da35b4bcb15a4bfa67b6b2dcbf1e9a29104498d9 + babel-transpiler (0.7.0) sha256=4c06f4ad9e8e1cabe94f99e11df2f140bb72aca9ba067dbb49dc14d9b98d1570 + base64 (0.2.0) sha256=0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507 + bcrypt (3.1.20) sha256=8410f8c7b3ed54a3c00cd2456bf13917d695117f033218e2483b2e40b0784099 + benchmark (0.4.0) sha256=0f12f8c495545e3710c3e4f0480f63f06b4c842cc94cec7f33a956f5180e874a + bigdecimal (3.1.8) sha256=a89467ed5a44f8ae01824af49cbc575871fa078332e8f77ea425725c1ffe27be + bindex (0.8.1) sha256=7b1ecc9dc539ed8bccfc8cb4d2732046227b09d6f37582ff12e50a5047ceb17e + bootsnap (1.18.4) sha256=ac4c42af397f7ee15521820198daeff545e4c360d2772c601fbdc2c07d92af55 + builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f + childprocess (5.1.0) sha256=9a8d484be2fd4096a0e90a0cd3e449a05bc3aa33f8ac9e4d6dcef6ac1455b6ec + chroma (0.2.0) sha256=64bdcd36a4765fbcd45adc64960cc153101300b4918f90ffdd89f4e2eb954b54 + coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b + concurrent-ruby (1.3.4) sha256=d4aa926339b0a86b5b5054a0a8c580163e6f5dcbdfd0f4bb916b1a2570731c32 + connection_pool (2.4.1) sha256=0f40cf997091f1f04ff66da67eabd61a9fe0d4928b9a3645228532512fab62f4 + crass (1.0.6) sha256=dc516022a56e7b3b156099abc81b6d2b08ea1ed12676ac7a5657617f012bd45d + csv (3.3.2) sha256=6ff0c135e65e485d1864dde6c1703b60d34cc9e19bed8452834a0b28a519bd4e + date (3.4.1) sha256=bf268e14ef7158009bfeaec40b5fa3c7271906e88b196d958a89d4b408abe64f + debug (1.10.0) sha256=11e28ca74875979e612444104f3972bd5ffb9e79179907d7ad46dba44bd2e7a4 + devise (4.9.4) sha256=920042fe5e704c548aa4eb65ebdd65980b83ffae67feb32c697206bfd975a7f8 + diff-lcs (1.5.1) sha256=273223dfb40685548436d32b4733aa67351769c7dea621da7d9dd4813e63ddfe + drb (2.2.1) sha256=e9d472bf785f558b96b25358bae115646da0dbfd45107ad858b0bc0d935cb340 + erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9 + et-orbi (1.2.11) sha256=d26e868cc21db88280a9ec1a50aa3da5d267eb9b2037ba7b831d6c2731f5df64 + execjs (2.9.1) sha256=e8fd066f6df60c8e8fbebc32c6fb356b5212c77374e8416a9019ca4bb154dcfb + factory_bot (6.4.6) sha256=1a9486ce98d318d740d8f5804b885a8265a28f326ecf2bcd4ce9fb27a71a6e04 + factory_bot_rails (6.4.3) sha256=ea73ceac1c0ff3dc11fff390bf2ea8a2604066525ed8ecd3b3bc2c267226dcc8 + faker (3.5.1) sha256=1ad1fbea279d882f486059c23fe3ddb816ccd1d7052c05a45014b4450d859bfc + fugit (1.11.1) sha256=e89485e7be22226d8e9c6da411664d0660284b4b1c08cacb540f505907869868 + globalid (1.2.1) sha256=70bf76711871f843dbba72beb8613229a49429d1866828476f9c9d6ccc327ce9 + httparty (0.22.0) sha256=78652a5c9471cf0093d3b2083c2295c9c8f12b44c65112f1846af2b71430fa6c + i18n (1.14.6) sha256=dc229a74f5d181f09942dd60ab5d6e667f7392c4ee826f35096db36d1fe3614c + importmap-rails (2.1.0) sha256=9f10c67d60651a547579f448100d033df311c5d5db578301374aeb774faae741 + io-console (0.8.0) sha256=cd6a9facbc69871d69b2cb8b926fc6ea7ef06f06e505e81a64f14a470fddefa2 + irb (1.14.3) sha256=c457f1f2f1438ae9ce5c5be3981ae2138dec7fb894c7d73777eeeb0a6c0d0752 + jbuilder (2.13.0) sha256=7200a38a1c0081aa81b7a9757e7a299db75bc58cf1fd45ca7919a91627d227d6 + json (2.8.2) sha256=dd4fa6c9c81daecf72b86ea36e56ed8955fdbb4d4dc379c93d313a59344486cf + json-schema (5.0.1) sha256=bef71a82c600a42594911553522e143f7634affc198ed507ef3ded2f920a74a9 + jsonapi-deserializable (0.2.0) sha256=5f0ca2d3f8404cce1584a314e8a3753be32a56054c942adfe997b87e92bce147 + jsonapi-parser (0.1.1) sha256=9ee0dc031e88fc7548d56fab66f9716d1e1c06f972b529b8c4617bc42a097020 + jsonapi-rails (0.4.1) sha256=fa68b927b58f194e8b81f578c0bf18e61575638f45a390f66c832de2e6d179ba + jsonapi-rb (0.5.0) sha256=7922a164278f506c43d56277f6bd0800a0b603cc985f7f63fe7241b2628bd105 + jsonapi-renderer (0.2.2) sha256=b5c44b033d61b4abdb6500fa4ab84807ca0b36ea0e59e47a2c3ca7095a6e447b + jsonapi-serializable (0.3.1) sha256=221e657677659d798e268a33ec97a83ec5ea0e4233f931358db84e88056552e9 + language_server-protocol (3.17.0.3) sha256=3d5c58c02f44a20d972957a9febe386d7e7468ab3900ce6bd2b563dd910c6b3f + launchy (3.0.1) sha256=b7fa60bda0197cf57614e271a250a8ca1f6a34ab889a3c73f67ec5d57c8a7f2c + letter_opener (1.10.0) sha256=2ff33f2e3b5c3c26d1959be54b395c086ca6d44826e8bf41a14ff96fdf1bdbb2 + letter_opener_web (3.0.0) sha256=3f391efe0e8b9b24becfab5537dfb17a5cf5eb532038f947daab58cb4b749860 + license_finder (7.2.1) sha256=179ead19b64b170638b72fd16024233813673ac9d20d5ba75ae0b4444887ef14 + logger (1.6.4) sha256=b627b91c922231050932e7bf8ee886fe54790ba2238a468ead52ba21911f2ee7 + loofah (2.23.1) sha256=d0a07422cb3b69272e124afa914ef6d517e30d5496b7f1c1fc5b95481f13f75e + mail (2.8.1) sha256=ec3b9fadcf2b3755c78785cb17bc9a0ca9ee9857108a64b6f5cfc9c0b5bfc9ad + marcel (1.0.4) sha256=0d5649feb64b8f19f3d3468b96c680bae9746335d02194270287868a661516a4 + method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5 + mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef + minitest (5.25.4) sha256=9cf2cae25ac4dfc90c988ebc3b917f53c054978b673273da1bd20bcb0778f947 + money (6.19.0) sha256=ec936fa1e42f2783719241ed9fd52725d0efa628f928feea1eb5c37d5de7daf3 + msgpack (1.7.2) sha256=59ab62fd8a4d0dfbde45009f87eb6f158ab2628a7c48886b0256f175166baaa8 + multi_xml (0.7.1) sha256=4fce100c68af588ff91b8ba90a0bb3f0466f06c909f21a32f4962059140ba61b + net-imap (0.5.2) sha256=e955b55e539712518bdb4eb747c6514f9c8d56ec4eb8eb573a82a6885a9effea + net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3 + net-protocol (0.2.2) sha256=aa73e0cba6a125369de9837b8d8ef82a61849360eba0521900e2c3713aa162a8 + net-smtp (0.5.0) sha256=5fc0415e6ea1cc0b3dfea7270438ec22b278ca8d524986a3ae4e5ae8d087b42a + nio4r (2.7.4) sha256=d95dee68e0bb251b8ff90ac3423a511e3b784124e5db7ff5f4813a220ae73ca9 + nokogiri (1.17.2-aarch64-linux) sha256=585c8cac6380848b7973bacfd0584628d116810e5f209db25e22d0c32313e681 + nokogiri (1.17.2-arm-linux) sha256=3d033ad9b09d5b8a203f0f2156053e93a9327a9c7887c0ceb9fa78c71d27280d + nokogiri (1.17.2-arm64-darwin) sha256=0c5eb06ba1c112d33c2bb29973b07e2f21c4ddb66c67c9386fd97ff1c5d84686 + nokogiri (1.17.2-x86-linux) sha256=8c4dd75e35810bdeb7c74943f383ca665baf6aed8fc2b78c1d305094a72794aa + nokogiri (1.17.2-x86_64-darwin) sha256=dc5977eb3416e1d501b22b0ed4737bf7604121491405865b887975eacfb3e896 + nokogiri (1.17.2-x86_64-linux) sha256=e8614ae8d776bd9adb535ca814375e7ae05d7cfa6aa01909e561484f6d70be0b + orm_adapter (0.5.0) sha256=aa5d0be5d540cbb46d3a93e88061f4ece6a25f6e97d6a47122beb84fe595e9b9 + parallel (1.26.3) sha256=d86babb7a2b814be9f4b81587bf0b6ce2da7d45969fab24d8ae4bf2bb4d4c7ef + parser (3.3.6.0) sha256=25d4e67cc4f0f7cab9a2ae1f38e2005b6904d2ea13c34734511d0faad038bc3b + pg (1.5.9) sha256=761efbdf73b66516f0c26fcbe6515dc7500c3f0aa1a1b853feae245433c64fdc + pluck_to_hash (1.0.2) sha256=1599906239716f98262a41493dd7d4cb72e8d83ad3d76d666deacfc5de50a47e + pry (0.15.2) sha256=12d54b8640d3fa29c9211dd4ffb08f3fd8bf7a4fd9b5a73ce5b59c8709385b6b + psych (5.2.2) sha256=a4a9477c85d3e858086c38cf64e7096abe40d1b1eed248b01020dec0ff9906ab + public_suffix (6.0.1) sha256=61d44e1cab5cbbbe5b31068481cf16976dd0dc1b6b07bd95617ef8c5e3e00c6f + puma (6.5.0) sha256=94d1b75cab7f356d52e4f1b17b9040a090889b341dbeee6ee3703f441dc189f2 + raabro (1.4.0) sha256=d4fa9ff5172391edb92b242eed8be802d1934b1464061ae5e70d80962c5da882 + racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f + rack (3.1.8) sha256=d3fbcbca43dc2b43c9c6d7dfbac01667ae58643c42cea10013d0da970218a1b1 + rack-cors (2.0.2) sha256=415d4e1599891760c5dc9ef0349c7fecdf94f7c6a03e75b2e7c2b54b82adda1b + rack-session (2.0.0) sha256=db04b2063e180369192a9046b4559af311990af38c6a93d4c600cee4eb6d4e81 + rack-test (2.1.0) sha256=0c61fc61904049d691922ea4bb99e28004ed3f43aa5cfd495024cc345f125dfb + rackup (2.2.1) sha256=f737191fd5c5b348b7f0a4412a3b86383f88c43e13b8217b63d4c8d90b9e798d + rails (8.0.1) sha256=c86f4cd7834a67c1e5d04a77d35c88a5f56a20e2022ec416fa52c1af2cdc9491 + rails-dom-testing (2.2.0) sha256=e515712e48df1f687a1d7c380fd7b07b8558faa26464474da64183a7426fa93b + rails-html-sanitizer (1.6.2) sha256=35fce2ca8242da8775c83b6ba9c1bcaad6751d9eb73c1abaa8403475ab89a560 + railties (8.0.1) sha256=8f653c6b1b0721b553045bd0deda1f22074b9ddc2209526e6f7285fcf607ac51 + rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a + rake (13.2.1) sha256=46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d + rdoc (6.10.0) sha256=db665021883ac9df3ba29cdf71aece960749888db1bf9615b4a584cfa3fa3eda + react-rails (3.2.1) sha256=2235db0b240517596b1cb3e26177ab5bc64d3a56579b0415ee242b1691f81f64 + redis (5.3.0) sha256=6bf810c5ae889187f0c45f77db503310980310afa57cf1640d57f419ccda72b1 + redis-client (0.22.2) sha256=31fee4b7cf04109b227327fabeaaf1fc5b652cf48a186a03bc607e40767bacc0 + regexp_parser (2.9.3) sha256=4b620657ed8349d82e1331a076415c79b9dd714a5546162ddd790ea9988f6379 + reline (0.6.0) sha256=57620375dcbe56ec09bac7192bfb7460c716bbf0054dc94345ecaa5438e539d2 + responders (3.1.1) sha256=92f2a87e09028347368639cfb468f5fefa745cb0dc2377ef060db1cdd79a341a + rexml (3.3.9) sha256=d71875b85299f341edf47d44df0212e7658cbdf35aeb69cefdb63f57af3137c9 + rspec-core (3.13.2) sha256=94fbda6e4738e478f1c7532b7cc241272fcdc8b9eac03a97338b1122e4573300 + rspec-expectations (3.13.3) sha256=0e6b5af59b900147698ea0ff80456c4f2e69cac4394fbd392fbd1ca561f66c58 + rspec-mocks (3.13.2) sha256=2327335def0e1665325a9b617e3af9ae20272741d80ac550336309a7c59abdef + rspec-rails (7.1.0) sha256=94585b69c4086ca79afae5cc8d2c5e314f6ad32a88c927f9c065b99596e3ee47 + rspec-support (3.13.1) sha256=48877d4f15b772b7538f3693c22225f2eda490ba65a0515c4e7cf6f2f17de70f + rswag (2.16.0) sha256=f07ce41548b9bb51464c38bc7b95af22fee84b90f2d1197a515a623906353086 + rswag-api (2.16.0) sha256=b653f7bd92e98be18b01ab4525d88950d7b0960e293a99f856b9efcee3ae6074 + rswag-specs (2.16.0) sha256=8ba26085c408b0bd2ed21dc8015c80f417c7d34c63720ab7133c2549b5bd2a91 + rswag-ui (2.16.0) sha256=a1f49e927dceda92e6e6e7c1000f1e217ee66c565f69e28131dc98b33cd3a04f + rubocop (1.69.2) sha256=762fb0f30a379bf6054588d39f1815a2a1df8f067bc0337d3fe500e346924bb8 + rubocop-ast (1.36.2) sha256=566405b7f983eb9aa3b91d28aca6bc6566e356a97f59e89851dd910aef1dd1ca + rubocop-factory_bot (2.26.1) sha256=8de13cd4edcee5ca800f255188167ecef8dbfc3d1fae9f15734e9d2e755392aa + rubocop-rails (2.28.0) sha256=4967bed9ea13e6dcab566fea4265a6dd0381db739b305e48930aba1282da2715 + rubocop-rspec (3.3.0) sha256=79e1b281a689044d1516fefbc52e2e6c06cd367c25ebeaf06a7a198e9071cd7d + rubocop-rspec_rails (2.30.0) sha256=888112e83f9d7ef7ad2397e9d69a0b9614a4bae24f072c399804a180f80c4c46 + ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 + rubytree (2.1.0) sha256=30e8759ba060dff0dabf7e40cbaaa4df892fa34cbe9f1b3fbb00e83a3f321e4b + rubyzip (2.3.2) sha256=3f57e3935dc2255c414484fbf8d673b4909d8a6a57007ed754dde39342d2373f + securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 + shoulda-matchers (6.4.0) sha256=9055bb7f4bb342125fb860809798855c630e05ef5e75837b3168b8e6ee1608b0 + solid_queue (1.1.0) sha256=55c7b1d65f2943ec8f3deee36fcb0cae91d5fa60410b294775db9da22be8353c + sprockets (4.2.1) sha256=951b13dd2f2fcae840a7184722689a803e0ff9d2702d902bd844b196da773f97 + sprockets-rails (3.5.2) sha256=a9e88e6ce9f8c912d349aa5401509165ec42326baf9e942a85de4b76dbc4119e + stimulus-rails (1.3.4) sha256=765676ffa1f33af64ce026d26b48e8ffb2e0b94e0f50e9119e11d6107d67cb06 + stringio (3.1.2) sha256=204f1828f85cdb39d57cac4abc6dc44b04505a223f131587f2e20ae3729ba131 + thor (1.3.2) sha256=eef0293b9e24158ccad7ab383ae83534b7ad4ed99c09f96f1a6b036550abbeda + tilt (2.4.0) sha256=df74f29a451daed26591a85e8e0cebb198892cb75b6573394303acda273fba4d + timeout (0.4.3) sha256=9509f079b2b55fe4236d79633bd75e34c1c1e7e3fb4b56cb5fda61f80a0fe30e + tomlrb (2.0.3) sha256=c2736acf24919f793334023a4ff396c0647d93fce702a73c9d348deaa815d4f7 + turbo-rails (2.0.11) sha256=fc47674736372780abd2a4dc0d84bef242f5ca156a457cd7fa6308291e397fcf + tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b + unicode-display_width (2.6.0) sha256=12279874bba6d5e4d2728cef814b19197dbb10d7a7837a869bab65da943b7f5a + uri (1.0.2) sha256=b303504ceb7e5905771fa7fa14b649652fa949df18b5880d69cfb12494791e27 + useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844 + warden (1.2.9) sha256=46684f885d35a69dbb883deabf85a222c8e427a957804719e143005df7a1efd0 + web-console (4.2.1) sha256=e7bcf37a10ea2b4ec4281649d1cee461b32232d0a447e82c786e6841fd22fe20 + websocket-driver (0.7.6) sha256=f69400be7bc197879726ad8e6f5869a61823147372fd8928836a53c2c741d0db + websocket-extensions (0.1.5) sha256=1c6ba63092cda343eb53fc657110c71c754c56484aad42578495227d717a8241 + with_env (1.1.0) sha256=50b3e4f0a6cda8f90d8a6bd87a6261f6c381429abafb161c4c69ad4a0cd0b6e4 + xml-simple (1.1.9) sha256=d21131e519c86f1a5bc2b6d2d57d46e6998e47f18ed249b25cad86433dbd695d + zeitwerk (2.7.1) sha256=0945986050e4907140895378e74df1fe882a2271ed087cc6c6d6b00d415a2756 RUBY VERSION ruby 3.3.6p108 From d2841a449e939d2c1d4f184efe7ed136e30ca58b Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 29 Dec 2024 01:08:54 +0000 Subject: [PATCH 253/283] Update dependency solid_queue to v1.1.2 --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index edd02e2..4295b50 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,7 +85,7 @@ GEM base64 (0.2.0) bcrypt (3.1.20) benchmark (0.4.0) - bigdecimal (3.1.8) + bigdecimal (3.1.9) bindex (0.8.1) bootsnap (1.18.4) msgpack (~> 1.2) @@ -358,7 +358,7 @@ GEM securerandom (0.4.1) shoulda-matchers (6.4.0) activesupport (>= 5.2.0) - solid_queue (1.1.0) + solid_queue (1.1.2) activejob (>= 7.1) activerecord (>= 7.1) concurrent-ruby (>= 1.3.1) @@ -472,7 +472,7 @@ CHECKSUMS base64 (0.2.0) sha256=0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507 bcrypt (3.1.20) sha256=8410f8c7b3ed54a3c00cd2456bf13917d695117f033218e2483b2e40b0784099 benchmark (0.4.0) sha256=0f12f8c495545e3710c3e4f0480f63f06b4c842cc94cec7f33a956f5180e874a - bigdecimal (3.1.8) sha256=a89467ed5a44f8ae01824af49cbc575871fa078332e8f77ea425725c1ffe27be + bigdecimal (3.1.9) sha256=2ffc742031521ad69c2dfc815a98e426a230a3d22aeac1995826a75dabfad8cc bindex (0.8.1) sha256=7b1ecc9dc539ed8bccfc8cb4d2732046227b09d6f37582ff12e50a5047ceb17e bootsnap (1.18.4) sha256=ac4c42af397f7ee15521820198daeff545e4c360d2772c601fbdc2c07d92af55 builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f @@ -586,7 +586,7 @@ CHECKSUMS rubyzip (2.3.2) sha256=3f57e3935dc2255c414484fbf8d673b4909d8a6a57007ed754dde39342d2373f securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 shoulda-matchers (6.4.0) sha256=9055bb7f4bb342125fb860809798855c630e05ef5e75837b3168b8e6ee1608b0 - solid_queue (1.1.0) sha256=55c7b1d65f2943ec8f3deee36fcb0cae91d5fa60410b294775db9da22be8353c + solid_queue (1.1.2) sha256=178c9396d1cf0dac595c7508da90ddb397d25848ca007b5c5ed48e6ac6fc360c sprockets (4.2.1) sha256=951b13dd2f2fcae840a7184722689a803e0ff9d2702d902bd844b196da773f97 sprockets-rails (3.5.2) sha256=a9e88e6ce9f8c912d349aa5401509165ec42326baf9e942a85de4b76dbc4119e stimulus-rails (1.3.4) sha256=765676ffa1f33af64ce026d26b48e8ffb2e0b94e0f50e9119e11d6107d67cb06 From 9c3c76617537ebbdbeff2e5036dc7a5cb0b7f637 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 29 Dec 2024 13:25:02 +0100 Subject: [PATCH 254/283] Configure build and cache for intermediate layers --- .gitea/workflows/build.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 1118afa..71d3c1b 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -1,8 +1,6 @@ name: Build Nginx-based docker image on: push: - branches: - - main concurrency: group: ${{ github.ref }} cancel-in-progress: true @@ -24,13 +22,22 @@ jobs: registry: ${{ secrets.PRIVATE_REGISTRY_HOST }} username: ${{ secrets.PRIVATE_REGISTRY_USERNAME }} password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }} - - - name: Build and push + + - name: Build and push intermediate stages (build) uses: docker/build-push-action@v6 with: context: . - push: ${{ github.event_name != 'pull_request' }} - tags: | - ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest - cache-from: type=registry,ref=user/app:latest + target: build + push: ${{ github.ref == 'refs/heads/main' }} + tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build + cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build + cache-to: type=inline + + - name: Build and push (final) + uses: docker/build-push-action@v6 + with: + context: . + push: ${{ github.ref == 'refs/heads/main' }} + tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest + cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest cache-to: type=inline \ No newline at end of file From a8f0302bb9ee9485084d7cf2aaaaf003603cbdda Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 29 Dec 2024 16:23:52 +0100 Subject: [PATCH 255/283] Build image on PR instead of on push --- .gitea/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 71d3c1b..5748059 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -1,6 +1,9 @@ name: Build Nginx-based docker image on: push: + branches: + - main + pull_request: concurrency: group: ${{ github.ref }} cancel-in-progress: true From c5c7ea6d54222647768d8c0db5aa1495eb1d0da9 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Wed, 25 Dec 2024 18:03:14 +0100 Subject: [PATCH 256/283] WIP: Upgrade to ruby 3.4 --- .gitea/workflows/license_finder.yml | 2 +- .ruby-version | 2 +- Dockerfile | 2 +- Dockerfile.dev | 2 +- Gemfile | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/license_finder.yml b/.gitea/workflows/license_finder.yml index 01c120e..993de1b 100644 --- a/.gitea/workflows/license_finder.yml +++ b/.gitea/workflows/license_finder.yml @@ -16,7 +16,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - uses: ruby/setup-ruby@v1.202.0 with: - ruby-version: '3.3.6' + ruby-version: '3.4.0' - name: Install project dependencies run: bundle install --jobs `getconf _NPROCESSORS_ONLN` - name: Run license finder diff --git a/.ruby-version b/.ruby-version index e391e18..4e3e8a6 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.3.6 +ruby-3.4.0 diff --git a/Dockerfile b/Dockerfile index 071a90a..e89643f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax = docker/dockerfile:1 # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.3.6 +ARG RUBY_VERSION=3.4.0 FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base # Rails app lives here diff --git a/Dockerfile.dev b/Dockerfile.dev index f911e52..64a015b 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,7 +1,7 @@ # syntax = docker/dockerfile:1 # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.3.6 +ARG RUBY_VERSION=3.4.0 FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base # Rails app lives here diff --git a/Gemfile b/Gemfile index 2a789df..56919c3 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -ruby '3.3.6' +ruby '3.4.0' gem 'bootsnap', require: false gem 'csv' gem 'importmap-rails' From 492c8e362a8b0ed28dc5f27ca9ca63d01db03285 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Thu, 26 Dec 2024 19:25:40 +0100 Subject: [PATCH 257/283] Upgrade to ruby 3.4.1 --- .gitea/workflows/license_finder.yml | 4 +--- .ruby-version | 2 +- Dockerfile | 6 +++--- Dockerfile.dev | 2 +- Gemfile | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/license_finder.yml b/.gitea/workflows/license_finder.yml index 993de1b..fb286ab 100644 --- a/.gitea/workflows/license_finder.yml +++ b/.gitea/workflows/license_finder.yml @@ -14,9 +14,7 @@ jobs: - uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} - - uses: ruby/setup-ruby@v1.202.0 - with: - ruby-version: '3.4.0' + - uses: ruby/setup-ruby@v1 - name: Install project dependencies run: bundle install --jobs `getconf _NPROCESSORS_ONLN` - name: Run license finder diff --git a/.ruby-version b/.ruby-version index 4e3e8a6..408069a 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.4.0 +ruby-3.4.1 diff --git a/Dockerfile b/Dockerfile index e89643f..a6165a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ # syntax = docker/dockerfile:1 # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.4.0 -FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base +ARG RUBY_VERSION=3.4.1 +FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim AS base # Rails app lives here WORKDIR /rails @@ -16,7 +16,7 @@ ENV RAILS_ENV="production" \ RUN apt-get update && apt-get install -y nodejs # Throw-away build stage to reduce size of final image -FROM base as build +FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ diff --git a/Dockerfile.dev b/Dockerfile.dev index 64a015b..5dbd815 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,7 +1,7 @@ # syntax = docker/dockerfile:1 # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.4.0 +ARG RUBY_VERSION=3.4.1 FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base # Rails app lives here diff --git a/Gemfile b/Gemfile index 56919c3..adaab29 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -ruby '3.4.0' +ruby '3.4.1' gem 'bootsnap', require: false gem 'csv' gem 'importmap-rails' From 5db5281d9f658ea2af9d0bb38a72124ef2eb1bab Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 11 Jan 2025 03:10:32 +0000 Subject: [PATCH 258/283] Update dependency rubocop to v1.70.0 --- Gemfile.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4295b50..43419fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -143,7 +143,7 @@ GEM jbuilder (2.13.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) - json (2.8.2) + json (2.9.1) json-schema (5.0.1) addressable (~> 2.8) jsonapi-deserializable (0.2.0) @@ -288,7 +288,7 @@ GEM redis-client (>= 0.22.0) redis-client (0.22.2) connection_pool - regexp_parser (2.9.3) + regexp_parser (2.10.0) reline (0.6.0) io-console (~> 0.5) responders (3.1.1) @@ -327,7 +327,7 @@ GEM rswag-ui (2.16.0) actionpack (>= 5.2, < 8.1) railties (>= 5.2, < 8.1) - rubocop (1.69.2) + rubocop (1.70.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -337,7 +337,7 @@ GEM rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.36.2) + rubocop-ast (1.37.0) parser (>= 3.3.1.0) rubocop-factory_bot (2.26.1) rubocop (~> 1.61) @@ -502,7 +502,7 @@ CHECKSUMS io-console (0.8.0) sha256=cd6a9facbc69871d69b2cb8b926fc6ea7ef06f06e505e81a64f14a470fddefa2 irb (1.14.3) sha256=c457f1f2f1438ae9ce5c5be3981ae2138dec7fb894c7d73777eeeb0a6c0d0752 jbuilder (2.13.0) sha256=7200a38a1c0081aa81b7a9757e7a299db75bc58cf1fd45ca7919a91627d227d6 - json (2.8.2) sha256=dd4fa6c9c81daecf72b86ea36e56ed8955fdbb4d4dc379c93d313a59344486cf + json (2.9.1) sha256=d2bdef4644052fad91c1785d48263756fe32fcac08b96a20bb15840e96550d11 json-schema (5.0.1) sha256=bef71a82c600a42594911553522e143f7634affc198ed507ef3ded2f920a74a9 jsonapi-deserializable (0.2.0) sha256=5f0ca2d3f8404cce1584a314e8a3753be32a56054c942adfe997b87e92bce147 jsonapi-parser (0.1.1) sha256=9ee0dc031e88fc7548d56fab66f9716d1e1c06f972b529b8c4617bc42a097020 @@ -562,7 +562,7 @@ CHECKSUMS react-rails (3.2.1) sha256=2235db0b240517596b1cb3e26177ab5bc64d3a56579b0415ee242b1691f81f64 redis (5.3.0) sha256=6bf810c5ae889187f0c45f77db503310980310afa57cf1640d57f419ccda72b1 redis-client (0.22.2) sha256=31fee4b7cf04109b227327fabeaaf1fc5b652cf48a186a03bc607e40767bacc0 - regexp_parser (2.9.3) sha256=4b620657ed8349d82e1331a076415c79b9dd714a5546162ddd790ea9988f6379 + regexp_parser (2.10.0) sha256=cb6f0ddde88772cd64bff1dbbf68df66d376043fe2e66a9ef77fcb1b0c548c61 reline (0.6.0) sha256=57620375dcbe56ec09bac7192bfb7460c716bbf0054dc94345ecaa5438e539d2 responders (3.1.1) sha256=92f2a87e09028347368639cfb468f5fefa745cb0dc2377ef060db1cdd79a341a rexml (3.3.9) sha256=d71875b85299f341edf47d44df0212e7658cbdf35aeb69cefdb63f57af3137c9 @@ -575,8 +575,8 @@ CHECKSUMS rswag-api (2.16.0) sha256=b653f7bd92e98be18b01ab4525d88950d7b0960e293a99f856b9efcee3ae6074 rswag-specs (2.16.0) sha256=8ba26085c408b0bd2ed21dc8015c80f417c7d34c63720ab7133c2549b5bd2a91 rswag-ui (2.16.0) sha256=a1f49e927dceda92e6e6e7c1000f1e217ee66c565f69e28131dc98b33cd3a04f - rubocop (1.69.2) sha256=762fb0f30a379bf6054588d39f1815a2a1df8f067bc0337d3fe500e346924bb8 - rubocop-ast (1.36.2) sha256=566405b7f983eb9aa3b91d28aca6bc6566e356a97f59e89851dd910aef1dd1ca + rubocop (1.70.0) sha256=96751f8440b36a0ac6e9a8ab596900803118d83d6b83f2037bf8b3d7a5bc440e + rubocop-ast (1.37.0) sha256=9513ac88aaf113d04b52912533ffe46475de1362d4aa41141b51b2455827c080 rubocop-factory_bot (2.26.1) sha256=8de13cd4edcee5ca800f255188167ecef8dbfc3d1fae9f15734e9d2e755392aa rubocop-rails (2.28.0) sha256=4967bed9ea13e6dcab566fea4265a6dd0381db739b305e48930aba1282da2715 rubocop-rspec (3.3.0) sha256=79e1b281a689044d1516fefbc52e2e6c06cd367c25ebeaf06a7a198e9071cd7d From fd40fb61b50cb110ef40dd4201f4a9898a42f781 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 12 Jan 2025 03:06:19 +0000 Subject: [PATCH 259/283] Update dependency factory_bot_rails to v6.4.4 --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 43419fb..a64f4a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -176,7 +176,7 @@ GEM tomlrb (>= 1.3, < 2.1) with_env (= 1.1.0) xml-simple (~> 1.1.9) - logger (1.6.4) + logger (1.6.5) loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -515,7 +515,7 @@ CHECKSUMS letter_opener (1.10.0) sha256=2ff33f2e3b5c3c26d1959be54b395c086ca6d44826e8bf41a14ff96fdf1bdbb2 letter_opener_web (3.0.0) sha256=3f391efe0e8b9b24becfab5537dfb17a5cf5eb532038f947daab58cb4b749860 license_finder (7.2.1) sha256=179ead19b64b170638b72fd16024233813673ac9d20d5ba75ae0b4444887ef14 - logger (1.6.4) sha256=b627b91c922231050932e7bf8ee886fe54790ba2238a468ead52ba21911f2ee7 + logger (1.6.5) sha256=c3cfe56d01656490ddd103d38b8993d73d86296adebc5f58cefc9ec03741e56b loofah (2.23.1) sha256=d0a07422cb3b69272e124afa914ef6d517e30d5496b7f1c1fc5b95481f13f75e mail (2.8.1) sha256=ec3b9fadcf2b3755c78785cb17bc9a0ca9ee9857108a64b6f5cfc9c0b5bfc9ad marcel (1.0.4) sha256=0d5649feb64b8f19f3d3468b96c680bae9746335d02194270287868a661516a4 From 088c609a447f1c6ddda0c0900e6fcc3d2fbc342b Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 12 Jan 2025 03:06:30 +0000 Subject: [PATCH 260/283] Update dependency rubytree to v2.1.1 --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 43419fb..ddd8b63 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -352,8 +352,8 @@ GEM rubocop (~> 1.61) rubocop-rspec (~> 3, >= 3.0.1) ruby-progressbar (1.13.0) - rubytree (2.1.0) - json (~> 2.0, > 2.3.1) + rubytree (2.1.1) + json (~> 2.0, > 2.9) rubyzip (2.3.2) securerandom (0.4.1) shoulda-matchers (6.4.0) @@ -582,7 +582,7 @@ CHECKSUMS rubocop-rspec (3.3.0) sha256=79e1b281a689044d1516fefbc52e2e6c06cd367c25ebeaf06a7a198e9071cd7d rubocop-rspec_rails (2.30.0) sha256=888112e83f9d7ef7ad2397e9d69a0b9614a4bae24f072c399804a180f80c4c46 ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 - rubytree (2.1.0) sha256=30e8759ba060dff0dabf7e40cbaaa4df892fa34cbe9f1b3fbb00e83a3f321e4b + rubytree (2.1.1) sha256=4925016356a81730e982f1f8c3b5f8da461f18906c77d238bad4c4ba896abd41 rubyzip (2.3.2) sha256=3f57e3935dc2255c414484fbf8d673b4909d8a6a57007ed754dde39342d2373f securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 shoulda-matchers (6.4.0) sha256=9055bb7f4bb342125fb860809798855c630e05ef5e75837b3168b8e6ee1608b0 From f997657cd3ac1c170ea8767d46178b331744887f Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 12 Jan 2025 20:41:01 +0100 Subject: [PATCH 261/283] Define an endpoint to return the default affinities of a group --- app/controllers/affinities_controller.rb | 21 +++++++++++++++++---- config/routes.rb | 1 + spec/requests/affinities_spec.rb | 15 +++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index f8b7052..097e051 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -9,10 +9,10 @@ class AffinitiesController < ApplicationController overridden = @group.affinities.each_with_object({}) do |affinity, acc| acc[affinity.another_group(@group).id] = affinity.discomfort end - Group.where.not(id: @group.id) - .pluck(:id) - .index_with { |group_id| GroupAffinity::MAX_DISCOMFORT - (overridden[group_id] || GroupAffinity::NEUTRAL) } - .then { |affinities| render json: affinities } + + for_each_group do |group_id| + overridden[group_id] || GroupAffinity::NEUTRAL + end end def bulk_update @@ -33,8 +33,21 @@ class AffinitiesController < ApplicationController render json: { error: 'Invalid group ID or discomfort provided.' }, status: :bad_request end + def default + for_each_group do |group_id| + Tables::DiscomfortCalculator.cohesion_discomfort(id_a: @group.id, id_b: group_id).to_f + end + end + private + def for_each_group + Group.where.not(id: @group.id) + .pluck(:id) + .index_with { |group_id| GroupAffinity::MAX_DISCOMFORT - yield(group_id) } + .then { |affinities| render json: affinities } + end + def set_group @group = Group.find(params[:group_id]) end diff --git a/config/routes.rb b/config/routes.rb index 9e2b004..b87e0a0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,6 +26,7 @@ Rails.application.routes.draw do resources :groups, only: %i[index create update destroy] do resources :affinities, only: %i[index] do put :bulk_update, on: :collection + get :default, on: :collection end end diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index c964018..e458abb 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -20,6 +20,21 @@ RSpec.describe 'affinities' do end end + path '/{slug}/groups/{group_id}/affinities/default' do + parameter Swagger::Schema::SLUG + parameter name: 'group_id', in: :path, type: :string, format: :uuid, description: 'group_id' + + get('calculate default affinity') do + tags 'Affinities' + produces 'application/json' + + response(200, 'successful') do + schema type: :object, additionalProperties: { type: :integer, minimum: 0, maximum: 2 } + xit + end + end + end + path '/{slug}/groups/{group_id}/affinities/bulk_update' do parameter Swagger::Schema::SLUG parameter name: 'group_id', in: :path, type: :string, format: :uuid, description: 'group_id' From a154e92b6cfd38aa13b1659ac2d6368aeb17ae95 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 13 Jan 2025 21:16:06 +0100 Subject: [PATCH 262/283] Define an endpoint to reset the discomfort between all groups --- app/controllers/affinities_controller.rb | 16 +++++++++++++++- config/routes.rb | 1 + spec/requests/affinities_spec.rb | 11 +++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index 097e051..f8cb9cb 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -3,7 +3,7 @@ # frozen_string_literal: true class AffinitiesController < ApplicationController - before_action :set_group + before_action :set_group, except: :reset def index overridden = @group.affinities.each_with_object({}) do |affinity, acc| @@ -39,6 +39,20 @@ class AffinitiesController < ApplicationController end end + def reset + affinities = Group.pluck(:id).combination(2).map do |(group_a_id, group_b_id)| + { + group_a_id:, + group_b_id:, + discomfort: Tables::DiscomfortCalculator.cohesion_discomfort(id_a: group_a_id, id_b: group_b_id).to_f + } + end + + GroupAffinity.upsert_all(affinities) + + render json: {}, status: :ok + end + private def for_each_group diff --git a/config/routes.rb b/config/routes.rb index b87e0a0..10c45ae 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -24,6 +24,7 @@ Rails.application.routes.draw do end resources :groups, only: %i[index create update destroy] do + post 'affinities/reset', to: 'affinities#reset', on: :collection resources :affinities, only: %i[index] do put :bulk_update, on: :collection get :default, on: :collection diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index e458abb..a236160 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -5,6 +5,17 @@ require 'swagger_helper' RSpec.describe 'affinities' do + path '/{slug}/groups/affinities/reset' do + parameter Swagger::Schema::SLUG + + post('reset affinities') do + tags 'Affinities' + description 'Reset all affinities to default values based on the distance between groups in the hierarchy.' + + response_empty200 + end + end + path '/{slug}/groups/{group_id}/affinities' do parameter Swagger::Schema::SLUG parameter name: 'group_id', in: :path, type: :string, format: :uuid, description: 'group_id' From e20a366410e82e2ffe5e9590096bcb5482d06d39 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 13 Jan 2025 21:37:02 +0100 Subject: [PATCH 263/283] Update copyright assignment to cover 2025 and include all contributors --- app/channels/application_cable/channel.rb | 2 +- app/channels/application_cable/connection.rb | 2 +- app/controllers/affinities_controller.rb | 2 +- app/controllers/application_controller.rb | 2 +- app/controllers/captcha_controller.rb | 2 +- app/controllers/expenses_controller.rb | 2 +- app/controllers/groups_controller.rb | 2 +- app/controllers/guests_controller.rb | 2 +- app/controllers/summary_controller.rb | 2 +- app/controllers/tables_arrangements_controller.rb | 2 +- app/controllers/tokens_controller.rb | 2 +- app/controllers/users/confirmations_controller.rb | 2 +- app/controllers/users/registrations_controller.rb | 2 +- app/controllers/users/sessions_controller.rb | 2 +- app/extensions/tree_node_extension.rb | 2 +- app/helpers/application_helper.rb | 2 +- app/helpers/expenses_helper.rb | 2 +- app/helpers/groups_helper.rb | 2 +- app/helpers/guests_helper.rb | 2 +- app/helpers/tables_arrangements_helper.rb | 2 +- app/jobs/application_job.rb | 2 +- app/jobs/table_simulator_job.rb | 2 +- app/mailers/application_mailer.rb | 2 +- app/models/application_record.rb | 2 +- app/models/expense.rb | 2 +- app/models/group.rb | 2 +- app/models/group_affinity.rb | 2 +- app/models/guest.rb | 2 +- app/models/seat.rb | 2 +- app/models/tables_arrangement.rb | 2 +- app/models/user.rb | 2 +- app/models/wedding.rb | 2 +- app/queries/expenses/total_query.rb | 2 +- app/queries/groups/summary_query.rb | 2 +- app/serializers/serializable_group.rb | 2 +- app/serializers/serializable_guest.rb | 2 +- app/services/affinity_groups_hierarchy.rb | 2 +- app/services/libre_captcha.rb | 2 +- app/services/tables/discomfort_calculator.rb | 2 +- app/services/tables/distribution.rb | 2 +- app/services/tables/shift.rb | 2 +- app/services/tables/swap.rb | 2 +- app/services/tables/table.rb | 2 +- app/services/vns/engine.rb | 2 +- app/views/layouts/mailer.html.erb | 2 +- app/views/layouts/mailer.text.erb | 2 +- app/views/users/mailer/confirmation_instructions.html.erb | 2 +- app/views/users/mailer/email_changed.html.erb | 2 +- app/views/users/mailer/password_change.html.erb | 2 +- app/views/users/mailer/reset_password_instructions.html.erb | 2 +- app/views/users/mailer/unlock_instructions.html.erb | 2 +- config/application.rb | 2 +- config/boot.rb | 2 +- config/environment.rb | 2 +- config/environments/development.rb | 2 +- config/environments/production.rb | 2 +- config/environments/test.rb | 2 +- config/importmap.rb | 2 +- config/initializers/acts_as_tenant.rb | 2 +- config/initializers/assets.rb | 2 +- config/initializers/colors.rb | 2 +- config/initializers/content_security_policy.rb | 2 +- config/initializers/cors.rb | 2 +- config/initializers/devise.rb | 2 +- config/initializers/filter_parameter_logging.rb | 2 +- config/initializers/inflections.rb | 2 +- config/initializers/permissions_policy.rb | 2 +- config/initializers/rswag_api.rb | 2 +- config/initializers/rswag_ui.rb | 2 +- config/initializers/ruby_extensions.rb | 2 +- config/puma.rb | 2 +- config/routes.rb | 2 +- db/migrate/20240711175425_create_expenses.rb | 2 +- db/migrate/20240711180753_create_guests.rb | 2 +- ...cts_as_taggable_on_migration.acts_as_taggable_on_engine.rb | 2 +- ...7_add_missing_unique_indices.acts_as_taggable_on_engine.rb | 2 +- ...ggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb | 2 +- ...9_add_missing_taggable_index.acts_as_taggable_on_engine.rb | 2 +- ...ange_collation_for_tag_names.acts_as_taggable_on_engine.rb | 2 +- ..._missing_indexes_on_taggings.acts_as_taggable_on_engine.rb | 2 +- ...81632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb | 2 +- db/migrate/20240724181756_create_tables_arrangements.rb | 2 +- db/migrate/20240724181853_create_seats.rb | 2 +- db/migrate/20240811142121_create_groups.rb | 2 +- db/migrate/20240811143801_add_parent_to_group.rb | 2 +- db/migrate/20240811154115_add_group_to_guest.rb | 2 +- db/migrate/20240811170021_add_status_to_guest.rb | 2 +- db/migrate/20241101181052_drop_taggable_tables.rb | 2 +- db/migrate/20241103072808_add_name_to_tables_arrangements.rb | 2 +- db/migrate/20241103075705_solid_queue_install.rb | 2 +- db/migrate/20241103093955_remove_email_from_guests.rb | 2 +- db/migrate/20241103133122_add_color_to_group.rb | 2 +- db/migrate/20241111063741_merge_guest_names.rb | 2 +- db/migrate/20241130095753_devise_create_users.rb | 2 +- db/migrate/20241130182228_create_weddings.rb | 2 +- db/migrate/20241130185731_add_wedding_id_to_models.rb | 2 +- db/migrate/20241207112305_remove_wedding_date.rb | 2 +- db/migrate/20241208102932_allow_ungrouped_guests.rb | 2 +- db/migrate/20241216231415_create_group_affinities.rb | 2 +- db/queue_schema.rb | 2 +- db/schema.rb | 2 +- db/seeds.rb | 2 +- spec/extensions/tree_spec.rb | 2 +- spec/factories/expense.rb | 4 ++-- spec/factories/group_affinities.rb | 4 ++-- spec/factories/groups.rb | 4 ++-- spec/factories/guest.rb | 4 ++-- spec/factories/table_arrangement.rb | 4 ++-- spec/factories/users.rb | 4 ++-- spec/factories/weddings.rb | 4 ++-- spec/models/expense_spec.rb | 4 ++-- spec/models/group_affinity_spec.rb | 2 +- spec/models/group_spec.rb | 4 ++-- spec/models/guest_spec.rb | 2 +- spec/models/seat_spec.rb | 4 ++-- spec/models/tables_arrangement_spec.rb | 4 ++-- spec/models/user_spec.rb | 4 ++-- spec/models/wedding_spec.rb | 4 ++-- spec/queries/expenses/total_query_spec.rb | 2 +- spec/queries/groups/summary_query_spec.rb | 2 +- spec/rails_helper.rb | 2 +- spec/requests/affinities_spec.rb | 2 +- spec/requests/captcha_spec.rb | 2 +- spec/requests/expenses_spec.rb | 2 +- spec/requests/groups_spec.rb | 2 +- spec/requests/guests_spec.rb | 2 +- spec/requests/schemas.rb | 2 +- spec/requests/summary_spec.rb | 2 +- spec/requests/tables_arrangements_spec.rb | 2 +- spec/requests/tokens_spec.rb | 2 +- spec/requests/users/confirmations_spec.rb | 2 +- spec/requests/users/registrations_spec.rb | 2 +- spec/requests/users/sessions_spec.rb | 2 +- spec/services/tables/discomfort_calculator_spec.rb | 2 +- spec/services/tables/distribution_spec.rb | 2 +- spec/services/tables/shift_spec.rb | 2 +- spec/services/tables/swap_spec.rb | 2 +- spec/services/vns/engine_spec.rb | 2 +- spec/spec_helper.rb | 2 +- spec/swagger_helper.rb | 2 +- spec/swagger_response_helper.rb | 2 +- 141 files changed, 154 insertions(+), 154 deletions(-) diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index 72b2bf5..88942fe 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index d45ff4d..ab575d6 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index 097e051..a62288c 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b1baa15..025dc85 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 57dac61..6c3f3ca 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 6e1b63b..8b00ddb 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 77a347f..08334aa 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index e7f9ff0..9778795 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb index e165127..0d3f655 100644 --- a/app/controllers/summary_controller.rb +++ b/app/controllers/summary_controller.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index 23b99ba..c09d453 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb index 5a8490d..a0ee546 100644 --- a/app/controllers/tokens_controller.rb +++ b/app/controllers/tokens_controller.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index 7e5c048..01eb91e 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 0849d96..f261e90 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 5e3ad06..4d7b6a8 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/extensions/tree_node_extension.rb b/app/extensions/tree_node_extension.rb index 9bd1ed4..6894dd7 100644 --- a/app/extensions/tree_node_extension.rb +++ b/app/extensions/tree_node_extension.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1bc40d8..9dbd98c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/helpers/expenses_helper.rb b/app/helpers/expenses_helper.rb index 287c70f..0b8c324 100644 --- a/app/helpers/expenses_helper.rb +++ b/app/helpers/expenses_helper.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index b0492f2..feda408 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/helpers/guests_helper.rb b/app/helpers/guests_helper.rb index 849ddb8..369b8ed 100644 --- a/app/helpers/guests_helper.rb +++ b/app/helpers/guests_helper.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/helpers/tables_arrangements_helper.rb b/app/helpers/tables_arrangements_helper.rb index bd95809..6353e46 100644 --- a/app/helpers/tables_arrangements_helper.rb +++ b/app/helpers/tables_arrangements_helper.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 02ef80e..561fb56 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index 50fe728..51b7256 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index b168ff3..b28db31 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 1a28db5..61b9d31 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/expense.rb b/app/models/expense.rb index a34cfc5..66b32f3 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/group.rb b/app/models/group.rb index ddf6e52..2db28ed 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb index 1e85485..8e70d59 100644 --- a/app/models/group_affinity.rb +++ b/app/models/group_affinity.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/guest.rb b/app/models/guest.rb index 8687767..ad0542f 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/seat.rb b/app/models/seat.rb index a00ec99..9c31c42 100644 --- a/app/models/seat.rb +++ b/app/models/seat.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index 72f13d5..adece9a 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/user.rb b/app/models/user.rb index 5a9683e..ff46fff 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/wedding.rb b/app/models/wedding.rb index c94d83d..83525b5 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index fc46a6b..ae4fe65 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb index 28fe6a5..81c91b4 100644 --- a/app/queries/groups/summary_query.rb +++ b/app/queries/groups/summary_query.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/serializers/serializable_group.rb b/app/serializers/serializable_group.rb index eb30b10..b3e2258 100644 --- a/app/serializers/serializable_group.rb +++ b/app/serializers/serializable_group.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/serializers/serializable_guest.rb b/app/serializers/serializable_guest.rb index 981e58b..ee4bac1 100644 --- a/app/serializers/serializable_guest.rb +++ b/app/serializers/serializable_guest.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index 310bac8..ef47845 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb index 314c186..a3843da 100644 --- a/app/services/libre_captcha.rb +++ b/app/services/libre_captcha.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index 48dacce..adae828 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 04d1e6a..aca8618 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/tables/shift.rb b/app/services/tables/shift.rb index 2326b1e..d5592d9 100644 --- a/app/services/tables/shift.rb +++ b/app/services/tables/shift.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/tables/swap.rb b/app/services/tables/swap.rb index 1fe6944..04abc18 100644 --- a/app/services/tables/swap.rb +++ b/app/services/tables/swap.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index 8877e7c..cc05ea0 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index 9f600df..d66c80b 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index ca6bd25..32b0c16 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -1,4 +1,4 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb index 0b40d6b..9bdce1a 100644 --- a/app/views/layouts/mailer.text.erb +++ b/app/views/layouts/mailer.text.erb @@ -1,3 +1,3 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> <%= yield %> diff --git a/app/views/users/mailer/confirmation_instructions.html.erb b/app/views/users/mailer/confirmation_instructions.html.erb index 448e3d9..cd3b2f1 100644 --- a/app/views/users/mailer/confirmation_instructions.html.erb +++ b/app/views/users/mailer/confirmation_instructions.html.erb @@ -1,4 +1,4 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>

    Welcome <%= @email %>!

    diff --git a/app/views/users/mailer/email_changed.html.erb b/app/views/users/mailer/email_changed.html.erb index 51cfa7a..f5f2998 100644 --- a/app/views/users/mailer/email_changed.html.erb +++ b/app/views/users/mailer/email_changed.html.erb @@ -1,4 +1,4 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>

    Hello <%= @email %>!

    diff --git a/app/views/users/mailer/password_change.html.erb b/app/views/users/mailer/password_change.html.erb index 7bfd484..1181727 100644 --- a/app/views/users/mailer/password_change.html.erb +++ b/app/views/users/mailer/password_change.html.erb @@ -1,4 +1,4 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>

    Hello <%= @resource.email %>!

    diff --git a/app/views/users/mailer/reset_password_instructions.html.erb b/app/views/users/mailer/reset_password_instructions.html.erb index 3bc6fcd..95bc588 100644 --- a/app/views/users/mailer/reset_password_instructions.html.erb +++ b/app/views/users/mailer/reset_password_instructions.html.erb @@ -1,4 +1,4 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>

    Hello <%= @resource.email %>!

    diff --git a/app/views/users/mailer/unlock_instructions.html.erb b/app/views/users/mailer/unlock_instructions.html.erb index 6df5c0a..3efb341 100644 --- a/app/views/users/mailer/unlock_instructions.html.erb +++ b/app/views/users/mailer/unlock_instructions.html.erb @@ -1,4 +1,4 @@ -<%# Copyright (C) 2024 Manuel Bustillo %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>

    Hello <%= @resource.email %>!

    diff --git a/config/application.rb b/config/application.rb index 8233705..1795a6f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors require_relative 'boot' diff --git a/config/boot.rb b/config/boot.rb index b7afb85..4bebfef 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) diff --git a/config/environment.rb b/config/environment.rb index 6cec499..49c0fb1 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Load the Rails application. require_relative "application" diff --git a/config/environments/development.rb b/config/environments/development.rb index b3b6593..232e88e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors require "active_support/core_ext/integer/time" diff --git a/config/environments/production.rb b/config/environments/production.rb index 2a94187..4db7dca 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors require "active_support/core_ext/integer/time" diff --git a/config/environments/test.rb b/config/environments/test.rb index ef2b3a4..0982e19 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors require "active_support/core_ext/integer/time" diff --git a/config/importmap.rb b/config/importmap.rb index f84aa44..7ec75cd 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Pin npm packages by running ./bin/importmap diff --git a/config/initializers/acts_as_tenant.rb b/config/initializers/acts_as_tenant.rb index c535737..fd8890d 100644 --- a/config/initializers/acts_as_tenant.rb +++ b/config/initializers/acts_as_tenant.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors ActsAsTenant.configure do |config| config.require_tenant = !Rails.env.test? diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index f67fe73..4772d1a 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Be sure to restart your server when you modify this file. diff --git a/config/initializers/colors.rb b/config/initializers/colors.rb index b435084..ea065fa 100644 --- a/config/initializers/colors.rb +++ b/config/initializers/colors.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors Chroma.define_palette :decreasing_saturation do spin(20).desaturate(40) diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 9004631..8798db8 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Be sure to restart your server when you modify this file. diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index f4b450f..ce186ed 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # config/initializers/cors.rb diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 5f631ef..3977aa9 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index b5bfef2..1be5be3 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Be sure to restart your server when you modify this file. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 6633bb9..2a6b3c4 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Be sure to restart your server when you modify this file. diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index 57547a3..f281e9b 100644 --- a/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Be sure to restart your server when you modify this file. diff --git a/config/initializers/rswag_api.rb b/config/initializers/rswag_api.rb index 5c46141..42deb17 100644 --- a/config/initializers/rswag_api.rb +++ b/config/initializers/rswag_api.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors Rswag::Api.configure do |c| diff --git a/config/initializers/rswag_ui.rb b/config/initializers/rswag_ui.rb index 9540ca4..a50e133 100644 --- a/config/initializers/rswag_ui.rb +++ b/config/initializers/rswag_ui.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors Rswag::Ui.configure do |c| diff --git a/config/initializers/ruby_extensions.rb b/config/initializers/ruby_extensions.rb index 46016e7..47091de 100644 --- a/config/initializers/ruby_extensions.rb +++ b/config/initializers/ruby_extensions.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class Numeric def to_currency diff --git a/config/puma.rb b/config/puma.rb index 0e947b4..128df0b 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # This configuration file will be evaluated by Puma. The top-level methods that # are invoked here are part of Puma's configuration DSL. For more information diff --git a/config/routes.rb b/config/routes.rb index b87e0a0..bb2be8f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors Rails.application.routes.draw do mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? diff --git a/db/migrate/20240711175425_create_expenses.rb b/db/migrate/20240711175425_create_expenses.rb index cdac7d0..52fa269 100644 --- a/db/migrate/20240711175425_create_expenses.rb +++ b/db/migrate/20240711175425_create_expenses.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateExpenses < ActiveRecord::Migration[7.1] def change diff --git a/db/migrate/20240711180753_create_guests.rb b/db/migrate/20240711180753_create_guests.rb index ca3f85b..d2f876a 100644 --- a/db/migrate/20240711180753_create_guests.rb +++ b/db/migrate/20240711180753_create_guests.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateGuests < ActiveRecord::Migration[7.1] def change diff --git a/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb index 803f800..f1709ca 100644 --- a/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb index 7fe34a2..a1f7d1c 100644 --- a/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb index a329d5d..078b0c0 100644 --- a/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb index 4548054..126aa38 100644 --- a/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb index d0ff9c4..fec8036 100644 --- a/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb index 194dea4..5f98782 100644 --- a/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb index 23cb9f8..16fc678 100644 --- a/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240724181756_create_tables_arrangements.rb b/db/migrate/20240724181756_create_tables_arrangements.rb index ac69487..81defbc 100644 --- a/db/migrate/20240724181756_create_tables_arrangements.rb +++ b/db/migrate/20240724181756_create_tables_arrangements.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateTablesArrangements < ActiveRecord::Migration[7.1] def change diff --git a/db/migrate/20240724181853_create_seats.rb b/db/migrate/20240724181853_create_seats.rb index b28c9d0..a4fa0ae 100644 --- a/db/migrate/20240724181853_create_seats.rb +++ b/db/migrate/20240724181853_create_seats.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateSeats < ActiveRecord::Migration[7.1] def change diff --git a/db/migrate/20240811142121_create_groups.rb b/db/migrate/20240811142121_create_groups.rb index b21f067..cad993a 100644 --- a/db/migrate/20240811142121_create_groups.rb +++ b/db/migrate/20240811142121_create_groups.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateGroups < ActiveRecord::Migration[7.1] def change diff --git a/db/migrate/20240811143801_add_parent_to_group.rb b/db/migrate/20240811143801_add_parent_to_group.rb index c8a3a14..868ea79 100644 --- a/db/migrate/20240811143801_add_parent_to_group.rb +++ b/db/migrate/20240811143801_add_parent_to_group.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AddParentToGroup < ActiveRecord::Migration[7.1] def change diff --git a/db/migrate/20240811154115_add_group_to_guest.rb b/db/migrate/20240811154115_add_group_to_guest.rb index f1fcdaf..b7df5aa 100644 --- a/db/migrate/20240811154115_add_group_to_guest.rb +++ b/db/migrate/20240811154115_add_group_to_guest.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AddGroupToGuest < ActiveRecord::Migration[7.1] def change diff --git a/db/migrate/20240811170021_add_status_to_guest.rb b/db/migrate/20240811170021_add_status_to_guest.rb index de51170..ec92086 100644 --- a/db/migrate/20240811170021_add_status_to_guest.rb +++ b/db/migrate/20240811170021_add_status_to_guest.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AddStatusToGuest < ActiveRecord::Migration[7.1] def change diff --git a/db/migrate/20241101181052_drop_taggable_tables.rb b/db/migrate/20241101181052_drop_taggable_tables.rb index cce88c7..1ece831 100644 --- a/db/migrate/20241101181052_drop_taggable_tables.rb +++ b/db/migrate/20241101181052_drop_taggable_tables.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class DropTaggableTables < ActiveRecord::Migration[7.2] def change diff --git a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb index 53dd4fa..1893200 100644 --- a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb +++ b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AddNameToTablesArrangements < ActiveRecord::Migration[7.2] def change diff --git a/db/migrate/20241103075705_solid_queue_install.rb b/db/migrate/20241103075705_solid_queue_install.rb index 3a0b744..fcd7627 100644 --- a/db/migrate/20241103075705_solid_queue_install.rb +++ b/db/migrate/20241103075705_solid_queue_install.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class SolidQueueInstall < ActiveRecord::Migration[7.2] def change diff --git a/db/migrate/20241103093955_remove_email_from_guests.rb b/db/migrate/20241103093955_remove_email_from_guests.rb index 26ca939..cde2f00 100644 --- a/db/migrate/20241103093955_remove_email_from_guests.rb +++ b/db/migrate/20241103093955_remove_email_from_guests.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class RemoveEmailFromGuests < ActiveRecord::Migration[7.2] def change diff --git a/db/migrate/20241103133122_add_color_to_group.rb b/db/migrate/20241103133122_add_color_to_group.rb index bca1c30..a031638 100644 --- a/db/migrate/20241103133122_add_color_to_group.rb +++ b/db/migrate/20241103133122_add_color_to_group.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AddColorToGroup < ActiveRecord::Migration[7.2] def change diff --git a/db/migrate/20241111063741_merge_guest_names.rb b/db/migrate/20241111063741_merge_guest_names.rb index 849f58f..3b2690c 100644 --- a/db/migrate/20241111063741_merge_guest_names.rb +++ b/db/migrate/20241111063741_merge_guest_names.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class MergeGuestNames < ActiveRecord::Migration[8.0] def change diff --git a/db/migrate/20241130095753_devise_create_users.rb b/db/migrate/20241130095753_devise_create_users.rb index 977c72e..efdddef 100644 --- a/db/migrate/20241130095753_devise_create_users.rb +++ b/db/migrate/20241130095753_devise_create_users.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20241130182228_create_weddings.rb b/db/migrate/20241130182228_create_weddings.rb index 2151f72..857b63e 100644 --- a/db/migrate/20241130182228_create_weddings.rb +++ b/db/migrate/20241130182228_create_weddings.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateWeddings < ActiveRecord::Migration[8.0] def change diff --git a/db/migrate/20241130185731_add_wedding_id_to_models.rb b/db/migrate/20241130185731_add_wedding_id_to_models.rb index 63e5c32..85fbabf 100644 --- a/db/migrate/20241130185731_add_wedding_id_to_models.rb +++ b/db/migrate/20241130185731_add_wedding_id_to_models.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AddWeddingIdToModels < ActiveRecord::Migration[8.0] def change diff --git a/db/migrate/20241207112305_remove_wedding_date.rb b/db/migrate/20241207112305_remove_wedding_date.rb index c810ee4..5b2e987 100644 --- a/db/migrate/20241207112305_remove_wedding_date.rb +++ b/db/migrate/20241207112305_remove_wedding_date.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class RemoveWeddingDate < ActiveRecord::Migration[8.0] def change diff --git a/db/migrate/20241208102932_allow_ungrouped_guests.rb b/db/migrate/20241208102932_allow_ungrouped_guests.rb index c06d40c..572a871 100644 --- a/db/migrate/20241208102932_allow_ungrouped_guests.rb +++ b/db/migrate/20241208102932_allow_ungrouped_guests.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AllowUngroupedGuests < ActiveRecord::Migration[8.0] def change diff --git a/db/migrate/20241216231415_create_group_affinities.rb b/db/migrate/20241216231415_create_group_affinities.rb index 2b03897..22f86c5 100644 --- a/db/migrate/20241216231415_create_group_affinities.rb +++ b/db/migrate/20241216231415_create_group_affinities.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateGroupAffinities < ActiveRecord::Migration[8.0] disable_ddl_transaction! diff --git a/db/queue_schema.rb b/db/queue_schema.rb index 24748f4..41a41b0 100644 --- a/db/queue_schema.rb +++ b/db/queue_schema.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors ActiveRecord::Schema[7.1].define(version: 1) do end diff --git a/db/schema.rb b/db/schema.rb index f723b74..11aa68c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to diff --git a/db/seeds.rb b/db/seeds.rb index eb45757..fcf5ec3 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors NUMBER_OF_GUESTS = 50 diff --git a/spec/extensions/tree_spec.rb b/spec/extensions/tree_spec.rb index 1d3e6d0..4b45e26 100644 --- a/spec/extensions/tree_spec.rb +++ b/spec/extensions/tree_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index e122a43..c722f78 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index f5f2b65..ca83cb9 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 84ae9ec..de8d929 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index 25a5c5e..f80c7ac 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb index 19c5f14..3f447ed 100644 --- a/spec/factories/table_arrangement.rb +++ b/spec/factories/table_arrangement.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 3616935..8e7f582 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index 1e6f555..a1959c6 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index b002e78..c48bc93 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/models/group_affinity_spec.rb b/spec/models/group_affinity_spec.rb index 9d56d08..8afd2c6 100644 --- a/spec/models/group_affinity_spec.rb +++ b/spec/models/group_affinity_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index f7e7fd3..73185ca 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index a63da70..e1f7ad6 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/models/seat_spec.rb b/spec/models/seat_spec.rb index 40e63f2..5a7ddb4 100644 --- a/spec/models/seat_spec.rb +++ b/spec/models/seat_spec.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index 493318c..6bdbb55 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index ae1be79..274c031 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index 84db4f1..acc5c4c 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -1,6 +1,6 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index 7847abe..f1c2c4f 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/queries/groups/summary_query_spec.rb b/spec/queries/groups/summary_query_spec.rb index 1ef1a33..6300724 100644 --- a/spec/queries/groups/summary_query_spec.rb +++ b/spec/queries/groups/summary_query_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 7058316..faf5740 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index e458abb..95e4b13 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/captcha_spec.rb b/spec/requests/captcha_spec.rb index 17dc9bf..e3f49cf 100644 --- a/spec/requests/captcha_spec.rb +++ b/spec/requests/captcha_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index 557f2e3..1f064d6 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index 30c512e..2e9d5ac 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index 1ef80d4..0ecd72f 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index ee914b3..549834e 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/summary_spec.rb b/spec/requests/summary_spec.rb index f39ab7a..d6a1f85 100644 --- a/spec/requests/summary_spec.rb +++ b/spec/requests/summary_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index 34c686f..4e87cb2 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/tokens_spec.rb b/spec/requests/tokens_spec.rb index 406e041..a6aac2e 100644 --- a/spec/requests/tokens_spec.rb +++ b/spec/requests/tokens_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb index 8628683..492f6f3 100644 --- a/spec/requests/users/confirmations_spec.rb +++ b/spec/requests/users/confirmations_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index f1dd82c..e55d4c8 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/users/sessions_spec.rb b/spec/requests/users/sessions_spec.rb index 775f56c..60b49e1 100644 --- a/spec/requests/users/sessions_spec.rb +++ b/spec/requests/users/sessions_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index 3851bbf..5597dd1 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/services/tables/distribution_spec.rb b/spec/services/tables/distribution_spec.rb index d22b817..e598a52 100644 --- a/spec/services/tables/distribution_spec.rb +++ b/spec/services/tables/distribution_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/services/tables/shift_spec.rb b/spec/services/tables/shift_spec.rb index 590d62b..39e07f8 100644 --- a/spec/services/tables/shift_spec.rb +++ b/spec/services/tables/shift_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/services/tables/swap_spec.rb b/spec/services/tables/swap_spec.rb index 94ccced..d8db4a7 100644 --- a/spec/services/tables/swap_spec.rb +++ b/spec/services/tables/swap_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/services/vns/engine_spec.rb b/spec/services/vns/engine_spec.rb index e3f379c..73d7b82 100644 --- a/spec/services/vns/engine_spec.rb +++ b/spec/services/vns/engine_spec.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2aa37f6..d405628 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index 2c53057..5ba4cce 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index b3f3e0b..09df9a1 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true From 91bbae1c63f3ea8346c59230a2ca635a54e3bda2 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 13 Jan 2025 20:38:47 +0000 Subject: [PATCH 264/283] Add copyright notice --- app/channels/application_cable/channel.rb | 2 ++ app/channels/application_cable/connection.rb | 2 ++ app/controllers/affinities_controller.rb | 2 ++ app/controllers/application_controller.rb | 2 ++ app/controllers/captcha_controller.rb | 2 ++ app/controllers/expenses_controller.rb | 2 ++ app/controllers/groups_controller.rb | 2 ++ app/controllers/guests_controller.rb | 2 ++ app/controllers/summary_controller.rb | 2 ++ app/controllers/tables_arrangements_controller.rb | 2 ++ app/controllers/tokens_controller.rb | 2 ++ app/controllers/users/confirmations_controller.rb | 2 ++ app/controllers/users/registrations_controller.rb | 2 ++ app/controllers/users/sessions_controller.rb | 2 ++ app/extensions/tree_node_extension.rb | 2 ++ app/helpers/application_helper.rb | 2 ++ app/helpers/expenses_helper.rb | 2 ++ app/helpers/groups_helper.rb | 2 ++ app/helpers/guests_helper.rb | 2 ++ app/helpers/tables_arrangements_helper.rb | 2 ++ app/jobs/application_job.rb | 2 ++ app/jobs/table_simulator_job.rb | 2 ++ app/mailers/application_mailer.rb | 2 ++ app/models/application_record.rb | 2 ++ app/models/expense.rb | 2 ++ app/models/group.rb | 2 ++ app/models/group_affinity.rb | 2 ++ app/models/guest.rb | 2 ++ app/models/seat.rb | 2 ++ app/models/tables_arrangement.rb | 2 ++ app/models/user.rb | 2 ++ app/models/wedding.rb | 2 ++ app/queries/expenses/total_query.rb | 2 ++ app/queries/groups/summary_query.rb | 2 ++ app/serializers/serializable_group.rb | 2 ++ app/serializers/serializable_guest.rb | 2 ++ app/services/affinity_groups_hierarchy.rb | 2 ++ app/services/libre_captcha.rb | 2 ++ app/services/tables/discomfort_calculator.rb | 2 ++ app/services/tables/distribution.rb | 2 ++ app/services/tables/shift.rb | 2 ++ app/services/tables/swap.rb | 2 ++ app/services/tables/table.rb | 2 ++ app/services/vns/engine.rb | 2 ++ app/views/layouts/mailer.html.erb | 2 ++ app/views/layouts/mailer.text.erb | 2 ++ app/views/users/mailer/confirmation_instructions.html.erb | 2 ++ app/views/users/mailer/email_changed.html.erb | 2 ++ app/views/users/mailer/password_change.html.erb | 2 ++ app/views/users/mailer/reset_password_instructions.html.erb | 2 ++ app/views/users/mailer/unlock_instructions.html.erb | 2 ++ config/application.rb | 2 ++ config/boot.rb | 2 ++ config/environment.rb | 2 ++ config/environments/development.rb | 2 ++ config/environments/production.rb | 2 ++ config/environments/test.rb | 2 ++ config/importmap.rb | 2 ++ config/initializers/acts_as_tenant.rb | 2 ++ config/initializers/assets.rb | 2 ++ config/initializers/colors.rb | 2 ++ config/initializers/content_security_policy.rb | 2 ++ config/initializers/cors.rb | 2 ++ config/initializers/devise.rb | 2 ++ config/initializers/filter_parameter_logging.rb | 2 ++ config/initializers/inflections.rb | 2 ++ config/initializers/permissions_policy.rb | 2 ++ config/initializers/rswag_api.rb | 2 ++ config/initializers/rswag_ui.rb | 2 ++ config/initializers/ruby_extensions.rb | 2 ++ config/puma.rb | 2 ++ config/routes.rb | 2 ++ db/migrate/20240711175425_create_expenses.rb | 2 ++ db/migrate/20240711180753_create_guests.rb | 2 ++ ..._acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb | 2 ++ ...627_add_missing_unique_indices.acts_as_taggable_on_engine.rb | 2 ++ ...taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb | 2 ++ ...629_add_missing_taggable_index.acts_as_taggable_on_engine.rb | 2 ++ ...change_collation_for_tag_names.acts_as_taggable_on_engine.rb | 2 ++ ...dd_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb | 2 ++ ...1181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb | 2 ++ db/migrate/20240724181756_create_tables_arrangements.rb | 2 ++ db/migrate/20240724181853_create_seats.rb | 2 ++ db/migrate/20240811142121_create_groups.rb | 2 ++ db/migrate/20240811143801_add_parent_to_group.rb | 2 ++ db/migrate/20240811154115_add_group_to_guest.rb | 2 ++ db/migrate/20240811170021_add_status_to_guest.rb | 2 ++ db/migrate/20241101181052_drop_taggable_tables.rb | 2 ++ db/migrate/20241103072808_add_name_to_tables_arrangements.rb | 2 ++ db/migrate/20241103075705_solid_queue_install.rb | 2 ++ db/migrate/20241103093955_remove_email_from_guests.rb | 2 ++ db/migrate/20241103133122_add_color_to_group.rb | 2 ++ db/migrate/20241111063741_merge_guest_names.rb | 2 ++ db/migrate/20241130095753_devise_create_users.rb | 2 ++ db/migrate/20241130182228_create_weddings.rb | 2 ++ db/migrate/20241130185731_add_wedding_id_to_models.rb | 2 ++ db/migrate/20241207112305_remove_wedding_date.rb | 2 ++ db/migrate/20241208102932_allow_ungrouped_guests.rb | 2 ++ db/migrate/20241216231415_create_group_affinities.rb | 2 ++ db/queue_schema.rb | 2 ++ db/schema.rb | 2 ++ db/seeds.rb | 2 ++ spec/extensions/tree_spec.rb | 2 ++ spec/factories/expense.rb | 2 ++ spec/factories/group_affinities.rb | 2 ++ spec/factories/groups.rb | 2 ++ spec/factories/guest.rb | 2 ++ spec/factories/table_arrangement.rb | 2 ++ spec/factories/users.rb | 2 ++ spec/factories/weddings.rb | 2 ++ spec/models/expense_spec.rb | 2 ++ spec/models/group_affinity_spec.rb | 2 ++ spec/models/group_spec.rb | 2 ++ spec/models/guest_spec.rb | 2 ++ spec/models/seat_spec.rb | 2 ++ spec/models/tables_arrangement_spec.rb | 2 ++ spec/models/user_spec.rb | 2 ++ spec/models/wedding_spec.rb | 2 ++ spec/queries/expenses/total_query_spec.rb | 2 ++ spec/queries/groups/summary_query_spec.rb | 2 ++ spec/rails_helper.rb | 2 ++ spec/requests/affinities_spec.rb | 2 ++ spec/requests/captcha_spec.rb | 2 ++ spec/requests/expenses_spec.rb | 2 ++ spec/requests/groups_spec.rb | 2 ++ spec/requests/guests_spec.rb | 2 ++ spec/requests/schemas.rb | 2 ++ spec/requests/summary_spec.rb | 2 ++ spec/requests/tables_arrangements_spec.rb | 2 ++ spec/requests/tokens_spec.rb | 2 ++ spec/requests/users/confirmations_spec.rb | 2 ++ spec/requests/users/registrations_spec.rb | 2 ++ spec/requests/users/sessions_spec.rb | 2 ++ spec/services/tables/discomfort_calculator_spec.rb | 2 ++ spec/services/tables/distribution_spec.rb | 2 ++ spec/services/tables/shift_spec.rb | 2 ++ spec/services/tables/swap_spec.rb | 2 ++ spec/services/vns/engine_spec.rb | 2 ++ spec/spec_helper.rb | 2 ++ spec/swagger_helper.rb | 2 ++ spec/swagger_response_helper.rb | 2 ++ 141 files changed, 282 insertions(+) diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index 88942fe..716be35 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index ab575d6..286b699 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index a62288c..00876b9 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 025dc85..a73aa87 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 6c3f3ca..98fcbcb 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 8b00ddb..093d691 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 08334aa..8baa833 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 9778795..7aee16d 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb index 0d3f655..9481a47 100644 --- a/app/controllers/summary_controller.rb +++ b/app/controllers/summary_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index c09d453..76a6774 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb index a0ee546..4b71df3 100644 --- a/app/controllers/tokens_controller.rb +++ b/app/controllers/tokens_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index 01eb91e..c078a1a 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index f261e90..2a25268 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 4d7b6a8..8464417 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/extensions/tree_node_extension.rb b/app/extensions/tree_node_extension.rb index 6894dd7..443c658 100644 --- a/app/extensions/tree_node_extension.rb +++ b/app/extensions/tree_node_extension.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9dbd98c..d0c1baa 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/helpers/expenses_helper.rb b/app/helpers/expenses_helper.rb index 0b8c324..05513f7 100644 --- a/app/helpers/expenses_helper.rb +++ b/app/helpers/expenses_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index feda408..85d797b 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/helpers/guests_helper.rb b/app/helpers/guests_helper.rb index 369b8ed..639cf38 100644 --- a/app/helpers/guests_helper.rb +++ b/app/helpers/guests_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/helpers/tables_arrangements_helper.rb b/app/helpers/tables_arrangements_helper.rb index 6353e46..a039c6e 100644 --- a/app/helpers/tables_arrangements_helper.rb +++ b/app/helpers/tables_arrangements_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 561fb56..62fb66f 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index 51b7256..56a59d0 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index b28db31..706222d 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 61b9d31..d6fee04 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/expense.rb b/app/models/expense.rb index 66b32f3..f810d1c 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/group.rb b/app/models/group.rb index 2db28ed..92d88a6 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb index 8e70d59..b94e0c5 100644 --- a/app/models/group_affinity.rb +++ b/app/models/group_affinity.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/guest.rb b/app/models/guest.rb index ad0542f..c9eb0b0 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/seat.rb b/app/models/seat.rb index 9c31c42..71e9d77 100644 --- a/app/models/seat.rb +++ b/app/models/seat.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index adece9a..3e6aef9 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/user.rb b/app/models/user.rb index ff46fff..d263c97 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/models/wedding.rb b/app/models/wedding.rb index 83525b5..4368c50 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index ae4fe65..0ba9f5f 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb index 81c91b4..e1b7138 100644 --- a/app/queries/groups/summary_query.rb +++ b/app/queries/groups/summary_query.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/serializers/serializable_group.rb b/app/serializers/serializable_group.rb index b3e2258..4572c78 100644 --- a/app/serializers/serializable_group.rb +++ b/app/serializers/serializable_group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/serializers/serializable_guest.rb b/app/serializers/serializable_guest.rb index ee4bac1..3e95236 100644 --- a/app/serializers/serializable_guest.rb +++ b/app/serializers/serializable_guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index ef47845..783c7ed 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb index a3843da..d644ba2 100644 --- a/app/services/libre_captcha.rb +++ b/app/services/libre_captcha.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index adae828..bd35087 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index aca8618..7b4762f 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/tables/shift.rb b/app/services/tables/shift.rb index d5592d9..45e7150 100644 --- a/app/services/tables/shift.rb +++ b/app/services/tables/shift.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/tables/swap.rb b/app/services/tables/swap.rb index 04abc18..230959d 100644 --- a/app/services/tables/swap.rb +++ b/app/services/tables/swap.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index cc05ea0..3628c49 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index d66c80b..fe1ff91 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 32b0c16..4eee621 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb index 9bdce1a..62b17c3 100644 --- a/app/views/layouts/mailer.text.erb +++ b/app/views/layouts/mailer.text.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> <%= yield %> diff --git a/app/views/users/mailer/confirmation_instructions.html.erb b/app/views/users/mailer/confirmation_instructions.html.erb index cd3b2f1..688f1bc 100644 --- a/app/views/users/mailer/confirmation_instructions.html.erb +++ b/app/views/users/mailer/confirmation_instructions.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>

    Welcome <%= @email %>!

    diff --git a/app/views/users/mailer/email_changed.html.erb b/app/views/users/mailer/email_changed.html.erb index f5f2998..8935bc0 100644 --- a/app/views/users/mailer/email_changed.html.erb +++ b/app/views/users/mailer/email_changed.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>

    Hello <%= @email %>!

    diff --git a/app/views/users/mailer/password_change.html.erb b/app/views/users/mailer/password_change.html.erb index 1181727..3d72a19 100644 --- a/app/views/users/mailer/password_change.html.erb +++ b/app/views/users/mailer/password_change.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>

    Hello <%= @resource.email %>!

    diff --git a/app/views/users/mailer/reset_password_instructions.html.erb b/app/views/users/mailer/reset_password_instructions.html.erb index 95bc588..fc45ec9 100644 --- a/app/views/users/mailer/reset_password_instructions.html.erb +++ b/app/views/users/mailer/reset_password_instructions.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>

    Hello <%= @resource.email %>!

    diff --git a/app/views/users/mailer/unlock_instructions.html.erb b/app/views/users/mailer/unlock_instructions.html.erb index 3efb341..fddd365 100644 --- a/app/views/users/mailer/unlock_instructions.html.erb +++ b/app/views/users/mailer/unlock_instructions.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 2024 Manuel Bustillo %> + <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>

    Hello <%= @resource.email %>!

    diff --git a/config/application.rb b/config/application.rb index 1795a6f..32fbf95 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors require_relative 'boot' diff --git a/config/boot.rb b/config/boot.rb index 4bebfef..59676bc 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) diff --git a/config/environment.rb b/config/environment.rb index 49c0fb1..df4bf2e 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Load the Rails application. diff --git a/config/environments/development.rb b/config/environments/development.rb index 232e88e..b0f2198 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors require "active_support/core_ext/integer/time" diff --git a/config/environments/production.rb b/config/environments/production.rb index 4db7dca..59e22d6 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors require "active_support/core_ext/integer/time" diff --git a/config/environments/test.rb b/config/environments/test.rb index 0982e19..28b85d7 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors require "active_support/core_ext/integer/time" diff --git a/config/importmap.rb b/config/importmap.rb index 7ec75cd..19991f1 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Pin npm packages by running ./bin/importmap diff --git a/config/initializers/acts_as_tenant.rb b/config/initializers/acts_as_tenant.rb index fd8890d..72510c4 100644 --- a/config/initializers/acts_as_tenant.rb +++ b/config/initializers/acts_as_tenant.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors ActsAsTenant.configure do |config| diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 4772d1a..8e722ce 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Be sure to restart your server when you modify this file. diff --git a/config/initializers/colors.rb b/config/initializers/colors.rb index ea065fa..f1bbdd2 100644 --- a/config/initializers/colors.rb +++ b/config/initializers/colors.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors Chroma.define_palette :decreasing_saturation do diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 8798db8..3f9221f 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Be sure to restart your server when you modify this file. diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index ce186ed..565fe09 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # config/initializers/cors.rb diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 3977aa9..0ecbf5e 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 1be5be3..e184d9a 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Be sure to restart your server when you modify this file. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 2a6b3c4..0f9a0ea 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Be sure to restart your server when you modify this file. diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index f281e9b..af956f8 100644 --- a/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Be sure to restart your server when you modify this file. diff --git a/config/initializers/rswag_api.rb b/config/initializers/rswag_api.rb index 42deb17..4c11988 100644 --- a/config/initializers/rswag_api.rb +++ b/config/initializers/rswag_api.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors Rswag::Api.configure do |c| diff --git a/config/initializers/rswag_ui.rb b/config/initializers/rswag_ui.rb index a50e133..dec08ce 100644 --- a/config/initializers/rswag_ui.rb +++ b/config/initializers/rswag_ui.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors Rswag::Ui.configure do |c| diff --git a/config/initializers/ruby_extensions.rb b/config/initializers/ruby_extensions.rb index 47091de..9fb7af1 100644 --- a/config/initializers/ruby_extensions.rb +++ b/config/initializers/ruby_extensions.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class Numeric diff --git a/config/puma.rb b/config/puma.rb index 128df0b..3d8dbc2 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # This configuration file will be evaluated by Puma. The top-level methods that diff --git a/config/routes.rb b/config/routes.rb index bb2be8f..cf97731 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors Rails.application.routes.draw do diff --git a/db/migrate/20240711175425_create_expenses.rb b/db/migrate/20240711175425_create_expenses.rb index 52fa269..1538790 100644 --- a/db/migrate/20240711175425_create_expenses.rb +++ b/db/migrate/20240711175425_create_expenses.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateExpenses < ActiveRecord::Migration[7.1] diff --git a/db/migrate/20240711180753_create_guests.rb b/db/migrate/20240711180753_create_guests.rb index d2f876a..6597d34 100644 --- a/db/migrate/20240711180753_create_guests.rb +++ b/db/migrate/20240711180753_create_guests.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateGuests < ActiveRecord::Migration[7.1] diff --git a/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb index f1709ca..a614c83 100644 --- a/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb index a1f7d1c..ab62f5f 100644 --- a/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb index 078b0c0..1d9f0e9 100644 --- a/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb index 126aa38..0d79854 100644 --- a/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb index fec8036..e643bb4 100644 --- a/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb index 5f98782..fa60128 100644 --- a/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb index 16fc678..fa8df4d 100644 --- a/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20240724181756_create_tables_arrangements.rb b/db/migrate/20240724181756_create_tables_arrangements.rb index 81defbc..ed278c8 100644 --- a/db/migrate/20240724181756_create_tables_arrangements.rb +++ b/db/migrate/20240724181756_create_tables_arrangements.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateTablesArrangements < ActiveRecord::Migration[7.1] diff --git a/db/migrate/20240724181853_create_seats.rb b/db/migrate/20240724181853_create_seats.rb index a4fa0ae..462df84 100644 --- a/db/migrate/20240724181853_create_seats.rb +++ b/db/migrate/20240724181853_create_seats.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateSeats < ActiveRecord::Migration[7.1] diff --git a/db/migrate/20240811142121_create_groups.rb b/db/migrate/20240811142121_create_groups.rb index cad993a..8380c36 100644 --- a/db/migrate/20240811142121_create_groups.rb +++ b/db/migrate/20240811142121_create_groups.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateGroups < ActiveRecord::Migration[7.1] diff --git a/db/migrate/20240811143801_add_parent_to_group.rb b/db/migrate/20240811143801_add_parent_to_group.rb index 868ea79..fc4a881 100644 --- a/db/migrate/20240811143801_add_parent_to_group.rb +++ b/db/migrate/20240811143801_add_parent_to_group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AddParentToGroup < ActiveRecord::Migration[7.1] diff --git a/db/migrate/20240811154115_add_group_to_guest.rb b/db/migrate/20240811154115_add_group_to_guest.rb index b7df5aa..ff88298 100644 --- a/db/migrate/20240811154115_add_group_to_guest.rb +++ b/db/migrate/20240811154115_add_group_to_guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AddGroupToGuest < ActiveRecord::Migration[7.1] diff --git a/db/migrate/20240811170021_add_status_to_guest.rb b/db/migrate/20240811170021_add_status_to_guest.rb index ec92086..09a2a9e 100644 --- a/db/migrate/20240811170021_add_status_to_guest.rb +++ b/db/migrate/20240811170021_add_status_to_guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AddStatusToGuest < ActiveRecord::Migration[7.1] diff --git a/db/migrate/20241101181052_drop_taggable_tables.rb b/db/migrate/20241101181052_drop_taggable_tables.rb index 1ece831..6787951 100644 --- a/db/migrate/20241101181052_drop_taggable_tables.rb +++ b/db/migrate/20241101181052_drop_taggable_tables.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class DropTaggableTables < ActiveRecord::Migration[7.2] diff --git a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb index 1893200..3bd57a2 100644 --- a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb +++ b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AddNameToTablesArrangements < ActiveRecord::Migration[7.2] diff --git a/db/migrate/20241103075705_solid_queue_install.rb b/db/migrate/20241103075705_solid_queue_install.rb index fcd7627..ca9e45e 100644 --- a/db/migrate/20241103075705_solid_queue_install.rb +++ b/db/migrate/20241103075705_solid_queue_install.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class SolidQueueInstall < ActiveRecord::Migration[7.2] diff --git a/db/migrate/20241103093955_remove_email_from_guests.rb b/db/migrate/20241103093955_remove_email_from_guests.rb index cde2f00..a6f9798 100644 --- a/db/migrate/20241103093955_remove_email_from_guests.rb +++ b/db/migrate/20241103093955_remove_email_from_guests.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class RemoveEmailFromGuests < ActiveRecord::Migration[7.2] diff --git a/db/migrate/20241103133122_add_color_to_group.rb b/db/migrate/20241103133122_add_color_to_group.rb index a031638..30218e3 100644 --- a/db/migrate/20241103133122_add_color_to_group.rb +++ b/db/migrate/20241103133122_add_color_to_group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AddColorToGroup < ActiveRecord::Migration[7.2] diff --git a/db/migrate/20241111063741_merge_guest_names.rb b/db/migrate/20241111063741_merge_guest_names.rb index 3b2690c..90d5e82 100644 --- a/db/migrate/20241111063741_merge_guest_names.rb +++ b/db/migrate/20241111063741_merge_guest_names.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class MergeGuestNames < ActiveRecord::Migration[8.0] diff --git a/db/migrate/20241130095753_devise_create_users.rb b/db/migrate/20241130095753_devise_create_users.rb index efdddef..496e3fc 100644 --- a/db/migrate/20241130095753_devise_create_users.rb +++ b/db/migrate/20241130095753_devise_create_users.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/db/migrate/20241130182228_create_weddings.rb b/db/migrate/20241130182228_create_weddings.rb index 857b63e..77ada38 100644 --- a/db/migrate/20241130182228_create_weddings.rb +++ b/db/migrate/20241130182228_create_weddings.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateWeddings < ActiveRecord::Migration[8.0] diff --git a/db/migrate/20241130185731_add_wedding_id_to_models.rb b/db/migrate/20241130185731_add_wedding_id_to_models.rb index 85fbabf..c9b231c 100644 --- a/db/migrate/20241130185731_add_wedding_id_to_models.rb +++ b/db/migrate/20241130185731_add_wedding_id_to_models.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AddWeddingIdToModels < ActiveRecord::Migration[8.0] diff --git a/db/migrate/20241207112305_remove_wedding_date.rb b/db/migrate/20241207112305_remove_wedding_date.rb index 5b2e987..ca28b71 100644 --- a/db/migrate/20241207112305_remove_wedding_date.rb +++ b/db/migrate/20241207112305_remove_wedding_date.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class RemoveWeddingDate < ActiveRecord::Migration[8.0] diff --git a/db/migrate/20241208102932_allow_ungrouped_guests.rb b/db/migrate/20241208102932_allow_ungrouped_guests.rb index 572a871..f567676 100644 --- a/db/migrate/20241208102932_allow_ungrouped_guests.rb +++ b/db/migrate/20241208102932_allow_ungrouped_guests.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class AllowUngroupedGuests < ActiveRecord::Migration[8.0] diff --git a/db/migrate/20241216231415_create_group_affinities.rb b/db/migrate/20241216231415_create_group_affinities.rb index 22f86c5..113d026 100644 --- a/db/migrate/20241216231415_create_group_affinities.rb +++ b/db/migrate/20241216231415_create_group_affinities.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors class CreateGroupAffinities < ActiveRecord::Migration[8.0] diff --git a/db/queue_schema.rb b/db/queue_schema.rb index 41a41b0..149f41f 100644 --- a/db/queue_schema.rb +++ b/db/queue_schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors ActiveRecord::Schema[7.1].define(version: 1) do diff --git a/db/schema.rb b/db/schema.rb index 11aa68c..cfc1383 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # This file is auto-generated from the current state of the database. Instead diff --git a/db/seeds.rb b/db/seeds.rb index fcf5ec3..e61f33b 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors NUMBER_OF_GUESTS = 50 diff --git a/spec/extensions/tree_spec.rb b/spec/extensions/tree_spec.rb index 4b45e26..937a0fe 100644 --- a/spec/extensions/tree_spec.rb +++ b/spec/extensions/tree_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index c722f78..ceaf501 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index ca83cb9..c33de53 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index de8d929..f19ba72 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index f80c7ac..a1f284a 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb index 3f447ed..86ddddf 100644 --- a/spec/factories/table_arrangement.rb +++ b/spec/factories/table_arrangement.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 8e7f582..cc49d11 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index a1959c6..de994c8 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index c48bc93..9a8fc47 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/group_affinity_spec.rb b/spec/models/group_affinity_spec.rb index 8afd2c6..5469d27 100644 --- a/spec/models/group_affinity_spec.rb +++ b/spec/models/group_affinity_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 73185ca..d7ec456 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index e1f7ad6..ed526e8 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/models/seat_spec.rb b/spec/models/seat_spec.rb index 5a7ddb4..da5c17f 100644 --- a/spec/models/seat_spec.rb +++ b/spec/models/seat_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index 6bdbb55..b216b18 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 274c031..9f69608 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index acc5c4c..735255d 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index f1c2c4f..e3f16c4 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/queries/groups/summary_query_spec.rb b/spec/queries/groups/summary_query_spec.rb index 6300724..cb3b7fe 100644 --- a/spec/queries/groups/summary_query_spec.rb +++ b/spec/queries/groups/summary_query_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index faf5740..653bbf9 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index 95e4b13..2adad02 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/captcha_spec.rb b/spec/requests/captcha_spec.rb index e3f49cf..e1f2fea 100644 --- a/spec/requests/captcha_spec.rb +++ b/spec/requests/captcha_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index 1f064d6..e6defe4 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index 2e9d5ac..49d121b 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index 0ecd72f..40a6686 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index 549834e..3fd49f2 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/summary_spec.rb b/spec/requests/summary_spec.rb index d6a1f85..3dc6ac0 100644 --- a/spec/requests/summary_spec.rb +++ b/spec/requests/summary_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index 4e87cb2..cf48cac 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/tokens_spec.rb b/spec/requests/tokens_spec.rb index a6aac2e..b5b9cf7 100644 --- a/spec/requests/tokens_spec.rb +++ b/spec/requests/tokens_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb index 492f6f3..d76d53a 100644 --- a/spec/requests/users/confirmations_spec.rb +++ b/spec/requests/users/confirmations_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index e55d4c8..064d28e 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/requests/users/sessions_spec.rb b/spec/requests/users/sessions_spec.rb index 60b49e1..61c2662 100644 --- a/spec/requests/users/sessions_spec.rb +++ b/spec/requests/users/sessions_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index 5597dd1..81633d7 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/services/tables/distribution_spec.rb b/spec/services/tables/distribution_spec.rb index e598a52..a427f40 100644 --- a/spec/services/tables/distribution_spec.rb +++ b/spec/services/tables/distribution_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/services/tables/shift_spec.rb b/spec/services/tables/shift_spec.rb index 39e07f8..67a4d5d 100644 --- a/spec/services/tables/shift_spec.rb +++ b/spec/services/tables/shift_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/services/tables/swap_spec.rb b/spec/services/tables/swap_spec.rb index d8db4a7..ae9e974 100644 --- a/spec/services/tables/swap_spec.rb +++ b/spec/services/tables/swap_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/services/vns/engine_spec.rb b/spec/services/vns/engine_spec.rb index 73d7b82..c8d489d 100644 --- a/spec/services/vns/engine_spec.rb +++ b/spec/services/vns/engine_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d405628..f5a5a59 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index 5ba4cce..bbf6c7f 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index 09df9a1..c13d8a8 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # Copyright (C) 2024-2025 LibreWeddingPlanner contributors # frozen_string_literal: true From c6c5a87d8bffc2ff2d302292f36d4bc90d5a3d10 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 14 Jan 2025 19:13:40 +0100 Subject: [PATCH 265/283] Fix duplicate row index on upsert statement --- app/controllers/affinities_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index 7d63e9e..1412423 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -26,7 +26,7 @@ class AffinitiesController < ApplicationController } end - GroupAffinity.upsert_all(affinities) + GroupAffinity.upsert_all(affinities, unique_by: :uindex_group_pair) render json: {}, status: :ok rescue ActiveRecord::InvalidForeignKey @@ -50,7 +50,7 @@ class AffinitiesController < ApplicationController } end - GroupAffinity.upsert_all(affinities) + GroupAffinity.upsert_all(affinities, unique_by: :uindex_group_pair) render json: {}, status: :ok end From 8a9d0bfdb87c3cdcdd75143470d4d1c9d22fd446 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 14 Jan 2025 19:51:29 +0100 Subject: [PATCH 266/283] Use the lateste version of ruby/setup-ruby --- .gitea/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index 6166ed7..886fce3 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} - - uses: ruby/setup-ruby@v1.202.0 + - uses: ruby/setup-ruby@v1.207.0 - run: bundle install - run: bundle exec rubocop --force-exclusion --parallel - name: Wait until Postgres is ready to accept connections From 44dbb7e00587b998d7c790b2967ffa72684bcd32 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 14 Jan 2025 20:11:34 +0100 Subject: [PATCH 267/283] Run bundle lock --normalize-platforms --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4295b50..3b90915 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -609,7 +609,7 @@ CHECKSUMS zeitwerk (2.7.1) sha256=0945986050e4907140895378e74df1fe882a2271ed087cc6c6d6b00d415a2756 RUBY VERSION - ruby 3.3.6p108 + ruby 3.4.1p0 BUNDLED WITH 2.6.1 From 23d09df54353a5e9816e8ebba47980917ae98930 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 14 Jan 2025 20:11:59 +0100 Subject: [PATCH 268/283] Fix version of GH action --- .gitea/workflows/license_finder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/license_finder.yml b/.gitea/workflows/license_finder.yml index fb286ab..6e21f6e 100644 --- a/.gitea/workflows/license_finder.yml +++ b/.gitea/workflows/license_finder.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} - - uses: ruby/setup-ruby@v1 + - uses: ruby/setup-ruby@v1.207.0 - name: Install project dependencies run: bundle install --jobs `getconf _NPROCESSORS_ONLN` - name: Run license finder From c1774a1c6c773b73f8c2474f0cc8f59f014c5fcc Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 14 Jan 2025 20:16:02 +0100 Subject: [PATCH 269/283] Upgrade Nokogiri to the latest version --- Gemfile.lock | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3b90915..eadd3a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -188,6 +188,7 @@ GEM marcel (1.0.4) method_source (1.1.0) mini_mime (1.1.5) + mini_portile2 (2.8.8) minitest (5.25.4) money (6.19.0) i18n (>= 0.6.4, <= 2) @@ -204,17 +205,18 @@ GEM net-smtp (0.5.0) net-protocol nio4r (2.7.4) - nokogiri (1.17.2-aarch64-linux) + nokogiri (1.18.1) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.17.2-arm-linux) + nokogiri (1.18.1-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.17.2-arm64-darwin) + nokogiri (1.18.1-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.17.2-x86-linux) + nokogiri (1.18.1-arm64-darwin) racc (~> 1.4) - nokogiri (1.17.2-x86_64-darwin) + nokogiri (1.18.1-x86_64-darwin) racc (~> 1.4) - nokogiri (1.17.2-x86_64-linux) + nokogiri (1.18.1-x86_64-linux-gnu) racc (~> 1.4) orm_adapter (0.5.0) parallel (1.26.3) @@ -521,6 +523,7 @@ CHECKSUMS marcel (1.0.4) sha256=0d5649feb64b8f19f3d3468b96c680bae9746335d02194270287868a661516a4 method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5 mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef + mini_portile2 (2.8.8) sha256=8e47136cdac04ce81750bb6c09733b37895bf06962554e4b4056d78168d70a75 minitest (5.25.4) sha256=9cf2cae25ac4dfc90c988ebc3b917f53c054978b673273da1bd20bcb0778f947 money (6.19.0) sha256=ec936fa1e42f2783719241ed9fd52725d0efa628f928feea1eb5c37d5de7daf3 msgpack (1.7.2) sha256=59ab62fd8a4d0dfbde45009f87eb6f158ab2628a7c48886b0256f175166baaa8 @@ -530,12 +533,12 @@ CHECKSUMS net-protocol (0.2.2) sha256=aa73e0cba6a125369de9837b8d8ef82a61849360eba0521900e2c3713aa162a8 net-smtp (0.5.0) sha256=5fc0415e6ea1cc0b3dfea7270438ec22b278ca8d524986a3ae4e5ae8d087b42a nio4r (2.7.4) sha256=d95dee68e0bb251b8ff90ac3423a511e3b784124e5db7ff5f4813a220ae73ca9 - nokogiri (1.17.2-aarch64-linux) sha256=585c8cac6380848b7973bacfd0584628d116810e5f209db25e22d0c32313e681 - nokogiri (1.17.2-arm-linux) sha256=3d033ad9b09d5b8a203f0f2156053e93a9327a9c7887c0ceb9fa78c71d27280d - nokogiri (1.17.2-arm64-darwin) sha256=0c5eb06ba1c112d33c2bb29973b07e2f21c4ddb66c67c9386fd97ff1c5d84686 - nokogiri (1.17.2-x86-linux) sha256=8c4dd75e35810bdeb7c74943f383ca665baf6aed8fc2b78c1d305094a72794aa - nokogiri (1.17.2-x86_64-darwin) sha256=dc5977eb3416e1d501b22b0ed4737bf7604121491405865b887975eacfb3e896 - nokogiri (1.17.2-x86_64-linux) sha256=e8614ae8d776bd9adb535ca814375e7ae05d7cfa6aa01909e561484f6d70be0b + nokogiri (1.18.1) sha256=df18be7e96c34736b6abfdeda80c6e845134fb9afe2fe5d4fbc1cf1f89c68475 + nokogiri (1.18.1-aarch64-linux-gnu) sha256=35837013800e34342fcbaca305f8c49231f6bd4f779bfa23fe7b4686ae82d5b8 + nokogiri (1.18.1-arm-linux-gnu) sha256=3b873fd6b0cd1ad7c77e87af701075bdfd14c9a6b2f2965c5e00ed29a5627a37 + nokogiri (1.18.1-arm64-darwin) sha256=d75193f284c899d225943a8944479faedd995a7573ddd5c8308ffbdf2ec55204 + nokogiri (1.18.1-x86_64-darwin) sha256=d94e3aa6483577495fc8969d6b4b5c075840ce6b1ab09636a6d4177ad171051d + nokogiri (1.18.1-x86_64-linux-gnu) sha256=e516cf16ccde67ed4cc595a2621ca5ddd42562ecb24928914b0045a20a41620e orm_adapter (0.5.0) sha256=aa5d0be5d540cbb46d3a93e88061f4ece6a25f6e97d6a47122beb84fe595e9b9 parallel (1.26.3) sha256=d86babb7a2b814be9f4b81587bf0b6ce2da7d45969fab24d8ae4bf2bb4d4c7ef parser (3.3.6.0) sha256=25d4e67cc4f0f7cab9a2ae1f38e2005b6904d2ea13c34734511d0faad038bc3b From b86d537cdc57d9b991a9c7b64d10a59f51d89998 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 14 Jan 2025 20:59:30 +0100 Subject: [PATCH 270/283] Install missing libyaml dependencies --- Dockerfile | 2 +- Dockerfile.dev | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a6165a2..290b412 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config + apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config libyaml-dev # Install application gems COPY Gemfile Gemfile.lock ./ diff --git a/Dockerfile.dev b/Dockerfile.dev index 5dbd815..54e6717 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -13,7 +13,7 @@ FROM base as build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config + apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config libyaml-dev # Install application gems COPY Gemfile Gemfile.lock ./ From 59e76530647e5580a2bd275705f3d59786019ed1 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 19 Jan 2025 03:18:52 +0000 Subject: [PATCH 271/283] Update dependency rubocop-rails to v2.29.0 --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8d9c47b..d2b36d2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -343,7 +343,7 @@ GEM parser (>= 3.3.1.0) rubocop-factory_bot (2.26.1) rubocop (~> 1.61) - rubocop-rails (2.28.0) + rubocop-rails (2.29.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.52.0, < 2.0) @@ -581,7 +581,7 @@ CHECKSUMS rubocop (1.70.0) sha256=96751f8440b36a0ac6e9a8ab596900803118d83d6b83f2037bf8b3d7a5bc440e rubocop-ast (1.37.0) sha256=9513ac88aaf113d04b52912533ffe46475de1362d4aa41141b51b2455827c080 rubocop-factory_bot (2.26.1) sha256=8de13cd4edcee5ca800f255188167ecef8dbfc3d1fae9f15734e9d2e755392aa - rubocop-rails (2.28.0) sha256=4967bed9ea13e6dcab566fea4265a6dd0381db739b305e48930aba1282da2715 + rubocop-rails (2.29.0) rubocop-rspec (3.3.0) sha256=79e1b281a689044d1516fefbc52e2e6c06cd367c25ebeaf06a7a198e9071cd7d rubocop-rspec_rails (2.30.0) sha256=888112e83f9d7ef7ad2397e9d69a0b9614a4bae24f072c399804a180f80c4c46 ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 From 390899524b3e1ea53c46f62e781d25f4afcaa437 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 19 Jan 2025 19:44:22 +0100 Subject: [PATCH 272/283] Fix rubocop ofenses --- Gemfile.lock | 2 +- app/controllers/expenses_controller.rb | 2 +- app/controllers/guests_controller.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d2b36d2..1abdd09 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -581,7 +581,7 @@ CHECKSUMS rubocop (1.70.0) sha256=96751f8440b36a0ac6e9a8ab596900803118d83d6b83f2037bf8b3d7a5bc440e rubocop-ast (1.37.0) sha256=9513ac88aaf113d04b52912533ffe46475de1362d4aa41141b51b2455827c080 rubocop-factory_bot (2.26.1) sha256=8de13cd4edcee5ca800f255188167ecef8dbfc3d1fae9f15734e9d2e755392aa - rubocop-rails (2.29.0) + rubocop-rails (2.29.0) sha256=35bffd140c80671453aafac0e2d5ab5b3dd65736a3fc8f3936ccca226b89c234 rubocop-rspec (3.3.0) sha256=79e1b281a689044d1516fefbc52e2e6c06cd367c25ebeaf06a7a198e9071cd7d rubocop-rspec_rails (2.30.0) sha256=888112e83f9d7ef7ad2397e9d69a0b9614a4bae24f072c399804a180f80c4c46 ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 093d691..7fd243a 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -31,6 +31,6 @@ class ExpensesController < ApplicationController private def expense_params - params.require(:expense).permit(:name, :amount, :pricing_type) + params.expect(expense: %i[name amount pricing_type]) end end diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 7aee16d..9a40793 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -32,6 +32,6 @@ class GuestsController < ApplicationController private def guest_params - params.require(:guest).permit(:name, :group_id, :status) + params.expect(guest: %i[name group_id status]) end end From 1f0c6c2aaccd6ce4c86fde434a0d20e66820cd16 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 19 Jan 2025 20:58:33 +0100 Subject: [PATCH 273/283] Use group affinities in discomfort calculator --- app/controllers/affinities_controller.rb | 8 +- app/services/affinity_groups_hierarchy.rb | 32 +++- app/services/tables/discomfort_calculator.rb | 17 +- app/services/tables/distribution.rb | 9 +- .../tables/discomfort_calculator_spec.rb | 154 ------------------ 5 files changed, 43 insertions(+), 177 deletions(-) diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index 1412423..fab45e0 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -36,17 +36,21 @@ class AffinitiesController < ApplicationController end def default + hierarchy = AffinityGroupsHierarchy.new + for_each_group do |group_id| - Tables::DiscomfortCalculator.cohesion_discomfort(id_a: @group.id, id_b: group_id).to_f + hierarchy.default_discomfort(@group.id, group_id).to_f end end def reset + hierarchy = AffinityGroupsHierarchy.new + affinities = Group.pluck(:id).combination(2).map do |(group_a_id, group_b_id)| { group_a_id:, group_b_id:, - discomfort: Tables::DiscomfortCalculator.cohesion_discomfort(id_a: group_a_id, id_b: group_b_id).to_f + discomfort: hierarchy.default_discomfort(group_a_id, group_b_id).to_f } end diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index 783c7ed..5ac8e5b 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -5,7 +5,7 @@ # frozen_string_literal: true class AffinityGroupsHierarchy < Array - include Singleton + DEFAULT_DISCOMFORT = 1 def initialize super @@ -16,6 +16,9 @@ class AffinityGroupsHierarchy < Array hydrate(group) end + + load_discomforts + freeze end def find(id) @@ -37,8 +40,35 @@ class AffinityGroupsHierarchy < Array @references[id_a].distance_to_common_ancestor(@references[id_b]) end + def discomfort(id_a, id_b) + return 0 if id_a == id_b + + @discomforts[uuid_to_int(id_a) + uuid_to_int(id_b)] || DEFAULT_DISCOMFORT + end + + def default_discomfort(id_a, id_b) + return 0 if id_a == id_b + + dist = distance(id_a, id_b) + + return DEFAULT_DISCOMFORT if dist.nil? + + Rational(dist, dist + 1) + end + private + def load_discomforts + @load_discomforts ||= GroupAffinity.pluck(:group_a_id, :group_b_id, + :discomfort).each_with_object({}) do |(id_a, id_b, discomfort), acc| + acc[uuid_to_int(id_a) + uuid_to_int(id_b)] = discomfort + end + end + + def uuid_to_int(uuid) + uuid.gsub('-', '').hex + end + def hydrate(group) group.children.each do |child| register_child(group.id, child.id) diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index bd35087..9dd07c7 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -6,19 +6,10 @@ module Tables class DiscomfortCalculator - class << self - def cohesion_discomfort(id_a:, id_b:) - distance = AffinityGroupsHierarchy.instance.distance(id_a, id_b) - - return 1 if distance.nil? - - Rational(distance, distance + 1) - end - end - - private attr_reader :table - def initialize(table:) + private attr_reader :table, :hierarchy + def initialize(table:, hierarchy: AffinityGroupsHierarchy.new) @table = table + @hierarchy = hierarchy end def calculate @@ -59,7 +50,7 @@ module Tables # def cohesion_discomfort table.map(&:group_id).tally.to_a.combination(2).sum do |(a, count_a), (b, count_b)| - count_a * count_b * self.class.cohesion_discomfort(id_a: a, id_b: b) + count_a * count_b * hierarchy.discomfort(a, b) end end end diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 7b4762f..f829fac 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -13,6 +13,7 @@ module Tables def initialize(min_per_table:, max_per_table:) @min_per_table = min_per_table @max_per_table = max_per_table + @hierarchy = AffinityGroupsHierarchy.new @tables = [] end @@ -35,12 +36,6 @@ module Tables "#{@tables.count} tables, discomfort: #{discomfort}" end - def pretty_print - @tables.map.with_index do |table, i| - "Table #{i + 1} (#{table.count} ppl): (#{local_discomfort(table)}) #{table.map(&:name).join(', ')}" - end.join("\n") - end - def deep_dup self.class.new(min_per_table: @min_per_table, max_per_table: @max_per_table).tap do |new_distribution| new_distribution.tables = @tables.map(&:dup) @@ -68,7 +63,7 @@ module Tables private def local_discomfort(table) - table.discomfort ||= DiscomfortCalculator.new(table:).calculate + table.discomfort ||= DiscomfortCalculator.new(table:, hierarchy:).calculate end end end diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index 81633d7..a0cd5e3 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -75,159 +75,5 @@ module Tables it { expect(calculator.send(:table_size_penalty)).to eq(10) } end end - - describe '#cohesion_discomfort' do - before do - # Overridden in each test except trivial cases - allow(AffinityGroupsHierarchy.instance).to receive(:distance).and_call_original - - %w[family friends work school].each do |group| - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(group, group).and_return(0) - end - - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(family.id, friends.id).and_return(nil) - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(friends.id, work.id).and_return(1) - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(family.id, work.id).and_return(2) - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(family.id, school.id).and_return(3) - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(friends.id, school.id).and_return(4) - allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(work.id, school.id).and_return(5) - end - - context 'when the table contains just two guests' do - context 'when they belong to the same group' do - let(:table) { create_list(:guest, 2, group: family) } - - it { expect(calculator.send(:cohesion_discomfort)).to eq(0) } - end - - context 'when they belong to completely unrelated groups' do - let(:table) do - [ - create(:guest, group: family), - create(:guest, group: friends) - ] - end - - it { expect(calculator.send(:cohesion_discomfort)).to eq(1) } - end - - context 'when they belong to groups at a distance of 1' do - let(:table) do - [ - create(:guest, group: friends), - create(:guest, group: work) - ] - end - - it { expect(calculator.send(:cohesion_discomfort)).to eq(0.5) } - end - - context 'when they belong to groups at a distance of 2' do - let(:table) do - [ - create(:guest, group: family), - create(:guest, group: work) - ] - end - - it { expect(calculator.send(:cohesion_discomfort)).to eq(Rational(2, 3)) } - end - - context 'when they belong to groups at a distance of 3' do - let(:table) do - [ - create(:guest, group: family), - create(:guest, group: school) - ] - end - - it { expect(calculator.send(:cohesion_discomfort)).to eq(Rational(3, 4)) } - end - end - - context 'when the table contains three guests' do - let(:table) do - [ - create(:guest, group: family), - create(:guest, group: friends), - create(:guest, group: work) - ] - end - - it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_discomfort)).to eq(1 + Rational(1, 2) + Rational(2, 3)) - end - end - - context 'when the table contains four guests of different groups' do - let(:table) do - [ - create(:guest, group: family), - create(:guest, group: friends), - create(:guest, group: work), - create(:guest, group: school) - ] - end - - it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_discomfort)) - .to eq(1 + Rational(1, 2) + Rational(2, 3) + Rational(3, 4) + Rational(4, 5) + Rational(5, 6)) - end - end - - context 'when the table contains four guests of two evenly split groups' do - let(:table) do - [ - create_list(:guest, 2, group: family), - create_list(:guest, 2, group: friends) - ].flatten - end - - it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_discomfort)).to eq(4) - end - end - - context 'when the table contains six guests of two unevenly split groups' do - let(:table) do - [ - create_list(:guest, 2, group: family), - create_list(:guest, 4, group: friends) - ].flatten - end - - it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_discomfort)).to eq(8) - end - end - - context 'when the table contains six guests of three evenly split groups' do - let(:table) do - [ - create_list(:guest, 2, group: family), - create_list(:guest, 2, group: friends), - create_list(:guest, 2, group: work) - ].flatten - end - - it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_discomfort)).to eq((4 * 1) + (4 * Rational(1, 2)) + (4 * Rational(2, 3))) - end - end - - context 'when the table contains six guests of three unevenly split groups' do - let(:table) do - [ - create_list(:guest, 3, group: family), - create_list(:guest, 2, group: friends), - create_list(:guest, 1, group: work) - ].flatten - end - - it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_discomfort)).to eq((6 * 1) + (2 * Rational(1, 2)) + (3 * Rational(2, 3))) - end - end - end end end From f550b8d92c958d13e40cc32d03e5eb933a45b6b3 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 21 Jan 2025 03:03:34 +0000 Subject: [PATCH 274/283] Update dependency rubocop-rspec to v3.4.0 --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1abdd09..a31bfbe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -220,7 +220,7 @@ GEM racc (~> 1.4) orm_adapter (0.5.0) parallel (1.26.3) - parser (3.3.6.0) + parser (3.3.7.0) ast (~> 2.4.1) racc pg (1.5.9) @@ -348,7 +348,7 @@ GEM rack (>= 1.1) rubocop (>= 1.52.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rspec (3.3.0) + rubocop-rspec (3.4.0) rubocop (~> 1.61) rubocop-rspec_rails (2.30.0) rubocop (~> 1.61) @@ -541,7 +541,7 @@ CHECKSUMS nokogiri (1.18.1-x86_64-linux-gnu) sha256=e516cf16ccde67ed4cc595a2621ca5ddd42562ecb24928914b0045a20a41620e orm_adapter (0.5.0) sha256=aa5d0be5d540cbb46d3a93e88061f4ece6a25f6e97d6a47122beb84fe595e9b9 parallel (1.26.3) sha256=d86babb7a2b814be9f4b81587bf0b6ce2da7d45969fab24d8ae4bf2bb4d4c7ef - parser (3.3.6.0) sha256=25d4e67cc4f0f7cab9a2ae1f38e2005b6904d2ea13c34734511d0faad038bc3b + parser (3.3.7.0) sha256=7449011771e3e7881297859b849de26a6f4fccd515bece9520a87e7d2116119b pg (1.5.9) sha256=761efbdf73b66516f0c26fcbe6515dc7500c3f0aa1a1b853feae245433c64fdc pluck_to_hash (1.0.2) sha256=1599906239716f98262a41493dd7d4cb72e8d83ad3d76d666deacfc5de50a47e pry (0.15.2) sha256=12d54b8640d3fa29c9211dd4ffb08f3fd8bf7a4fd9b5a73ce5b59c8709385b6b @@ -582,7 +582,7 @@ CHECKSUMS rubocop-ast (1.37.0) sha256=9513ac88aaf113d04b52912533ffe46475de1362d4aa41141b51b2455827c080 rubocop-factory_bot (2.26.1) sha256=8de13cd4edcee5ca800f255188167ecef8dbfc3d1fae9f15734e9d2e755392aa rubocop-rails (2.29.0) sha256=35bffd140c80671453aafac0e2d5ab5b3dd65736a3fc8f3936ccca226b89c234 - rubocop-rspec (3.3.0) sha256=79e1b281a689044d1516fefbc52e2e6c06cd367c25ebeaf06a7a198e9071cd7d + rubocop-rspec (3.4.0) sha256=8721c13b6a8c9530a7ac481cea9423022f946fcf72428bda8289f8b57e4d4885 rubocop-rspec_rails (2.30.0) sha256=888112e83f9d7ef7ad2397e9d69a0b9614a4bae24f072c399804a180f80c4c46 ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 rubytree (2.1.1) sha256=4925016356a81730e982f1f8c3b5f8da461f18906c77d238bad4c4ba896abd41 From 9f7f99f3f41976f05da46672fbb744108ff01ddc Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Wed, 22 Jan 2025 20:35:02 +0100 Subject: [PATCH 275/283] Fix error loading arrangements --- app/services/affinity_groups_hierarchy.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index 5ac8e5b..bd0a467 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -17,7 +17,7 @@ class AffinityGroupsHierarchy < Array hydrate(group) end - load_discomforts + discomforts freeze end @@ -58,9 +58,9 @@ class AffinityGroupsHierarchy < Array private - def load_discomforts - @load_discomforts ||= GroupAffinity.pluck(:group_a_id, :group_b_id, - :discomfort).each_with_object({}) do |(id_a, id_b, discomfort), acc| + def discomforts + @discomforts ||= GroupAffinity.pluck(:group_a_id, :group_b_id, + :discomfort).each_with_object({}) do |(id_a, id_b, discomfort), acc| acc[uuid_to_int(id_a) + uuid_to_int(id_b)] = discomfort end end From fcb1e77a3a8ae98620ca0b1f07d485e8afd419ec Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 23 Jan 2025 03:11:38 +0000 Subject: [PATCH 276/283] Update dependency rubocop to v1.71.0 --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a31bfbe..aa35e4c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -329,7 +329,7 @@ GEM rswag-ui (2.16.0) actionpack (>= 5.2, < 8.1) railties (>= 5.2, < 8.1) - rubocop (1.70.0) + rubocop (1.71.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -578,7 +578,7 @@ CHECKSUMS rswag-api (2.16.0) sha256=b653f7bd92e98be18b01ab4525d88950d7b0960e293a99f856b9efcee3ae6074 rswag-specs (2.16.0) sha256=8ba26085c408b0bd2ed21dc8015c80f417c7d34c63720ab7133c2549b5bd2a91 rswag-ui (2.16.0) sha256=a1f49e927dceda92e6e6e7c1000f1e217ee66c565f69e28131dc98b33cd3a04f - rubocop (1.70.0) sha256=96751f8440b36a0ac6e9a8ab596900803118d83d6b83f2037bf8b3d7a5bc440e + rubocop (1.71.0) sha256=e19679efd447346ac476122313d3788ae23c38214790bcf660e984c747608bf0 rubocop-ast (1.37.0) sha256=9513ac88aaf113d04b52912533ffe46475de1362d4aa41141b51b2455827c080 rubocop-factory_bot (2.26.1) sha256=8de13cd4edcee5ca800f255188167ecef8dbfc3d1fae9f15734e9d2e755392aa rubocop-rails (2.29.0) sha256=35bffd140c80671453aafac0e2d5ab5b3dd65736a3fc8f3936ccca226b89c234 From cedb8dce92e955ae9c8a8229833257735a75fab2 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Thu, 23 Jan 2025 22:15:34 +0100 Subject: [PATCH 277/283] Update copyright notice action --- .gitea/workflows/copyright_notice.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/copyright_notice.yml b/.gitea/workflows/copyright_notice.yml index 35d8b8d..c362a23 100644 --- a/.gitea/workflows/copyright_notice.yml +++ b/.gitea/workflows/copyright_notice.yml @@ -16,12 +16,12 @@ jobs: ref: ${{ github.head_ref }} - uses: VinnyBabuManjaly/copyright-action@v1.0.0 with: - CopyrightString: '# Copyright (C) 2024 Manuel Bustillo\n\n' + CopyrightString: '# Copyright (C) 2024-2025 LibreWeddingPlanner contributors\n\n' FileType: '.rb' Path: 'app/, config/, db/, spec/' - uses: VinnyBabuManjaly/copyright-action@v1.0.0 with: - CopyrightString: '<%# Copyright (C) 2024 Manuel Bustillo %>\n\n' + CopyrightString: '<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %>\n\n' FileType: '.erb' Path: 'app/' - name: Commit changes From 74ca20d3e8bd8b4ca0fe79b86aefbf8de4f2f0b4 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Thu, 23 Jan 2025 21:18:12 +0000 Subject: [PATCH 278/283] Add copyright notice --- app/channels/application_cable/channel.rb | 2 ++ app/channels/application_cable/connection.rb | 2 ++ app/controllers/affinities_controller.rb | 2 ++ app/controllers/application_controller.rb | 2 ++ app/controllers/captcha_controller.rb | 2 ++ app/controllers/expenses_controller.rb | 2 ++ app/controllers/groups_controller.rb | 2 ++ app/controllers/guests_controller.rb | 2 ++ app/controllers/summary_controller.rb | 2 ++ app/controllers/tables_arrangements_controller.rb | 2 ++ app/controllers/tokens_controller.rb | 2 ++ app/controllers/users/confirmations_controller.rb | 2 ++ app/controllers/users/registrations_controller.rb | 2 ++ app/controllers/users/sessions_controller.rb | 2 ++ app/extensions/tree_node_extension.rb | 2 ++ app/helpers/application_helper.rb | 2 ++ app/helpers/expenses_helper.rb | 2 ++ app/helpers/groups_helper.rb | 2 ++ app/helpers/guests_helper.rb | 2 ++ app/helpers/tables_arrangements_helper.rb | 2 ++ app/jobs/application_job.rb | 2 ++ app/jobs/table_simulator_job.rb | 2 ++ app/mailers/application_mailer.rb | 2 ++ app/models/application_record.rb | 2 ++ app/models/expense.rb | 2 ++ app/models/group.rb | 2 ++ app/models/group_affinity.rb | 2 ++ app/models/guest.rb | 2 ++ app/models/seat.rb | 2 ++ app/models/tables_arrangement.rb | 2 ++ app/models/user.rb | 2 ++ app/models/wedding.rb | 2 ++ app/queries/expenses/total_query.rb | 2 ++ app/queries/groups/summary_query.rb | 2 ++ app/serializers/serializable_group.rb | 2 ++ app/serializers/serializable_guest.rb | 2 ++ app/services/affinity_groups_hierarchy.rb | 2 ++ app/services/libre_captcha.rb | 2 ++ app/services/tables/discomfort_calculator.rb | 2 ++ app/services/tables/distribution.rb | 2 ++ app/services/tables/shift.rb | 2 ++ app/services/tables/swap.rb | 2 ++ app/services/tables/table.rb | 2 ++ app/services/vns/engine.rb | 2 ++ app/views/layouts/mailer.html.erb | 2 ++ app/views/layouts/mailer.text.erb | 2 ++ app/views/users/mailer/confirmation_instructions.html.erb | 2 ++ app/views/users/mailer/email_changed.html.erb | 2 ++ app/views/users/mailer/password_change.html.erb | 2 ++ app/views/users/mailer/reset_password_instructions.html.erb | 2 ++ app/views/users/mailer/unlock_instructions.html.erb | 2 ++ config/application.rb | 2 ++ config/boot.rb | 2 ++ config/environment.rb | 2 ++ config/environments/development.rb | 2 ++ config/environments/production.rb | 2 ++ config/environments/test.rb | 2 ++ config/importmap.rb | 2 ++ config/initializers/acts_as_tenant.rb | 2 ++ config/initializers/assets.rb | 2 ++ config/initializers/colors.rb | 2 ++ config/initializers/content_security_policy.rb | 2 ++ config/initializers/cors.rb | 2 ++ config/initializers/devise.rb | 2 ++ config/initializers/filter_parameter_logging.rb | 2 ++ config/initializers/inflections.rb | 2 ++ config/initializers/permissions_policy.rb | 2 ++ config/initializers/rswag_api.rb | 2 ++ config/initializers/rswag_ui.rb | 2 ++ config/initializers/ruby_extensions.rb | 2 ++ config/puma.rb | 2 ++ config/routes.rb | 2 ++ db/migrate/20240711175425_create_expenses.rb | 2 ++ db/migrate/20240711180753_create_guests.rb | 2 ++ ..._acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb | 2 ++ ...627_add_missing_unique_indices.acts_as_taggable_on_engine.rb | 2 ++ ...taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb | 2 ++ ...629_add_missing_taggable_index.acts_as_taggable_on_engine.rb | 2 ++ ...change_collation_for_tag_names.acts_as_taggable_on_engine.rb | 2 ++ ...dd_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb | 2 ++ ...1181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb | 2 ++ db/migrate/20240724181756_create_tables_arrangements.rb | 2 ++ db/migrate/20240724181853_create_seats.rb | 2 ++ db/migrate/20240811142121_create_groups.rb | 2 ++ db/migrate/20240811143801_add_parent_to_group.rb | 2 ++ db/migrate/20240811154115_add_group_to_guest.rb | 2 ++ db/migrate/20240811170021_add_status_to_guest.rb | 2 ++ db/migrate/20241101181052_drop_taggable_tables.rb | 2 ++ db/migrate/20241103072808_add_name_to_tables_arrangements.rb | 2 ++ db/migrate/20241103075705_solid_queue_install.rb | 2 ++ db/migrate/20241103093955_remove_email_from_guests.rb | 2 ++ db/migrate/20241103133122_add_color_to_group.rb | 2 ++ db/migrate/20241111063741_merge_guest_names.rb | 2 ++ db/migrate/20241130095753_devise_create_users.rb | 2 ++ db/migrate/20241130182228_create_weddings.rb | 2 ++ db/migrate/20241130185731_add_wedding_id_to_models.rb | 2 ++ db/migrate/20241207112305_remove_wedding_date.rb | 2 ++ db/migrate/20241208102932_allow_ungrouped_guests.rb | 2 ++ db/migrate/20241216231415_create_group_affinities.rb | 2 ++ db/queue_schema.rb | 2 ++ db/schema.rb | 2 ++ db/seeds.rb | 2 ++ spec/extensions/tree_spec.rb | 2 ++ spec/factories/expense.rb | 2 ++ spec/factories/group_affinities.rb | 2 ++ spec/factories/groups.rb | 2 ++ spec/factories/guest.rb | 2 ++ spec/factories/table_arrangement.rb | 2 ++ spec/factories/users.rb | 2 ++ spec/factories/weddings.rb | 2 ++ spec/models/expense_spec.rb | 2 ++ spec/models/group_affinity_spec.rb | 2 ++ spec/models/group_spec.rb | 2 ++ spec/models/guest_spec.rb | 2 ++ spec/models/seat_spec.rb | 2 ++ spec/models/tables_arrangement_spec.rb | 2 ++ spec/models/user_spec.rb | 2 ++ spec/models/wedding_spec.rb | 2 ++ spec/queries/expenses/total_query_spec.rb | 2 ++ spec/queries/groups/summary_query_spec.rb | 2 ++ spec/rails_helper.rb | 2 ++ spec/requests/affinities_spec.rb | 2 ++ spec/requests/captcha_spec.rb | 2 ++ spec/requests/expenses_spec.rb | 2 ++ spec/requests/groups_spec.rb | 2 ++ spec/requests/guests_spec.rb | 2 ++ spec/requests/schemas.rb | 2 ++ spec/requests/summary_spec.rb | 2 ++ spec/requests/tables_arrangements_spec.rb | 2 ++ spec/requests/tokens_spec.rb | 2 ++ spec/requests/users/confirmations_spec.rb | 2 ++ spec/requests/users/registrations_spec.rb | 2 ++ spec/requests/users/sessions_spec.rb | 2 ++ spec/services/tables/discomfort_calculator_spec.rb | 2 ++ spec/services/tables/distribution_spec.rb | 2 ++ spec/services/tables/shift_spec.rb | 2 ++ spec/services/tables/swap_spec.rb | 2 ++ spec/services/vns/engine_spec.rb | 2 ++ spec/spec_helper.rb | 2 ++ spec/swagger_helper.rb | 2 ++ spec/swagger_response_helper.rb | 2 ++ 141 files changed, 282 insertions(+) diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index 716be35..66fb00b 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 286b699..d946771 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index fab45e0..6477663 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a73aa87..bac01aa 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 98fcbcb..93a9afd 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 7fd243a..977199c 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 8baa833..f1cc518 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 9a40793..e8e0d7c 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb index 9481a47..3071f09 100644 --- a/app/controllers/summary_controller.rb +++ b/app/controllers/summary_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index 76a6774..c98c80e 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb index 4b71df3..bee16c2 100644 --- a/app/controllers/tokens_controller.rb +++ b/app/controllers/tokens_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index c078a1a..e67f192 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 2a25268..cf5f702 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 8464417..0b031d8 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/extensions/tree_node_extension.rb b/app/extensions/tree_node_extension.rb index 443c658..0c33107 100644 --- a/app/extensions/tree_node_extension.rb +++ b/app/extensions/tree_node_extension.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d0c1baa..20c431a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/helpers/expenses_helper.rb b/app/helpers/expenses_helper.rb index 05513f7..7dda766 100644 --- a/app/helpers/expenses_helper.rb +++ b/app/helpers/expenses_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 85d797b..4d76b36 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/helpers/guests_helper.rb b/app/helpers/guests_helper.rb index 639cf38..f2d5c9b 100644 --- a/app/helpers/guests_helper.rb +++ b/app/helpers/guests_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/helpers/tables_arrangements_helper.rb b/app/helpers/tables_arrangements_helper.rb index a039c6e..47c6960 100644 --- a/app/helpers/tables_arrangements_helper.rb +++ b/app/helpers/tables_arrangements_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 62fb66f..d025a46 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index 56a59d0..f47de50 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 706222d..36695dc 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/models/application_record.rb b/app/models/application_record.rb index d6fee04..b9b1d00 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/models/expense.rb b/app/models/expense.rb index f810d1c..26c4696 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/models/group.rb b/app/models/group.rb index 92d88a6..e2fae42 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb index b94e0c5..4b63e54 100644 --- a/app/models/group_affinity.rb +++ b/app/models/group_affinity.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/models/guest.rb b/app/models/guest.rb index c9eb0b0..15a8f99 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/models/seat.rb b/app/models/seat.rb index 71e9d77..116f4cf 100644 --- a/app/models/seat.rb +++ b/app/models/seat.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index 3e6aef9..0c412a1 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/models/user.rb b/app/models/user.rb index d263c97..8501aae 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/models/wedding.rb b/app/models/wedding.rb index 4368c50..bea6cae 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index 0ba9f5f..0fae5c1 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb index e1b7138..7bf2c77 100644 --- a/app/queries/groups/summary_query.rb +++ b/app/queries/groups/summary_query.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/serializers/serializable_group.rb b/app/serializers/serializable_group.rb index 4572c78..c3dfc91 100644 --- a/app/serializers/serializable_group.rb +++ b/app/serializers/serializable_group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/serializers/serializable_guest.rb b/app/serializers/serializable_guest.rb index 3e95236..825f053 100644 --- a/app/serializers/serializable_guest.rb +++ b/app/serializers/serializable_guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index bd0a467..7da401d 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb index d644ba2..522ac27 100644 --- a/app/services/libre_captcha.rb +++ b/app/services/libre_captcha.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index 9dd07c7..a72d2b4 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index f829fac..7ce1fe4 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/services/tables/shift.rb b/app/services/tables/shift.rb index 45e7150..ffcb7d9 100644 --- a/app/services/tables/shift.rb +++ b/app/services/tables/shift.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/services/tables/swap.rb b/app/services/tables/swap.rb index 230959d..04d21a1 100644 --- a/app/services/tables/swap.rb +++ b/app/services/tables/swap.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index 3628c49..79cc649 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index fe1ff91..bd8a400 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 4eee621..98b3798 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%# Copyright (C) 2024 Manuel Bustillo %> <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb index 62b17c3..2254355 100644 --- a/app/views/layouts/mailer.text.erb +++ b/app/views/layouts/mailer.text.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%# Copyright (C) 2024 Manuel Bustillo %> <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> diff --git a/app/views/users/mailer/confirmation_instructions.html.erb b/app/views/users/mailer/confirmation_instructions.html.erb index 688f1bc..3860a60 100644 --- a/app/views/users/mailer/confirmation_instructions.html.erb +++ b/app/views/users/mailer/confirmation_instructions.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%# Copyright (C) 2024 Manuel Bustillo %> <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> diff --git a/app/views/users/mailer/email_changed.html.erb b/app/views/users/mailer/email_changed.html.erb index 8935bc0..ecf1924 100644 --- a/app/views/users/mailer/email_changed.html.erb +++ b/app/views/users/mailer/email_changed.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%# Copyright (C) 2024 Manuel Bustillo %> <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> diff --git a/app/views/users/mailer/password_change.html.erb b/app/views/users/mailer/password_change.html.erb index 3d72a19..55efe66 100644 --- a/app/views/users/mailer/password_change.html.erb +++ b/app/views/users/mailer/password_change.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%# Copyright (C) 2024 Manuel Bustillo %> <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> diff --git a/app/views/users/mailer/reset_password_instructions.html.erb b/app/views/users/mailer/reset_password_instructions.html.erb index fc45ec9..510d1a2 100644 --- a/app/views/users/mailer/reset_password_instructions.html.erb +++ b/app/views/users/mailer/reset_password_instructions.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%# Copyright (C) 2024 Manuel Bustillo %> <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> diff --git a/app/views/users/mailer/unlock_instructions.html.erb b/app/views/users/mailer/unlock_instructions.html.erb index fddd365..e6481f7 100644 --- a/app/views/users/mailer/unlock_instructions.html.erb +++ b/app/views/users/mailer/unlock_instructions.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%# Copyright (C) 2024 Manuel Bustillo %> <%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> diff --git a/config/application.rb b/config/application.rb index 32fbf95..0c65ef8 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/boot.rb b/config/boot.rb index 59676bc..e4cf23b 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/environment.rb b/config/environment.rb index df4bf2e..e192b60 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/environments/development.rb b/config/environments/development.rb index b0f2198..833acec 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/environments/production.rb b/config/environments/production.rb index 59e22d6..2d86713 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/environments/test.rb b/config/environments/test.rb index 28b85d7..2e8601f 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/importmap.rb b/config/importmap.rb index 19991f1..9b60f46 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/initializers/acts_as_tenant.rb b/config/initializers/acts_as_tenant.rb index 72510c4..b7895ad 100644 --- a/config/initializers/acts_as_tenant.rb +++ b/config/initializers/acts_as_tenant.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 8e722ce..f1ba0d3 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/initializers/colors.rb b/config/initializers/colors.rb index f1bbdd2..5ed99da 100644 --- a/config/initializers/colors.rb +++ b/config/initializers/colors.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 3f9221f..21cdde3 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index 565fe09..4bf656c 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 0ecbf5e..8a71efa 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index e184d9a..21d6e2e 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 0f9a0ea..be7b9db 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index af956f8..3d96b1b 100644 --- a/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/initializers/rswag_api.rb b/config/initializers/rswag_api.rb index 4c11988..dcd512b 100644 --- a/config/initializers/rswag_api.rb +++ b/config/initializers/rswag_api.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/initializers/rswag_ui.rb b/config/initializers/rswag_ui.rb index dec08ce..2cb39a1 100644 --- a/config/initializers/rswag_ui.rb +++ b/config/initializers/rswag_ui.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/initializers/ruby_extensions.rb b/config/initializers/ruby_extensions.rb index 9fb7af1..f86dd29 100644 --- a/config/initializers/ruby_extensions.rb +++ b/config/initializers/ruby_extensions.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/puma.rb b/config/puma.rb index 3d8dbc2..284357a 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/config/routes.rb b/config/routes.rb index 457503d..e4b0398 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240711175425_create_expenses.rb b/db/migrate/20240711175425_create_expenses.rb index 1538790..e19615b 100644 --- a/db/migrate/20240711175425_create_expenses.rb +++ b/db/migrate/20240711175425_create_expenses.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240711180753_create_guests.rb b/db/migrate/20240711180753_create_guests.rb index 6597d34..bbfe941 100644 --- a/db/migrate/20240711180753_create_guests.rb +++ b/db/migrate/20240711180753_create_guests.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb index a614c83..c8694b4 100644 --- a/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb index ab62f5f..1224fd0 100644 --- a/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb index 1d9f0e9..03b1170 100644 --- a/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb index 0d79854..2168b2b 100644 --- a/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb index e643bb4..1d0e248 100644 --- a/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb index fa60128..ff4d15b 100644 --- a/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb index fa8df4d..741e909 100644 --- a/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240724181756_create_tables_arrangements.rb b/db/migrate/20240724181756_create_tables_arrangements.rb index ed278c8..5c9d4a6 100644 --- a/db/migrate/20240724181756_create_tables_arrangements.rb +++ b/db/migrate/20240724181756_create_tables_arrangements.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240724181853_create_seats.rb b/db/migrate/20240724181853_create_seats.rb index 462df84..bca6ce8 100644 --- a/db/migrate/20240724181853_create_seats.rb +++ b/db/migrate/20240724181853_create_seats.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240811142121_create_groups.rb b/db/migrate/20240811142121_create_groups.rb index 8380c36..ccba1da 100644 --- a/db/migrate/20240811142121_create_groups.rb +++ b/db/migrate/20240811142121_create_groups.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240811143801_add_parent_to_group.rb b/db/migrate/20240811143801_add_parent_to_group.rb index fc4a881..de04557 100644 --- a/db/migrate/20240811143801_add_parent_to_group.rb +++ b/db/migrate/20240811143801_add_parent_to_group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240811154115_add_group_to_guest.rb b/db/migrate/20240811154115_add_group_to_guest.rb index ff88298..b2b461a 100644 --- a/db/migrate/20240811154115_add_group_to_guest.rb +++ b/db/migrate/20240811154115_add_group_to_guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20240811170021_add_status_to_guest.rb b/db/migrate/20240811170021_add_status_to_guest.rb index 09a2a9e..8172cb9 100644 --- a/db/migrate/20240811170021_add_status_to_guest.rb +++ b/db/migrate/20240811170021_add_status_to_guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20241101181052_drop_taggable_tables.rb b/db/migrate/20241101181052_drop_taggable_tables.rb index 6787951..6c0a597 100644 --- a/db/migrate/20241101181052_drop_taggable_tables.rb +++ b/db/migrate/20241101181052_drop_taggable_tables.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb index 3bd57a2..32681d2 100644 --- a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb +++ b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20241103075705_solid_queue_install.rb b/db/migrate/20241103075705_solid_queue_install.rb index ca9e45e..13552e6 100644 --- a/db/migrate/20241103075705_solid_queue_install.rb +++ b/db/migrate/20241103075705_solid_queue_install.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20241103093955_remove_email_from_guests.rb b/db/migrate/20241103093955_remove_email_from_guests.rb index a6f9798..43031a9 100644 --- a/db/migrate/20241103093955_remove_email_from_guests.rb +++ b/db/migrate/20241103093955_remove_email_from_guests.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20241103133122_add_color_to_group.rb b/db/migrate/20241103133122_add_color_to_group.rb index 30218e3..f9b53f5 100644 --- a/db/migrate/20241103133122_add_color_to_group.rb +++ b/db/migrate/20241103133122_add_color_to_group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20241111063741_merge_guest_names.rb b/db/migrate/20241111063741_merge_guest_names.rb index 90d5e82..d202346 100644 --- a/db/migrate/20241111063741_merge_guest_names.rb +++ b/db/migrate/20241111063741_merge_guest_names.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20241130095753_devise_create_users.rb b/db/migrate/20241130095753_devise_create_users.rb index 496e3fc..71e0f82 100644 --- a/db/migrate/20241130095753_devise_create_users.rb +++ b/db/migrate/20241130095753_devise_create_users.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20241130182228_create_weddings.rb b/db/migrate/20241130182228_create_weddings.rb index 77ada38..1aa30a5 100644 --- a/db/migrate/20241130182228_create_weddings.rb +++ b/db/migrate/20241130182228_create_weddings.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20241130185731_add_wedding_id_to_models.rb b/db/migrate/20241130185731_add_wedding_id_to_models.rb index c9b231c..614e21d 100644 --- a/db/migrate/20241130185731_add_wedding_id_to_models.rb +++ b/db/migrate/20241130185731_add_wedding_id_to_models.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20241207112305_remove_wedding_date.rb b/db/migrate/20241207112305_remove_wedding_date.rb index ca28b71..da2c9d2 100644 --- a/db/migrate/20241207112305_remove_wedding_date.rb +++ b/db/migrate/20241207112305_remove_wedding_date.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20241208102932_allow_ungrouped_guests.rb b/db/migrate/20241208102932_allow_ungrouped_guests.rb index f567676..c07ea87 100644 --- a/db/migrate/20241208102932_allow_ungrouped_guests.rb +++ b/db/migrate/20241208102932_allow_ungrouped_guests.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/migrate/20241216231415_create_group_affinities.rb b/db/migrate/20241216231415_create_group_affinities.rb index 113d026..4a2ac8e 100644 --- a/db/migrate/20241216231415_create_group_affinities.rb +++ b/db/migrate/20241216231415_create_group_affinities.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/queue_schema.rb b/db/queue_schema.rb index 149f41f..14c6e9d 100644 --- a/db/queue_schema.rb +++ b/db/queue_schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/schema.rb b/db/schema.rb index cfc1383..e810882 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/db/seeds.rb b/db/seeds.rb index e61f33b..b3316bb 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/extensions/tree_spec.rb b/spec/extensions/tree_spec.rb index 937a0fe..883522d 100644 --- a/spec/extensions/tree_spec.rb +++ b/spec/extensions/tree_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index ceaf501..13fef3c 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index c33de53..bc1e80f 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index f19ba72..e98c464 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index a1f284a..f72073f 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb index 86ddddf..05aab24 100644 --- a/spec/factories/table_arrangement.rb +++ b/spec/factories/table_arrangement.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/users.rb b/spec/factories/users.rb index cc49d11..342ced5 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index de994c8..d3dd2e9 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index 9a8fc47..ea1f83d 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/group_affinity_spec.rb b/spec/models/group_affinity_spec.rb index 5469d27..2a5049e 100644 --- a/spec/models/group_affinity_spec.rb +++ b/spec/models/group_affinity_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index d7ec456..e0f8d78 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index ed526e8..756bed7 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/seat_spec.rb b/spec/models/seat_spec.rb index da5c17f..80c23d9 100644 --- a/spec/models/seat_spec.rb +++ b/spec/models/seat_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index b216b18..8134f17 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 9f69608..e954eb3 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index 735255d..2549380 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index e3f16c4..9fc5cb2 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/queries/groups/summary_query_spec.rb b/spec/queries/groups/summary_query_spec.rb index cb3b7fe..9b061fe 100644 --- a/spec/queries/groups/summary_query_spec.rb +++ b/spec/queries/groups/summary_query_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 653bbf9..3ea320e 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index 3a39c0c..97636f5 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/requests/captcha_spec.rb b/spec/requests/captcha_spec.rb index e1f2fea..6921efa 100644 --- a/spec/requests/captcha_spec.rb +++ b/spec/requests/captcha_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index e6defe4..178f71a 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index 49d121b..2779b53 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index 40a6686..e711a2b 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index 3fd49f2..bf0a1ca 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/requests/summary_spec.rb b/spec/requests/summary_spec.rb index 3dc6ac0..1ca3611 100644 --- a/spec/requests/summary_spec.rb +++ b/spec/requests/summary_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index cf48cac..7ee1385 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/requests/tokens_spec.rb b/spec/requests/tokens_spec.rb index b5b9cf7..59e3c88 100644 --- a/spec/requests/tokens_spec.rb +++ b/spec/requests/tokens_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb index d76d53a..e09ef74 100644 --- a/spec/requests/users/confirmations_spec.rb +++ b/spec/requests/users/confirmations_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index 064d28e..4eaa076 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/requests/users/sessions_spec.rb b/spec/requests/users/sessions_spec.rb index 61c2662..5c23c59 100644 --- a/spec/requests/users/sessions_spec.rb +++ b/spec/requests/users/sessions_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index a0cd5e3..f5ba1ee 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/services/tables/distribution_spec.rb b/spec/services/tables/distribution_spec.rb index a427f40..2c8b133 100644 --- a/spec/services/tables/distribution_spec.rb +++ b/spec/services/tables/distribution_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/services/tables/shift_spec.rb b/spec/services/tables/shift_spec.rb index 67a4d5d..d39ce89 100644 --- a/spec/services/tables/shift_spec.rb +++ b/spec/services/tables/shift_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/services/tables/swap_spec.rb b/spec/services/tables/swap_spec.rb index ae9e974..66ce320 100644 --- a/spec/services/tables/swap_spec.rb +++ b/spec/services/tables/swap_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/services/vns/engine_spec.rb b/spec/services/vns/engine_spec.rb index c8d489d..7d183f5 100644 --- a/spec/services/vns/engine_spec.rb +++ b/spec/services/vns/engine_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f5a5a59..d1b85f5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index bbf6c7f..1afb6e1 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index c13d8a8..a4b818d 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024-2025 LibreWeddingPlanner contributors From 6cead51bb9630a3f39543c6c70825b42ce36b349 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Thu, 23 Jan 2025 22:29:26 +0100 Subject: [PATCH 279/283] Remove all copyright notices to force recreation --- app/channels/application_cable/channel.rb | 6 ------ app/channels/application_cable/connection.rb | 6 ------ app/controllers/affinities_controller.rb | 6 ------ app/controllers/application_controller.rb | 6 ------ app/controllers/captcha_controller.rb | 6 ------ app/controllers/expenses_controller.rb | 6 ------ app/controllers/groups_controller.rb | 6 ------ app/controllers/guests_controller.rb | 6 ------ app/controllers/summary_controller.rb | 6 ------ app/controllers/tables_arrangements_controller.rb | 6 ------ app/controllers/tokens_controller.rb | 6 ------ app/controllers/users/confirmations_controller.rb | 6 ------ app/controllers/users/registrations_controller.rb | 6 ------ app/controllers/users/sessions_controller.rb | 6 ------ app/extensions/tree_node_extension.rb | 6 ------ app/helpers/application_helper.rb | 6 ------ app/helpers/expenses_helper.rb | 6 ------ app/helpers/groups_helper.rb | 6 ------ app/helpers/guests_helper.rb | 6 ------ app/helpers/tables_arrangements_helper.rb | 6 ------ app/jobs/application_job.rb | 6 ------ app/jobs/table_simulator_job.rb | 6 ------ app/mailers/application_mailer.rb | 6 ------ app/models/application_record.rb | 6 ------ app/models/expense.rb | 6 ------ app/models/group.rb | 6 ------ app/models/group_affinity.rb | 6 ------ app/models/guest.rb | 6 ------ app/models/seat.rb | 6 ------ app/models/tables_arrangement.rb | 6 ------ app/models/user.rb | 6 ------ app/models/wedding.rb | 6 ------ app/queries/expenses/total_query.rb | 6 ------ app/queries/groups/summary_query.rb | 6 ------ app/serializers/serializable_group.rb | 6 ------ app/serializers/serializable_guest.rb | 6 ------ app/services/affinity_groups_hierarchy.rb | 6 ------ app/services/libre_captcha.rb | 6 ------ app/services/tables/discomfort_calculator.rb | 6 ------ app/services/tables/distribution.rb | 6 ------ app/services/tables/shift.rb | 6 ------ app/services/tables/swap.rb | 6 ------ app/services/tables/table.rb | 6 ------ app/services/vns/engine.rb | 6 ------ app/views/layouts/mailer.html.erb | 8 +------- app/views/layouts/mailer.text.erb | 8 +------- app/views/users/mailer/confirmation_instructions.html.erb | 8 +------- app/views/users/mailer/email_changed.html.erb | 8 +------- app/views/users/mailer/password_change.html.erb | 8 +------- .../users/mailer/reset_password_instructions.html.erb | 8 +------- app/views/users/mailer/unlock_instructions.html.erb | 8 +------- config/application.rb | 6 ------ config/boot.rb | 6 ------ config/environment.rb | 6 ------ config/environments/development.rb | 6 ------ config/environments/production.rb | 6 ------ config/environments/test.rb | 6 ------ config/importmap.rb | 6 ------ config/initializers/acts_as_tenant.rb | 6 ------ config/initializers/assets.rb | 6 ------ config/initializers/colors.rb | 6 ------ config/initializers/content_security_policy.rb | 6 ------ config/initializers/cors.rb | 6 ------ config/initializers/devise.rb | 6 ------ config/initializers/filter_parameter_logging.rb | 6 ------ config/initializers/inflections.rb | 6 ------ config/initializers/permissions_policy.rb | 6 ------ config/initializers/rswag_api.rb | 6 ------ config/initializers/rswag_ui.rb | 6 ------ config/initializers/ruby_extensions.rb | 6 ------ config/puma.rb | 6 ------ config/routes.rb | 6 ------ db/migrate/20240711175425_create_expenses.rb | 6 ------ db/migrate/20240711180753_create_guests.rb | 6 ------ ...as_taggable_on_migration.acts_as_taggable_on_engine.rb | 6 ------ ...d_missing_unique_indices.acts_as_taggable_on_engine.rb | 6 ------ ...gs_counter_cache_to_tags.acts_as_taggable_on_engine.rb | 6 ------ ...d_missing_taggable_index.acts_as_taggable_on_engine.rb | 6 ------ ..._collation_for_tag_names.acts_as_taggable_on_engine.rb | 6 ------ ...sing_indexes_on_taggings.acts_as_taggable_on_engine.rb | 6 ------ ...2_add_tenant_to_taggings.acts_as_taggable_on_engine.rb | 6 ------ db/migrate/20240724181756_create_tables_arrangements.rb | 6 ------ db/migrate/20240724181853_create_seats.rb | 6 ------ db/migrate/20240811142121_create_groups.rb | 6 ------ db/migrate/20240811143801_add_parent_to_group.rb | 6 ------ db/migrate/20240811154115_add_group_to_guest.rb | 6 ------ db/migrate/20240811170021_add_status_to_guest.rb | 6 ------ db/migrate/20241101181052_drop_taggable_tables.rb | 6 ------ .../20241103072808_add_name_to_tables_arrangements.rb | 6 ------ db/migrate/20241103075705_solid_queue_install.rb | 6 ------ db/migrate/20241103093955_remove_email_from_guests.rb | 6 ------ db/migrate/20241103133122_add_color_to_group.rb | 6 ------ db/migrate/20241111063741_merge_guest_names.rb | 6 ------ db/migrate/20241130095753_devise_create_users.rb | 6 ------ db/migrate/20241130182228_create_weddings.rb | 6 ------ db/migrate/20241130185731_add_wedding_id_to_models.rb | 6 ------ db/migrate/20241207112305_remove_wedding_date.rb | 6 ------ db/migrate/20241208102932_allow_ungrouped_guests.rb | 6 ------ db/migrate/20241216231415_create_group_affinities.rb | 6 ------ db/queue_schema.rb | 6 ------ db/schema.rb | 6 ------ db/seeds.rb | 6 ------ spec/extensions/tree_spec.rb | 6 ------ spec/factories/expense.rb | 8 -------- spec/factories/group_affinities.rb | 8 -------- spec/factories/groups.rb | 8 -------- spec/factories/guest.rb | 8 -------- spec/factories/table_arrangement.rb | 8 -------- spec/factories/users.rb | 8 -------- spec/factories/weddings.rb | 8 -------- spec/models/expense_spec.rb | 8 -------- spec/models/group_affinity_spec.rb | 6 ------ spec/models/group_spec.rb | 8 -------- spec/models/guest_spec.rb | 6 ------ spec/models/seat_spec.rb | 8 -------- spec/models/tables_arrangement_spec.rb | 8 -------- spec/models/user_spec.rb | 8 -------- spec/models/wedding_spec.rb | 8 -------- spec/queries/expenses/total_query_spec.rb | 6 ------ spec/queries/groups/summary_query_spec.rb | 6 ------ spec/rails_helper.rb | 6 ------ spec/requests/affinities_spec.rb | 6 ------ spec/requests/captcha_spec.rb | 6 ------ spec/requests/expenses_spec.rb | 6 ------ spec/requests/groups_spec.rb | 6 ------ spec/requests/guests_spec.rb | 6 ------ spec/requests/schemas.rb | 6 ------ spec/requests/summary_spec.rb | 6 ------ spec/requests/tables_arrangements_spec.rb | 6 ------ spec/requests/tokens_spec.rb | 6 ------ spec/requests/users/confirmations_spec.rb | 6 ------ spec/requests/users/registrations_spec.rb | 6 ------ spec/requests/users/sessions_spec.rb | 6 ------ spec/services/tables/discomfort_calculator_spec.rb | 6 ------ spec/services/tables/distribution_spec.rb | 6 ------ spec/services/tables/shift_spec.rb | 6 ------ spec/services/tables/swap_spec.rb | 6 ------ spec/services/vns/engine_spec.rb | 6 ------ spec/spec_helper.rb | 6 ------ spec/swagger_helper.rb | 6 ------ spec/swagger_response_helper.rb | 6 ------ 141 files changed, 7 insertions(+), 879 deletions(-) diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index 66fb00b..9aec230 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module ApplicationCable diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index d946771..8d6c2a1 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module ApplicationCable diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index 6477663..731ba63 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class AffinitiesController < ApplicationController diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bac01aa..d1cd17b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class ApplicationController < ActionController::Base diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 93a9afd..7ba4584 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class CaptchaController < ApplicationController diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 977199c..d611a1c 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class ExpensesController < ApplicationController diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index f1cc518..76296af 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class GroupsController < ApplicationController diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index e8e0d7c..3c3dba1 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'csv' diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb index 3071f09..42e6dc6 100644 --- a/app/controllers/summary_controller.rb +++ b/app/controllers/summary_controller.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class SummaryController < ApplicationController diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index c98c80e..6584ffe 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class TablesArrangementsController < ApplicationController diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb index bee16c2..e0ce15d 100644 --- a/app/controllers/tokens_controller.rb +++ b/app/controllers/tokens_controller.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class TokensController < ApplicationController diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index e67f192..f204227 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module Users diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index cf5f702..1873dde 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module Users diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 0b031d8..67c250f 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module Users diff --git a/app/extensions/tree_node_extension.rb b/app/extensions/tree_node_extension.rb index 0c33107..ccb6a72 100644 --- a/app/extensions/tree_node_extension.rb +++ b/app/extensions/tree_node_extension.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module TreeNodeExtension diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 20c431a..15b06f0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module ApplicationHelper diff --git a/app/helpers/expenses_helper.rb b/app/helpers/expenses_helper.rb index 7dda766..1b8b4a0 100644 --- a/app/helpers/expenses_helper.rb +++ b/app/helpers/expenses_helper.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module ExpensesHelper diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 4d76b36..46abae7 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module GroupsHelper diff --git a/app/helpers/guests_helper.rb b/app/helpers/guests_helper.rb index f2d5c9b..10452d8 100644 --- a/app/helpers/guests_helper.rb +++ b/app/helpers/guests_helper.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module GuestsHelper diff --git a/app/helpers/tables_arrangements_helper.rb b/app/helpers/tables_arrangements_helper.rb index 47c6960..1550d07 100644 --- a/app/helpers/tables_arrangements_helper.rb +++ b/app/helpers/tables_arrangements_helper.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module TablesArrangementsHelper diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index d025a46..bef3959 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class ApplicationJob < ActiveJob::Base diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index f47de50..bea7bc5 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class TableSimulatorJob < ApplicationJob diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 36695dc..d84cb6e 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class ApplicationMailer < ActionMailer::Base diff --git a/app/models/application_record.rb b/app/models/application_record.rb index b9b1d00..08dc537 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class ApplicationRecord < ActiveRecord::Base diff --git a/app/models/expense.rb b/app/models/expense.rb index 26c4696..3ae5f8f 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # == Schema Information diff --git a/app/models/group.rb b/app/models/group.rb index e2fae42..8be4d14 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # == Schema Information diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb index 4b63e54..38b3609 100644 --- a/app/models/group_affinity.rb +++ b/app/models/group_affinity.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # == Schema Information diff --git a/app/models/guest.rb b/app/models/guest.rb index 15a8f99..7105dbb 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # == Schema Information diff --git a/app/models/seat.rb b/app/models/seat.rb index 116f4cf..d1ac3d7 100644 --- a/app/models/seat.rb +++ b/app/models/seat.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # == Schema Information diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index 0c412a1..bc52eb8 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # == Schema Information diff --git a/app/models/user.rb b/app/models/user.rb index 8501aae..f87f382 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # == Schema Information diff --git a/app/models/wedding.rb b/app/models/wedding.rb index bea6cae..7cd5b41 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # == Schema Information diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index 0fae5c1..3b9008c 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module Expenses diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb index 7bf2c77..08ee519 100644 --- a/app/queries/groups/summary_query.rb +++ b/app/queries/groups/summary_query.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module Groups diff --git a/app/serializers/serializable_group.rb b/app/serializers/serializable_group.rb index c3dfc91..64685e0 100644 --- a/app/serializers/serializable_group.rb +++ b/app/serializers/serializable_group.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class SerializableGroup < JSONAPI::Serializable::Resource diff --git a/app/serializers/serializable_guest.rb b/app/serializers/serializable_guest.rb index 825f053..8f05eb1 100644 --- a/app/serializers/serializable_guest.rb +++ b/app/serializers/serializable_guest.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class SerializableGuest < JSONAPI::Serializable::Resource diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index 7da401d..ba95614 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class AffinityGroupsHierarchy < Array diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb index 522ac27..37744e2 100644 --- a/app/services/libre_captcha.rb +++ b/app/services/libre_captcha.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class LibreCaptcha diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index a72d2b4..a65253e 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module Tables diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 7ce1fe4..50b04c2 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require_relative '../../extensions/tree_node_extension' diff --git a/app/services/tables/shift.rb b/app/services/tables/shift.rb index ffcb7d9..c07ccdb 100644 --- a/app/services/tables/shift.rb +++ b/app/services/tables/shift.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module Tables diff --git a/app/services/tables/swap.rb b/app/services/tables/swap.rb index 04d21a1..565caf8 100644 --- a/app/services/tables/swap.rb +++ b/app/services/tables/swap.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module Tables diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index 79cc649..aa62a47 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module Tables diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index bd8a400..26c5bab 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module VNS diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 98b3798..b3f319f 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -1,10 +1,4 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> - -<%# Copyright (C) 2024 Manuel Bustillo %> - -<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> - - +<%<%<% diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb index 2254355..8404d89 100644 --- a/app/views/layouts/mailer.text.erb +++ b/app/views/layouts/mailer.text.erb @@ -1,7 +1 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> - -<%# Copyright (C) 2024 Manuel Bustillo %> - -<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> - -<%= yield %> +<%<%<%<%= yield %> diff --git a/app/views/users/mailer/confirmation_instructions.html.erb b/app/views/users/mailer/confirmation_instructions.html.erb index 3860a60..26dc9ed 100644 --- a/app/views/users/mailer/confirmation_instructions.html.erb +++ b/app/views/users/mailer/confirmation_instructions.html.erb @@ -1,10 +1,4 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> - -<%# Copyright (C) 2024 Manuel Bustillo %> - -<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> - -

    Welcome <%= @email %>!

    +<%<%<%

    Welcome <%= @email %>!

    You can confirm your account email through the link below:

    diff --git a/app/views/users/mailer/email_changed.html.erb b/app/views/users/mailer/email_changed.html.erb index ecf1924..7c3a50f 100644 --- a/app/views/users/mailer/email_changed.html.erb +++ b/app/views/users/mailer/email_changed.html.erb @@ -1,10 +1,4 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> - -<%# Copyright (C) 2024 Manuel Bustillo %> - -<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> - -

    Hello <%= @email %>!

    +<%<%<%

    Hello <%= @email %>!

    <% if @resource.try(:unconfirmed_email?) %>

    We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.

    diff --git a/app/views/users/mailer/password_change.html.erb b/app/views/users/mailer/password_change.html.erb index 55efe66..7bca9b7 100644 --- a/app/views/users/mailer/password_change.html.erb +++ b/app/views/users/mailer/password_change.html.erb @@ -1,9 +1,3 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> - -<%# Copyright (C) 2024 Manuel Bustillo %> - -<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> - -

    Hello <%= @resource.email %>!

    +<%<%<%

    Hello <%= @resource.email %>!

    We're contacting you to notify you that your password has been changed.

    diff --git a/app/views/users/mailer/reset_password_instructions.html.erb b/app/views/users/mailer/reset_password_instructions.html.erb index 510d1a2..a2e70db 100644 --- a/app/views/users/mailer/reset_password_instructions.html.erb +++ b/app/views/users/mailer/reset_password_instructions.html.erb @@ -1,10 +1,4 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> - -<%# Copyright (C) 2024 Manuel Bustillo %> - -<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> - -

    Hello <%= @resource.email %>!

    +<%<%<%

    Hello <%= @resource.email %>!

    Someone has requested a link to change your password. You can do this through the link below.

    diff --git a/app/views/users/mailer/unlock_instructions.html.erb b/app/views/users/mailer/unlock_instructions.html.erb index e6481f7..86d82c0 100644 --- a/app/views/users/mailer/unlock_instructions.html.erb +++ b/app/views/users/mailer/unlock_instructions.html.erb @@ -1,10 +1,4 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> - -<%# Copyright (C) 2024 Manuel Bustillo %> - -<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> - -

    Hello <%= @resource.email %>!

    +<%<%<%

    Hello <%= @resource.email %>!

    Your account has been locked due to an excessive number of unsuccessful sign in attempts.

    diff --git a/config/application.rb b/config/application.rb index 0c65ef8..7c6b36e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - require_relative 'boot' require 'rails' diff --git a/config/boot.rb b/config/boot.rb index e4cf23b..988a5dd 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/config/environment.rb b/config/environment.rb index e192b60..cac5315 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # Load the Rails application. require_relative "application" diff --git a/config/environments/development.rb b/config/environments/development.rb index 833acec..3cee377 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - require "active_support/core_ext/integer/time" Rails.application.configure do diff --git a/config/environments/production.rb b/config/environments/production.rb index 2d86713..e3f6d9b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - require "active_support/core_ext/integer/time" Rails.application.configure do diff --git a/config/environments/test.rb b/config/environments/test.rb index 2e8601f..3ada93b 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's diff --git a/config/importmap.rb b/config/importmap.rb index 9b60f46..909dfc5 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # Pin npm packages by running ./bin/importmap pin "application" diff --git a/config/initializers/acts_as_tenant.rb b/config/initializers/acts_as_tenant.rb index b7895ad..f6c78a8 100644 --- a/config/initializers/acts_as_tenant.rb +++ b/config/initializers/acts_as_tenant.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - ActsAsTenant.configure do |config| config.require_tenant = !Rails.env.test? end \ No newline at end of file diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index f1ba0d3..2eeef96 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. diff --git a/config/initializers/colors.rb b/config/initializers/colors.rb index 5ed99da..042a749 100644 --- a/config/initializers/colors.rb +++ b/config/initializers/colors.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - Chroma.define_palette :decreasing_saturation do spin(20).desaturate(40) spin(-20).desaturate(40) diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 21cdde3..b3076b3 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # Be sure to restart your server when you modify this file. # Define an application-wide content security policy. diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index 4bf656c..a908920 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # config/initializers/cors.rb Rails.application.config.middleware.insert_before 0, Rack::Cors do diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 8a71efa..b407122 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # Assuming you have not yet modified this file, each configuration option below diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 21d6e2e..c2d89e2 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # Be sure to restart your server when you modify this file. # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index be7b9db..157a851 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index 3d96b1b..7db3b95 100644 --- a/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # Be sure to restart your server when you modify this file. # Define an application-wide HTTP permissions policy. For further diff --git a/config/initializers/rswag_api.rb b/config/initializers/rswag_api.rb index dcd512b..c4462b2 100644 --- a/config/initializers/rswag_api.rb +++ b/config/initializers/rswag_api.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - Rswag::Api.configure do |c| # Specify a root folder where Swagger JSON files are located diff --git a/config/initializers/rswag_ui.rb b/config/initializers/rswag_ui.rb index 2cb39a1..30172aa 100644 --- a/config/initializers/rswag_ui.rb +++ b/config/initializers/rswag_ui.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - Rswag::Ui.configure do |c| # List the Swagger endpoints that you want to be documented through the diff --git a/config/initializers/ruby_extensions.rb b/config/initializers/ruby_extensions.rb index f86dd29..490dadf 100644 --- a/config/initializers/ruby_extensions.rb +++ b/config/initializers/ruby_extensions.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class Numeric def to_currency Money.from_amount(self, "EUR").format diff --git a/config/puma.rb b/config/puma.rb index 284357a..afa809b 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # This configuration file will be evaluated by Puma. The top-level methods that # are invoked here are part of Puma's configuration DSL. For more information # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. diff --git a/config/routes.rb b/config/routes.rb index e4b0398..3f4685b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - Rails.application.routes.draw do mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? get 'token' => 'tokens#show', as: :token diff --git a/db/migrate/20240711175425_create_expenses.rb b/db/migrate/20240711175425_create_expenses.rb index e19615b..63d0f2b 100644 --- a/db/migrate/20240711175425_create_expenses.rb +++ b/db/migrate/20240711175425_create_expenses.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class CreateExpenses < ActiveRecord::Migration[7.1] def change create_enum :pricing_types, ["fixed", "per_person"] diff --git a/db/migrate/20240711180753_create_guests.rb b/db/migrate/20240711180753_create_guests.rb index bbfe941..1280006 100644 --- a/db/migrate/20240711180753_create_guests.rb +++ b/db/migrate/20240711180753_create_guests.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class CreateGuests < ActiveRecord::Migration[7.1] def change create_table :guests, id: :uuid do |t| diff --git a/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb index c8694b4..8b97ba6 100644 --- a/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 1) diff --git a/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb index 1224fd0..ebd46fd 100644 --- a/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 2) diff --git a/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb index 03b1170..d17afe8 100644 --- a/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 3) diff --git a/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb index 2168b2b..52f696b 100644 --- a/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 4) diff --git a/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb index 1d0e248..47fd928 100644 --- a/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 5) diff --git a/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb index ff4d15b..f5aaaf9 100644 --- a/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 6) diff --git a/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb index 741e909..b62b660 100644 --- a/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 7) diff --git a/db/migrate/20240724181756_create_tables_arrangements.rb b/db/migrate/20240724181756_create_tables_arrangements.rb index 5c9d4a6..c05f6dc 100644 --- a/db/migrate/20240724181756_create_tables_arrangements.rb +++ b/db/migrate/20240724181756_create_tables_arrangements.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class CreateTablesArrangements < ActiveRecord::Migration[7.1] def change create_table :tables_arrangements, id: :uuid do |t| diff --git a/db/migrate/20240724181853_create_seats.rb b/db/migrate/20240724181853_create_seats.rb index bca6ce8..74f5b7b 100644 --- a/db/migrate/20240724181853_create_seats.rb +++ b/db/migrate/20240724181853_create_seats.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class CreateSeats < ActiveRecord::Migration[7.1] def change create_table :seats, id: :uuid do |t| diff --git a/db/migrate/20240811142121_create_groups.rb b/db/migrate/20240811142121_create_groups.rb index ccba1da..0246978 100644 --- a/db/migrate/20240811142121_create_groups.rb +++ b/db/migrate/20240811142121_create_groups.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class CreateGroups < ActiveRecord::Migration[7.1] def change create_table :groups, id: :uuid do |t| diff --git a/db/migrate/20240811143801_add_parent_to_group.rb b/db/migrate/20240811143801_add_parent_to_group.rb index de04557..575af38 100644 --- a/db/migrate/20240811143801_add_parent_to_group.rb +++ b/db/migrate/20240811143801_add_parent_to_group.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class AddParentToGroup < ActiveRecord::Migration[7.1] def change add_reference :groups, :parent, type: :uuid, index: true, foreign_key: { to_table: :groups } diff --git a/db/migrate/20240811154115_add_group_to_guest.rb b/db/migrate/20240811154115_add_group_to_guest.rb index b2b461a..d4e2bd4 100644 --- a/db/migrate/20240811154115_add_group_to_guest.rb +++ b/db/migrate/20240811154115_add_group_to_guest.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class AddGroupToGuest < ActiveRecord::Migration[7.1] def change add_reference :guests, :group, null: false, foreign_key: true, type: :uuid diff --git a/db/migrate/20240811170021_add_status_to_guest.rb b/db/migrate/20240811170021_add_status_to_guest.rb index 8172cb9..cd7be5b 100644 --- a/db/migrate/20240811170021_add_status_to_guest.rb +++ b/db/migrate/20240811170021_add_status_to_guest.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class AddStatusToGuest < ActiveRecord::Migration[7.1] def change add_column :guests, :status, :integer, default: 0 diff --git a/db/migrate/20241101181052_drop_taggable_tables.rb b/db/migrate/20241101181052_drop_taggable_tables.rb index 6c0a597..1759e6a 100644 --- a/db/migrate/20241101181052_drop_taggable_tables.rb +++ b/db/migrate/20241101181052_drop_taggable_tables.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class DropTaggableTables < ActiveRecord::Migration[7.2] def change drop_table 'taggings', force: :cascade do |t| diff --git a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb index 32681d2..7f38f58 100644 --- a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb +++ b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class AddNameToTablesArrangements < ActiveRecord::Migration[7.2] def change add_column :tables_arrangements, :name, :string, null: false diff --git a/db/migrate/20241103075705_solid_queue_install.rb b/db/migrate/20241103075705_solid_queue_install.rb index 13552e6..4dfb4d0 100644 --- a/db/migrate/20241103075705_solid_queue_install.rb +++ b/db/migrate/20241103075705_solid_queue_install.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class SolidQueueInstall < ActiveRecord::Migration[7.2] def change create_table 'solid_queue_blocked_executions', force: :cascade do |t| diff --git a/db/migrate/20241103093955_remove_email_from_guests.rb b/db/migrate/20241103093955_remove_email_from_guests.rb index 43031a9..f09bced 100644 --- a/db/migrate/20241103093955_remove_email_from_guests.rb +++ b/db/migrate/20241103093955_remove_email_from_guests.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class RemoveEmailFromGuests < ActiveRecord::Migration[7.2] def change remove_column :guests, :email, :string diff --git a/db/migrate/20241103133122_add_color_to_group.rb b/db/migrate/20241103133122_add_color_to_group.rb index f9b53f5..f73d988 100644 --- a/db/migrate/20241103133122_add_color_to_group.rb +++ b/db/migrate/20241103133122_add_color_to_group.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class AddColorToGroup < ActiveRecord::Migration[7.2] def change add_column :groups, :color, :string diff --git a/db/migrate/20241111063741_merge_guest_names.rb b/db/migrate/20241111063741_merge_guest_names.rb index d202346..21cdfa6 100644 --- a/db/migrate/20241111063741_merge_guest_names.rb +++ b/db/migrate/20241111063741_merge_guest_names.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class MergeGuestNames < ActiveRecord::Migration[8.0] def change add_column :guests, :name, :string diff --git a/db/migrate/20241130095753_devise_create_users.rb b/db/migrate/20241130095753_devise_create_users.rb index 71e0f82..bbe3837 100644 --- a/db/migrate/20241130095753_devise_create_users.rb +++ b/db/migrate/20241130095753_devise_create_users.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true class DeviseCreateUsers < ActiveRecord::Migration[8.0] diff --git a/db/migrate/20241130182228_create_weddings.rb b/db/migrate/20241130182228_create_weddings.rb index 1aa30a5..c8cf1fd 100644 --- a/db/migrate/20241130182228_create_weddings.rb +++ b/db/migrate/20241130182228_create_weddings.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class CreateWeddings < ActiveRecord::Migration[8.0] def change create_table :weddings, id: :uuid do |t| diff --git a/db/migrate/20241130185731_add_wedding_id_to_models.rb b/db/migrate/20241130185731_add_wedding_id_to_models.rb index 614e21d..9f6d46a 100644 --- a/db/migrate/20241130185731_add_wedding_id_to_models.rb +++ b/db/migrate/20241130185731_add_wedding_id_to_models.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class AddWeddingIdToModels < ActiveRecord::Migration[8.0] def change [:expenses, :guests, :seats, :tables_arrangements, :groups, :users].each do |table| diff --git a/db/migrate/20241207112305_remove_wedding_date.rb b/db/migrate/20241207112305_remove_wedding_date.rb index da2c9d2..2176f55 100644 --- a/db/migrate/20241207112305_remove_wedding_date.rb +++ b/db/migrate/20241207112305_remove_wedding_date.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class RemoveWeddingDate < ActiveRecord::Migration[8.0] def change remove_column :weddings, :date, :date, null: false diff --git a/db/migrate/20241208102932_allow_ungrouped_guests.rb b/db/migrate/20241208102932_allow_ungrouped_guests.rb index c07ea87..e4bb19a 100644 --- a/db/migrate/20241208102932_allow_ungrouped_guests.rb +++ b/db/migrate/20241208102932_allow_ungrouped_guests.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class AllowUngroupedGuests < ActiveRecord::Migration[8.0] def change change_column_null :guests, :group_id, true diff --git a/db/migrate/20241216231415_create_group_affinities.rb b/db/migrate/20241216231415_create_group_affinities.rb index 4a2ac8e..1c6789d 100644 --- a/db/migrate/20241216231415_create_group_affinities.rb +++ b/db/migrate/20241216231415_create_group_affinities.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - class CreateGroupAffinities < ActiveRecord::Migration[8.0] disable_ddl_transaction! diff --git a/db/queue_schema.rb b/db/queue_schema.rb index 14c6e9d..0cc657e 100644 --- a/db/queue_schema.rb +++ b/db/queue_schema.rb @@ -1,8 +1,2 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - ActiveRecord::Schema[7.1].define(version: 1) do end diff --git a/db/schema.rb b/db/schema.rb index e810882..5e4178c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. diff --git a/db/seeds.rb b/db/seeds.rb index b3316bb..b0e69c5 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - NUMBER_OF_GUESTS = 50 ActsAsTenant.without_tenant do diff --git a/spec/extensions/tree_spec.rb b/spec/extensions/tree_spec.rb index 883522d..56de6f0 100644 --- a/spec/extensions/tree_spec.rb +++ b/spec/extensions/tree_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index 13fef3c..5624496 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true FactoryBot.define do diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index bc1e80f..10a8d84 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true FactoryBot.define do diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index e98c464..1949d65 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true FactoryBot.define do diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index f72073f..4f1f4f9 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true FactoryBot.define do diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb index 05aab24..e1eedad 100644 --- a/spec/factories/table_arrangement.rb +++ b/spec/factories/table_arrangement.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true FactoryBot.define do diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 342ced5..bbc1dd0 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true FactoryBot.define do diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index d3dd2e9..3a2ff4c 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true FactoryBot.define do diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index ea1f83d..6c1797a 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/group_affinity_spec.rb b/spec/models/group_affinity_spec.rb index 2a5049e..00f053c 100644 --- a/spec/models/group_affinity_spec.rb +++ b/spec/models/group_affinity_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index e0f8d78..2b466dd 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index 756bed7..5db5f05 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/seat_spec.rb b/spec/models/seat_spec.rb index 80c23d9..44f157b 100644 --- a/spec/models/seat_spec.rb +++ b/spec/models/seat_spec.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index 8134f17..a182e9e 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index e954eb3..2140e5b 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index 2549380..e5b224e 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -1,11 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index 9fc5cb2..46b09d2 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/queries/groups/summary_query_spec.rb b/spec/queries/groups/summary_query_spec.rb index 9b061fe..5c3fccd 100644 --- a/spec/queries/groups/summary_query_spec.rb +++ b/spec/queries/groups/summary_query_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 3ea320e..f5ed83c 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # This file is copied to spec/ when you run 'rails generate rspec:install' diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index 97636f5..4a23a8b 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/captcha_spec.rb b/spec/requests/captcha_spec.rb index 6921efa..738f391 100644 --- a/spec/requests/captcha_spec.rb +++ b/spec/requests/captcha_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index 178f71a..a912891 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index 2779b53..c06ed89 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index e711a2b..6f588f4 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index bf0a1ca..aa9d4e0 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module Swagger diff --git a/spec/requests/summary_spec.rb b/spec/requests/summary_spec.rb index 1ca3611..57417a7 100644 --- a/spec/requests/summary_spec.rb +++ b/spec/requests/summary_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index 7ee1385..d06f28d 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/tokens_spec.rb b/spec/requests/tokens_spec.rb index 59e3c88..f1bcd40 100644 --- a/spec/requests/tokens_spec.rb +++ b/spec/requests/tokens_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb index e09ef74..7758fa6 100644 --- a/spec/requests/users/confirmations_spec.rb +++ b/spec/requests/users/confirmations_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index 4eaa076..21f5f78 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/users/sessions_spec.rb b/spec/requests/users/sessions_spec.rb index 5c23c59..25fb0b7 100644 --- a/spec/requests/users/sessions_spec.rb +++ b/spec/requests/users/sessions_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index f5ba1ee..19f836a 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/services/tables/distribution_spec.rb b/spec/services/tables/distribution_spec.rb index 2c8b133..f84ae03 100644 --- a/spec/services/tables/distribution_spec.rb +++ b/spec/services/tables/distribution_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/services/tables/shift_spec.rb b/spec/services/tables/shift_spec.rb index d39ce89..248b3a2 100644 --- a/spec/services/tables/shift_spec.rb +++ b/spec/services/tables/shift_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/services/tables/swap_spec.rb b/spec/services/tables/swap_spec.rb index 66ce320..1ad8857 100644 --- a/spec/services/tables/swap_spec.rb +++ b/spec/services/tables/swap_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/services/vns/engine_spec.rb b/spec/services/vns/engine_spec.rb index 7d183f5..02acb5b 100644 --- a/spec/services/vns/engine_spec.rb +++ b/spec/services/vns/engine_spec.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d1b85f5..409c64b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true # This file was generated by the `rails generate rspec:install` command. Conventionally, all diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index 1afb6e1..ab24f93 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true require 'rails_helper' diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index a4b818d..964f4a9 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -1,9 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - -# Copyright (C) 2024 Manuel Bustillo - -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # frozen_string_literal: true module SwaggerResponseHelper From 8c12884212ecdb3619d65a4fc45a60be7f6c5061 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Thu, 23 Jan 2025 21:34:23 +0000 Subject: [PATCH 280/283] Add copyright notice --- app/channels/application_cable/channel.rb | 2 ++ app/channels/application_cable/connection.rb | 2 ++ app/controllers/affinities_controller.rb | 2 ++ app/controllers/application_controller.rb | 2 ++ app/controllers/captcha_controller.rb | 2 ++ app/controllers/expenses_controller.rb | 2 ++ app/controllers/groups_controller.rb | 2 ++ app/controllers/guests_controller.rb | 2 ++ app/controllers/summary_controller.rb | 2 ++ app/controllers/tables_arrangements_controller.rb | 2 ++ app/controllers/tokens_controller.rb | 2 ++ app/controllers/users/confirmations_controller.rb | 2 ++ app/controllers/users/registrations_controller.rb | 2 ++ app/controllers/users/sessions_controller.rb | 2 ++ app/extensions/tree_node_extension.rb | 2 ++ app/helpers/application_helper.rb | 2 ++ app/helpers/expenses_helper.rb | 2 ++ app/helpers/groups_helper.rb | 2 ++ app/helpers/guests_helper.rb | 2 ++ app/helpers/tables_arrangements_helper.rb | 2 ++ app/jobs/application_job.rb | 2 ++ app/jobs/table_simulator_job.rb | 2 ++ app/mailers/application_mailer.rb | 2 ++ app/models/application_record.rb | 2 ++ app/models/expense.rb | 2 ++ app/models/group.rb | 2 ++ app/models/group_affinity.rb | 2 ++ app/models/guest.rb | 2 ++ app/models/seat.rb | 2 ++ app/models/tables_arrangement.rb | 2 ++ app/models/user.rb | 2 ++ app/models/wedding.rb | 2 ++ app/queries/expenses/total_query.rb | 2 ++ app/queries/groups/summary_query.rb | 2 ++ app/serializers/serializable_group.rb | 2 ++ app/serializers/serializable_guest.rb | 2 ++ app/services/affinity_groups_hierarchy.rb | 2 ++ app/services/libre_captcha.rb | 2 ++ app/services/tables/discomfort_calculator.rb | 2 ++ app/services/tables/distribution.rb | 2 ++ app/services/tables/shift.rb | 2 ++ app/services/tables/swap.rb | 2 ++ app/services/tables/table.rb | 2 ++ app/services/vns/engine.rb | 2 ++ app/views/layouts/mailer.html.erb | 2 ++ app/views/layouts/mailer.text.erb | 2 ++ app/views/users/mailer/confirmation_instructions.html.erb | 2 ++ app/views/users/mailer/email_changed.html.erb | 2 ++ app/views/users/mailer/password_change.html.erb | 2 ++ app/views/users/mailer/reset_password_instructions.html.erb | 2 ++ app/views/users/mailer/unlock_instructions.html.erb | 2 ++ config/application.rb | 2 ++ config/boot.rb | 2 ++ config/environment.rb | 2 ++ config/environments/development.rb | 2 ++ config/environments/production.rb | 2 ++ config/environments/test.rb | 2 ++ config/importmap.rb | 2 ++ config/initializers/acts_as_tenant.rb | 2 ++ config/initializers/assets.rb | 2 ++ config/initializers/colors.rb | 2 ++ config/initializers/content_security_policy.rb | 2 ++ config/initializers/cors.rb | 2 ++ config/initializers/devise.rb | 2 ++ config/initializers/filter_parameter_logging.rb | 2 ++ config/initializers/inflections.rb | 2 ++ config/initializers/permissions_policy.rb | 2 ++ config/initializers/rswag_api.rb | 2 ++ config/initializers/rswag_ui.rb | 2 ++ config/initializers/ruby_extensions.rb | 2 ++ config/puma.rb | 2 ++ config/routes.rb | 2 ++ db/migrate/20240711175425_create_expenses.rb | 2 ++ db/migrate/20240711180753_create_guests.rb | 2 ++ ..._acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb | 2 ++ ...627_add_missing_unique_indices.acts_as_taggable_on_engine.rb | 2 ++ ...taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb | 2 ++ ...629_add_missing_taggable_index.acts_as_taggable_on_engine.rb | 2 ++ ...change_collation_for_tag_names.acts_as_taggable_on_engine.rb | 2 ++ ...dd_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb | 2 ++ ...1181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb | 2 ++ db/migrate/20240724181756_create_tables_arrangements.rb | 2 ++ db/migrate/20240724181853_create_seats.rb | 2 ++ db/migrate/20240811142121_create_groups.rb | 2 ++ db/migrate/20240811143801_add_parent_to_group.rb | 2 ++ db/migrate/20240811154115_add_group_to_guest.rb | 2 ++ db/migrate/20240811170021_add_status_to_guest.rb | 2 ++ db/migrate/20241101181052_drop_taggable_tables.rb | 2 ++ db/migrate/20241103072808_add_name_to_tables_arrangements.rb | 2 ++ db/migrate/20241103075705_solid_queue_install.rb | 2 ++ db/migrate/20241103093955_remove_email_from_guests.rb | 2 ++ db/migrate/20241103133122_add_color_to_group.rb | 2 ++ db/migrate/20241111063741_merge_guest_names.rb | 2 ++ db/migrate/20241130095753_devise_create_users.rb | 2 ++ db/migrate/20241130182228_create_weddings.rb | 2 ++ db/migrate/20241130185731_add_wedding_id_to_models.rb | 2 ++ db/migrate/20241207112305_remove_wedding_date.rb | 2 ++ db/migrate/20241208102932_allow_ungrouped_guests.rb | 2 ++ db/migrate/20241216231415_create_group_affinities.rb | 2 ++ db/queue_schema.rb | 2 ++ db/schema.rb | 2 ++ db/seeds.rb | 2 ++ spec/extensions/tree_spec.rb | 2 ++ spec/factories/expense.rb | 2 ++ spec/factories/group_affinities.rb | 2 ++ spec/factories/groups.rb | 2 ++ spec/factories/guest.rb | 2 ++ spec/factories/table_arrangement.rb | 2 ++ spec/factories/users.rb | 2 ++ spec/factories/weddings.rb | 2 ++ spec/models/expense_spec.rb | 2 ++ spec/models/group_affinity_spec.rb | 2 ++ spec/models/group_spec.rb | 2 ++ spec/models/guest_spec.rb | 2 ++ spec/models/seat_spec.rb | 2 ++ spec/models/tables_arrangement_spec.rb | 2 ++ spec/models/user_spec.rb | 2 ++ spec/models/wedding_spec.rb | 2 ++ spec/queries/expenses/total_query_spec.rb | 2 ++ spec/queries/groups/summary_query_spec.rb | 2 ++ spec/rails_helper.rb | 2 ++ spec/requests/affinities_spec.rb | 2 ++ spec/requests/captcha_spec.rb | 2 ++ spec/requests/expenses_spec.rb | 2 ++ spec/requests/groups_spec.rb | 2 ++ spec/requests/guests_spec.rb | 2 ++ spec/requests/schemas.rb | 2 ++ spec/requests/summary_spec.rb | 2 ++ spec/requests/tables_arrangements_spec.rb | 2 ++ spec/requests/tokens_spec.rb | 2 ++ spec/requests/users/confirmations_spec.rb | 2 ++ spec/requests/users/registrations_spec.rb | 2 ++ spec/requests/users/sessions_spec.rb | 2 ++ spec/services/tables/discomfort_calculator_spec.rb | 2 ++ spec/services/tables/distribution_spec.rb | 2 ++ spec/services/tables/shift_spec.rb | 2 ++ spec/services/tables/swap_spec.rb | 2 ++ spec/services/vns/engine_spec.rb | 2 ++ spec/spec_helper.rb | 2 ++ spec/swagger_helper.rb | 2 ++ spec/swagger_response_helper.rb | 2 ++ 141 files changed, 282 insertions(+) diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index 9aec230..88942fe 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module ApplicationCable diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 8d6c2a1..ab575d6 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module ApplicationCable diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index 731ba63..63849b2 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class AffinitiesController < ApplicationController diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d1cd17b..025dc85 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class ApplicationController < ActionController::Base diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 7ba4584..6c3f3ca 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class CaptchaController < ApplicationController diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index d611a1c..3195a8b 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class ExpensesController < ApplicationController diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 76296af..08334aa 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class GroupsController < ApplicationController diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 3c3dba1..1d872fa 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'csv' diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb index 42e6dc6..0d3f655 100644 --- a/app/controllers/summary_controller.rb +++ b/app/controllers/summary_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class SummaryController < ApplicationController diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index 6584ffe..c09d453 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class TablesArrangementsController < ApplicationController diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb index e0ce15d..a0ee546 100644 --- a/app/controllers/tokens_controller.rb +++ b/app/controllers/tokens_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class TokensController < ApplicationController diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index f204227..01eb91e 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module Users diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 1873dde..f261e90 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module Users diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 67c250f..4d7b6a8 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module Users diff --git a/app/extensions/tree_node_extension.rb b/app/extensions/tree_node_extension.rb index ccb6a72..6894dd7 100644 --- a/app/extensions/tree_node_extension.rb +++ b/app/extensions/tree_node_extension.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module TreeNodeExtension diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 15b06f0..9dbd98c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module ApplicationHelper diff --git a/app/helpers/expenses_helper.rb b/app/helpers/expenses_helper.rb index 1b8b4a0..0b8c324 100644 --- a/app/helpers/expenses_helper.rb +++ b/app/helpers/expenses_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module ExpensesHelper diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 46abae7..feda408 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module GroupsHelper diff --git a/app/helpers/guests_helper.rb b/app/helpers/guests_helper.rb index 10452d8..369b8ed 100644 --- a/app/helpers/guests_helper.rb +++ b/app/helpers/guests_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module GuestsHelper diff --git a/app/helpers/tables_arrangements_helper.rb b/app/helpers/tables_arrangements_helper.rb index 1550d07..6353e46 100644 --- a/app/helpers/tables_arrangements_helper.rb +++ b/app/helpers/tables_arrangements_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module TablesArrangementsHelper diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index bef3959..561fb56 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class ApplicationJob < ActiveJob::Base diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index bea7bc5..51b7256 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class TableSimulatorJob < ApplicationJob diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index d84cb6e..b28db31 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class ApplicationMailer < ActionMailer::Base diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 08dc537..61b9d31 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class ApplicationRecord < ActiveRecord::Base diff --git a/app/models/expense.rb b/app/models/expense.rb index 3ae5f8f..66b32f3 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # == Schema Information diff --git a/app/models/group.rb b/app/models/group.rb index 8be4d14..2db28ed 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # == Schema Information diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb index 38b3609..8e70d59 100644 --- a/app/models/group_affinity.rb +++ b/app/models/group_affinity.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # == Schema Information diff --git a/app/models/guest.rb b/app/models/guest.rb index 7105dbb..ad0542f 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # == Schema Information diff --git a/app/models/seat.rb b/app/models/seat.rb index d1ac3d7..9c31c42 100644 --- a/app/models/seat.rb +++ b/app/models/seat.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # == Schema Information diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index bc52eb8..adece9a 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # == Schema Information diff --git a/app/models/user.rb b/app/models/user.rb index f87f382..ff46fff 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # == Schema Information diff --git a/app/models/wedding.rb b/app/models/wedding.rb index 7cd5b41..83525b5 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # == Schema Information diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index 3b9008c..ae4fe65 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module Expenses diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb index 08ee519..81c91b4 100644 --- a/app/queries/groups/summary_query.rb +++ b/app/queries/groups/summary_query.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module Groups diff --git a/app/serializers/serializable_group.rb b/app/serializers/serializable_group.rb index 64685e0..b3e2258 100644 --- a/app/serializers/serializable_group.rb +++ b/app/serializers/serializable_group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class SerializableGroup < JSONAPI::Serializable::Resource diff --git a/app/serializers/serializable_guest.rb b/app/serializers/serializable_guest.rb index 8f05eb1..ee4bac1 100644 --- a/app/serializers/serializable_guest.rb +++ b/app/serializers/serializable_guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class SerializableGuest < JSONAPI::Serializable::Resource diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index ba95614..cd448de 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class AffinityGroupsHierarchy < Array diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb index 37744e2..a3843da 100644 --- a/app/services/libre_captcha.rb +++ b/app/services/libre_captcha.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class LibreCaptcha diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index a65253e..6a7ebcf 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module Tables diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 50b04c2..87dccb0 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require_relative '../../extensions/tree_node_extension' diff --git a/app/services/tables/shift.rb b/app/services/tables/shift.rb index c07ccdb..d5592d9 100644 --- a/app/services/tables/shift.rb +++ b/app/services/tables/shift.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module Tables diff --git a/app/services/tables/swap.rb b/app/services/tables/swap.rb index 565caf8..04abc18 100644 --- a/app/services/tables/swap.rb +++ b/app/services/tables/swap.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module Tables diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index aa62a47..cc05ea0 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module Tables diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index 26c5bab..d66c80b 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module VNS diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index b3f319f..a8eafc7 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%<%<% diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb index 8404d89..0769757 100644 --- a/app/views/layouts/mailer.text.erb +++ b/app/views/layouts/mailer.text.erb @@ -1 +1,3 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%<%<%<%= yield %> diff --git a/app/views/users/mailer/confirmation_instructions.html.erb b/app/views/users/mailer/confirmation_instructions.html.erb index 26dc9ed..f477218 100644 --- a/app/views/users/mailer/confirmation_instructions.html.erb +++ b/app/views/users/mailer/confirmation_instructions.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%<%<%

    Welcome <%= @email %>!

    You can confirm your account email through the link below:

    diff --git a/app/views/users/mailer/email_changed.html.erb b/app/views/users/mailer/email_changed.html.erb index 7c3a50f..0e68a0a 100644 --- a/app/views/users/mailer/email_changed.html.erb +++ b/app/views/users/mailer/email_changed.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%<%<%

    Hello <%= @email %>!

    <% if @resource.try(:unconfirmed_email?) %> diff --git a/app/views/users/mailer/password_change.html.erb b/app/views/users/mailer/password_change.html.erb index 7bca9b7..bf4de87 100644 --- a/app/views/users/mailer/password_change.html.erb +++ b/app/views/users/mailer/password_change.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%<%<%

    Hello <%= @resource.email %>!

    We're contacting you to notify you that your password has been changed.

    diff --git a/app/views/users/mailer/reset_password_instructions.html.erb b/app/views/users/mailer/reset_password_instructions.html.erb index a2e70db..0499866 100644 --- a/app/views/users/mailer/reset_password_instructions.html.erb +++ b/app/views/users/mailer/reset_password_instructions.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%<%<%

    Hello <%= @resource.email %>!

    Someone has requested a link to change your password. You can do this through the link below.

    diff --git a/app/views/users/mailer/unlock_instructions.html.erb b/app/views/users/mailer/unlock_instructions.html.erb index 86d82c0..b59cb33 100644 --- a/app/views/users/mailer/unlock_instructions.html.erb +++ b/app/views/users/mailer/unlock_instructions.html.erb @@ -1,3 +1,5 @@ +<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> + <%<%<%

    Hello <%= @resource.email %>!

    Your account has been locked due to an excessive number of unsuccessful sign in attempts.

    diff --git a/config/application.rb b/config/application.rb index 7c6b36e..1795a6f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + require_relative 'boot' require 'rails' diff --git a/config/boot.rb b/config/boot.rb index 988a5dd..4bebfef 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/config/environment.rb b/config/environment.rb index cac5315..49c0fb1 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Load the Rails application. require_relative "application" diff --git a/config/environments/development.rb b/config/environments/development.rb index 3cee377..232e88e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + require "active_support/core_ext/integer/time" Rails.application.configure do diff --git a/config/environments/production.rb b/config/environments/production.rb index e3f6d9b..4db7dca 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + require "active_support/core_ext/integer/time" Rails.application.configure do diff --git a/config/environments/test.rb b/config/environments/test.rb index 3ada93b..0982e19 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's diff --git a/config/importmap.rb b/config/importmap.rb index 909dfc5..7ec75cd 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Pin npm packages by running ./bin/importmap pin "application" diff --git a/config/initializers/acts_as_tenant.rb b/config/initializers/acts_as_tenant.rb index f6c78a8..fd8890d 100644 --- a/config/initializers/acts_as_tenant.rb +++ b/config/initializers/acts_as_tenant.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + ActsAsTenant.configure do |config| config.require_tenant = !Rails.env.test? end \ No newline at end of file diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 2eeef96..4772d1a 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. diff --git a/config/initializers/colors.rb b/config/initializers/colors.rb index 042a749..ea065fa 100644 --- a/config/initializers/colors.rb +++ b/config/initializers/colors.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + Chroma.define_palette :decreasing_saturation do spin(20).desaturate(40) spin(-20).desaturate(40) diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index b3076b3..8798db8 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Be sure to restart your server when you modify this file. # Define an application-wide content security policy. diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index a908920..ce186ed 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # config/initializers/cors.rb Rails.application.config.middleware.insert_before 0, Rack::Cors do diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index b407122..3977aa9 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # Assuming you have not yet modified this file, each configuration option below diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index c2d89e2..1be5be3 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Be sure to restart your server when you modify this file. # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 157a851..2a6b3c4 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index 7db3b95..f281e9b 100644 --- a/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # Be sure to restart your server when you modify this file. # Define an application-wide HTTP permissions policy. For further diff --git a/config/initializers/rswag_api.rb b/config/initializers/rswag_api.rb index c4462b2..42deb17 100644 --- a/config/initializers/rswag_api.rb +++ b/config/initializers/rswag_api.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + Rswag::Api.configure do |c| # Specify a root folder where Swagger JSON files are located diff --git a/config/initializers/rswag_ui.rb b/config/initializers/rswag_ui.rb index 30172aa..a50e133 100644 --- a/config/initializers/rswag_ui.rb +++ b/config/initializers/rswag_ui.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + Rswag::Ui.configure do |c| # List the Swagger endpoints that you want to be documented through the diff --git a/config/initializers/ruby_extensions.rb b/config/initializers/ruby_extensions.rb index 490dadf..47091de 100644 --- a/config/initializers/ruby_extensions.rb +++ b/config/initializers/ruby_extensions.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class Numeric def to_currency Money.from_amount(self, "EUR").format diff --git a/config/puma.rb b/config/puma.rb index afa809b..128df0b 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # This configuration file will be evaluated by Puma. The top-level methods that # are invoked here are part of Puma's configuration DSL. For more information # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. diff --git a/config/routes.rb b/config/routes.rb index 3f4685b..f53e7f1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + Rails.application.routes.draw do mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? get 'token' => 'tokens#show', as: :token diff --git a/db/migrate/20240711175425_create_expenses.rb b/db/migrate/20240711175425_create_expenses.rb index 63d0f2b..52fa269 100644 --- a/db/migrate/20240711175425_create_expenses.rb +++ b/db/migrate/20240711175425_create_expenses.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class CreateExpenses < ActiveRecord::Migration[7.1] def change create_enum :pricing_types, ["fixed", "per_person"] diff --git a/db/migrate/20240711180753_create_guests.rb b/db/migrate/20240711180753_create_guests.rb index 1280006..d2f876a 100644 --- a/db/migrate/20240711180753_create_guests.rb +++ b/db/migrate/20240711180753_create_guests.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class CreateGuests < ActiveRecord::Migration[7.1] def change create_table :guests, id: :uuid do |t| diff --git a/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb index 8b97ba6..f1709ca 100644 --- a/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181626_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 1) diff --git a/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb index ebd46fd..a1f7d1c 100644 --- a/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181627_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 2) diff --git a/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb index d17afe8..078b0c0 100644 --- a/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181628_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 3) diff --git a/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb index 52f696b..126aa38 100644 --- a/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181629_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 4) diff --git a/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb index 47fd928..fec8036 100644 --- a/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181630_change_collation_for_tag_names.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 5) diff --git a/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb index f5aaaf9..5f98782 100644 --- a/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181631_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 6) diff --git a/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb index b62b660..16fc678 100644 --- a/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb +++ b/db/migrate/20240711181632_add_tenant_to_taggings.acts_as_taggable_on_engine.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # This migration comes from acts_as_taggable_on_engine (originally 7) diff --git a/db/migrate/20240724181756_create_tables_arrangements.rb b/db/migrate/20240724181756_create_tables_arrangements.rb index c05f6dc..81defbc 100644 --- a/db/migrate/20240724181756_create_tables_arrangements.rb +++ b/db/migrate/20240724181756_create_tables_arrangements.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class CreateTablesArrangements < ActiveRecord::Migration[7.1] def change create_table :tables_arrangements, id: :uuid do |t| diff --git a/db/migrate/20240724181853_create_seats.rb b/db/migrate/20240724181853_create_seats.rb index 74f5b7b..a4fa0ae 100644 --- a/db/migrate/20240724181853_create_seats.rb +++ b/db/migrate/20240724181853_create_seats.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class CreateSeats < ActiveRecord::Migration[7.1] def change create_table :seats, id: :uuid do |t| diff --git a/db/migrate/20240811142121_create_groups.rb b/db/migrate/20240811142121_create_groups.rb index 0246978..cad993a 100644 --- a/db/migrate/20240811142121_create_groups.rb +++ b/db/migrate/20240811142121_create_groups.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class CreateGroups < ActiveRecord::Migration[7.1] def change create_table :groups, id: :uuid do |t| diff --git a/db/migrate/20240811143801_add_parent_to_group.rb b/db/migrate/20240811143801_add_parent_to_group.rb index 575af38..868ea79 100644 --- a/db/migrate/20240811143801_add_parent_to_group.rb +++ b/db/migrate/20240811143801_add_parent_to_group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class AddParentToGroup < ActiveRecord::Migration[7.1] def change add_reference :groups, :parent, type: :uuid, index: true, foreign_key: { to_table: :groups } diff --git a/db/migrate/20240811154115_add_group_to_guest.rb b/db/migrate/20240811154115_add_group_to_guest.rb index d4e2bd4..b7df5aa 100644 --- a/db/migrate/20240811154115_add_group_to_guest.rb +++ b/db/migrate/20240811154115_add_group_to_guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class AddGroupToGuest < ActiveRecord::Migration[7.1] def change add_reference :guests, :group, null: false, foreign_key: true, type: :uuid diff --git a/db/migrate/20240811170021_add_status_to_guest.rb b/db/migrate/20240811170021_add_status_to_guest.rb index cd7be5b..ec92086 100644 --- a/db/migrate/20240811170021_add_status_to_guest.rb +++ b/db/migrate/20240811170021_add_status_to_guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class AddStatusToGuest < ActiveRecord::Migration[7.1] def change add_column :guests, :status, :integer, default: 0 diff --git a/db/migrate/20241101181052_drop_taggable_tables.rb b/db/migrate/20241101181052_drop_taggable_tables.rb index 1759e6a..1ece831 100644 --- a/db/migrate/20241101181052_drop_taggable_tables.rb +++ b/db/migrate/20241101181052_drop_taggable_tables.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class DropTaggableTables < ActiveRecord::Migration[7.2] def change drop_table 'taggings', force: :cascade do |t| diff --git a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb index 7f38f58..1893200 100644 --- a/db/migrate/20241103072808_add_name_to_tables_arrangements.rb +++ b/db/migrate/20241103072808_add_name_to_tables_arrangements.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class AddNameToTablesArrangements < ActiveRecord::Migration[7.2] def change add_column :tables_arrangements, :name, :string, null: false diff --git a/db/migrate/20241103075705_solid_queue_install.rb b/db/migrate/20241103075705_solid_queue_install.rb index 4dfb4d0..fcd7627 100644 --- a/db/migrate/20241103075705_solid_queue_install.rb +++ b/db/migrate/20241103075705_solid_queue_install.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class SolidQueueInstall < ActiveRecord::Migration[7.2] def change create_table 'solid_queue_blocked_executions', force: :cascade do |t| diff --git a/db/migrate/20241103093955_remove_email_from_guests.rb b/db/migrate/20241103093955_remove_email_from_guests.rb index f09bced..cde2f00 100644 --- a/db/migrate/20241103093955_remove_email_from_guests.rb +++ b/db/migrate/20241103093955_remove_email_from_guests.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class RemoveEmailFromGuests < ActiveRecord::Migration[7.2] def change remove_column :guests, :email, :string diff --git a/db/migrate/20241103133122_add_color_to_group.rb b/db/migrate/20241103133122_add_color_to_group.rb index f73d988..a031638 100644 --- a/db/migrate/20241103133122_add_color_to_group.rb +++ b/db/migrate/20241103133122_add_color_to_group.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class AddColorToGroup < ActiveRecord::Migration[7.2] def change add_column :groups, :color, :string diff --git a/db/migrate/20241111063741_merge_guest_names.rb b/db/migrate/20241111063741_merge_guest_names.rb index 21cdfa6..3b2690c 100644 --- a/db/migrate/20241111063741_merge_guest_names.rb +++ b/db/migrate/20241111063741_merge_guest_names.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class MergeGuestNames < ActiveRecord::Migration[8.0] def change add_column :guests, :name, :string diff --git a/db/migrate/20241130095753_devise_create_users.rb b/db/migrate/20241130095753_devise_create_users.rb index bbe3837..efdddef 100644 --- a/db/migrate/20241130095753_devise_create_users.rb +++ b/db/migrate/20241130095753_devise_create_users.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true class DeviseCreateUsers < ActiveRecord::Migration[8.0] diff --git a/db/migrate/20241130182228_create_weddings.rb b/db/migrate/20241130182228_create_weddings.rb index c8cf1fd..857b63e 100644 --- a/db/migrate/20241130182228_create_weddings.rb +++ b/db/migrate/20241130182228_create_weddings.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class CreateWeddings < ActiveRecord::Migration[8.0] def change create_table :weddings, id: :uuid do |t| diff --git a/db/migrate/20241130185731_add_wedding_id_to_models.rb b/db/migrate/20241130185731_add_wedding_id_to_models.rb index 9f6d46a..85fbabf 100644 --- a/db/migrate/20241130185731_add_wedding_id_to_models.rb +++ b/db/migrate/20241130185731_add_wedding_id_to_models.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class AddWeddingIdToModels < ActiveRecord::Migration[8.0] def change [:expenses, :guests, :seats, :tables_arrangements, :groups, :users].each do |table| diff --git a/db/migrate/20241207112305_remove_wedding_date.rb b/db/migrate/20241207112305_remove_wedding_date.rb index 2176f55..5b2e987 100644 --- a/db/migrate/20241207112305_remove_wedding_date.rb +++ b/db/migrate/20241207112305_remove_wedding_date.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class RemoveWeddingDate < ActiveRecord::Migration[8.0] def change remove_column :weddings, :date, :date, null: false diff --git a/db/migrate/20241208102932_allow_ungrouped_guests.rb b/db/migrate/20241208102932_allow_ungrouped_guests.rb index e4bb19a..572a871 100644 --- a/db/migrate/20241208102932_allow_ungrouped_guests.rb +++ b/db/migrate/20241208102932_allow_ungrouped_guests.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class AllowUngroupedGuests < ActiveRecord::Migration[8.0] def change change_column_null :guests, :group_id, true diff --git a/db/migrate/20241216231415_create_group_affinities.rb b/db/migrate/20241216231415_create_group_affinities.rb index 1c6789d..22f86c5 100644 --- a/db/migrate/20241216231415_create_group_affinities.rb +++ b/db/migrate/20241216231415_create_group_affinities.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + class CreateGroupAffinities < ActiveRecord::Migration[8.0] disable_ddl_transaction! diff --git a/db/queue_schema.rb b/db/queue_schema.rb index 0cc657e..41a41b0 100644 --- a/db/queue_schema.rb +++ b/db/queue_schema.rb @@ -1,2 +1,4 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + ActiveRecord::Schema[7.1].define(version: 1) do end diff --git a/db/schema.rb b/db/schema.rb index 5e4178c..11aa68c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. diff --git a/db/seeds.rb b/db/seeds.rb index b0e69c5..fcf5ec3 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + NUMBER_OF_GUESTS = 50 ActsAsTenant.without_tenant do diff --git a/spec/extensions/tree_spec.rb b/spec/extensions/tree_spec.rb index 56de6f0..4b45e26 100644 --- a/spec/extensions/tree_spec.rb +++ b/spec/extensions/tree_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index 5624496..cec5134 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true FactoryBot.define do diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index 10a8d84..be308bd 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true FactoryBot.define do diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 1949d65..0cd9c48 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true FactoryBot.define do diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index 4f1f4f9..9efecdb 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true FactoryBot.define do diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb index e1eedad..e0c9cbb 100644 --- a/spec/factories/table_arrangement.rb +++ b/spec/factories/table_arrangement.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true FactoryBot.define do diff --git a/spec/factories/users.rb b/spec/factories/users.rb index bbc1dd0..edae51d 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true FactoryBot.define do diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index 3a2ff4c..8fa5a9c 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true FactoryBot.define do diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index 6c1797a..9a9a025 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/group_affinity_spec.rb b/spec/models/group_affinity_spec.rb index 00f053c..8afd2c6 100644 --- a/spec/models/group_affinity_spec.rb +++ b/spec/models/group_affinity_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 2b466dd..c55b081 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index 5db5f05..e1f7ad6 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/seat_spec.rb b/spec/models/seat_spec.rb index 44f157b..5648c2e 100644 --- a/spec/models/seat_spec.rb +++ b/spec/models/seat_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index a182e9e..96ff744 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 2140e5b..f066e79 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index e5b224e..77fae82 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index 46b09d2..f1c2c4f 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/queries/groups/summary_query_spec.rb b/spec/queries/groups/summary_query_spec.rb index 5c3fccd..6300724 100644 --- a/spec/queries/groups/summary_query_spec.rb +++ b/spec/queries/groups/summary_query_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index f5ed83c..faf5740 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # This file is copied to spec/ when you run 'rails generate rspec:install' diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index 4a23a8b..9f85d33 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/captcha_spec.rb b/spec/requests/captcha_spec.rb index 738f391..e3f49cf 100644 --- a/spec/requests/captcha_spec.rb +++ b/spec/requests/captcha_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index a912891..1f064d6 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index c06ed89..2e9d5ac 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index 6f588f4..0ecd72f 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index aa9d4e0..549834e 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module Swagger diff --git a/spec/requests/summary_spec.rb b/spec/requests/summary_spec.rb index 57417a7..d6a1f85 100644 --- a/spec/requests/summary_spec.rb +++ b/spec/requests/summary_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index d06f28d..4e87cb2 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/tokens_spec.rb b/spec/requests/tokens_spec.rb index f1bcd40..a6aac2e 100644 --- a/spec/requests/tokens_spec.rb +++ b/spec/requests/tokens_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb index 7758fa6..492f6f3 100644 --- a/spec/requests/users/confirmations_spec.rb +++ b/spec/requests/users/confirmations_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index 21f5f78..e55d4c8 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/requests/users/sessions_spec.rb b/spec/requests/users/sessions_spec.rb index 25fb0b7..60b49e1 100644 --- a/spec/requests/users/sessions_spec.rb +++ b/spec/requests/users/sessions_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'swagger_helper' diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index 19f836a..4524a1c 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/services/tables/distribution_spec.rb b/spec/services/tables/distribution_spec.rb index f84ae03..e598a52 100644 --- a/spec/services/tables/distribution_spec.rb +++ b/spec/services/tables/distribution_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/services/tables/shift_spec.rb b/spec/services/tables/shift_spec.rb index 248b3a2..39e07f8 100644 --- a/spec/services/tables/shift_spec.rb +++ b/spec/services/tables/shift_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/services/tables/swap_spec.rb b/spec/services/tables/swap_spec.rb index 1ad8857..d8db4a7 100644 --- a/spec/services/tables/swap_spec.rb +++ b/spec/services/tables/swap_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/services/vns/engine_spec.rb b/spec/services/vns/engine_spec.rb index 02acb5b..73d7b82 100644 --- a/spec/services/vns/engine_spec.rb +++ b/spec/services/vns/engine_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 409c64b..d405628 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true # This file was generated by the `rails generate rspec:install` command. Conventionally, all diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index ab24f93..5ba4cce 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index 964f4a9..09df9a1 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024-2025 LibreWeddingPlanner contributors + # frozen_string_literal: true module SwaggerResponseHelper From f414acb2d58d42a16d1cabdb46733be47c84ac00 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 25 Jan 2025 09:43:43 +0000 Subject: [PATCH 281/283] Test reversibility of migrations (#220) We want to make sure that: 1. Migrations are reversible 2. Reapplying migrations added to a PR leads to the same schema.rb Reviewed-on: https://gitea.bustikiller.com/bustikiller/wedding-planner/pulls/220 Co-authored-by: Manuel Bustillo Co-committed-by: Manuel Bustillo --- .gitea/workflows/build.yml | 46 ------- .gitea/workflows/copyright_notice.yml | 39 ------ .gitea/workflows/license_finder.yml | 21 --- .gitea/workflows/tests.yml | 123 +++++++++++++++++- app/views/layouts/mailer.html.erb | 4 +- app/views/layouts/mailer.text.erb | 4 +- .../mailer/confirmation_instructions.html.erb | 4 +- app/views/users/mailer/email_changed.html.erb | 4 +- .../users/mailer/password_change.html.erb | 4 +- .../reset_password_instructions.html.erb | 4 +- .../users/mailer/unlock_instructions.html.erb | 4 +- db/schema.rb | 4 +- 12 files changed, 134 insertions(+), 127 deletions(-) delete mode 100644 .gitea/workflows/build.yml delete mode 100644 .gitea/workflows/copyright_notice.yml delete mode 100644 .gitea/workflows/license_finder.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml deleted file mode 100644 index 5748059..0000000 --- a/.gitea/workflows/build.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Build Nginx-based docker image -on: - push: - branches: - - main - pull_request: -concurrency: - group: ${{ github.ref }} - cancel-in-progress: true -jobs: - build-static-assets: - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to the private Docker registry - uses: docker/login-action@v3 - with: - registry: ${{ secrets.PRIVATE_REGISTRY_HOST }} - username: ${{ secrets.PRIVATE_REGISTRY_USERNAME }} - password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }} - - - name: Build and push intermediate stages (build) - uses: docker/build-push-action@v6 - with: - context: . - target: build - push: ${{ github.ref == 'refs/heads/main' }} - tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build - cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build - cache-to: type=inline - - - name: Build and push (final) - uses: docker/build-push-action@v6 - with: - context: . - push: ${{ github.ref == 'refs/heads/main' }} - tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest - cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest - cache-to: type=inline \ No newline at end of file diff --git a/.gitea/workflows/copyright_notice.yml b/.gitea/workflows/copyright_notice.yml deleted file mode 100644 index c362a23..0000000 --- a/.gitea/workflows/copyright_notice.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Add copyright notice -on: - pull_request: -permissions: - contents: write -concurrency: - group: ${{ github.ref }} - cancel-in-progress: true -jobs: - copyright_notice: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - token: ${{ secrets.ACTIONS_TOKEN }} - ref: ${{ github.head_ref }} - - uses: VinnyBabuManjaly/copyright-action@v1.0.0 - with: - CopyrightString: '# Copyright (C) 2024-2025 LibreWeddingPlanner contributors\n\n' - FileType: '.rb' - Path: 'app/, config/, db/, spec/' - - uses: VinnyBabuManjaly/copyright-action@v1.0.0 - with: - CopyrightString: '<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %>\n\n' - FileType: '.erb' - Path: 'app/' - - name: Commit changes - run: | - git config --local user.email "bustikiller@bustikiller.com" - git config --local user.name "Manuel Bustillo" - git add . - - if [ -n "$(git status --porcelain)" ]; then - echo "there are changes"; - git commit -m "Add copyright notice" - git push - else - echo "no changes"; - fi diff --git a/.gitea/workflows/license_finder.yml b/.gitea/workflows/license_finder.yml deleted file mode 100644 index 6e21f6e..0000000 --- a/.gitea/workflows/license_finder.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Check usage of free licenses -on: - push: - branches: - - main - pull_request: -concurrency: - group: ${{ github.ref }} - cancel-in-progress: true -jobs: - check-licenses: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - uses: ruby/setup-ruby@v1.207.0 - - name: Install project dependencies - run: bundle install --jobs `getconf _NPROCESSORS_ONLN` - - name: Run license finder - run: license_finder diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index 886fce3..9c53589 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -10,7 +10,7 @@ concurrency: jobs: unit_tests: runs-on: ubuntu-latest - services: + services: &services postgres: image: postgres env: @@ -22,10 +22,11 @@ jobs: - uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} + ref: ${{ github.head_ref }} # Checkout the actual branch, not the result if merged into the base - uses: ruby/setup-ruby@v1.207.0 - run: bundle install - - run: bundle exec rubocop --force-exclusion --parallel - - name: Wait until Postgres is ready to accept connections + - &postgres_wait + name: Wait until Postgres is ready to accept connections run: | apt-get update && apt-get install -f -y postgresql-client until pg_isready -h postgres -U postgres -d postgres @@ -33,12 +34,126 @@ jobs: sleep 1 echo "Trying again" done - - run: | + - name: Load schema and run unit tests + run: | bundle exec rake db:schema:load bundle exec rspec env: RAILS_ENV: test DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres + - name: Get all migrations added + id: changed-migration-files + uses: tj-actions/changed-files@v45 + with: + files: | + db/migrate/**.rb + - name: Redo all migrations and check there are no schema changes + if: steps.changed-migration-files.outputs.any_changed == 'true' + env: + ALL_CHANGED_FILES: ${{ steps.changed-migration-files.outputs.all_changed_files }} + RAILS_ENV: test + DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres + run: | + echo ${#ALL_CHANGED_FILES[@]} migrations changed: + for file in ${ALL_CHANGED_FILES}; do + echo "$file" + done + + bundle exec rake db:migrate:redo STEP=${#ALL_CHANGED_FILES[@]} + git diff --exit-code db/schema.rb - name: Clean up containers generated by this flow if: failure() run: docker ps --filter network=$JOB_CONTAINER_NAME-$GITHUB_JOB-network --filter name=$JOB_CONTAINER_NAME-* --format "{{.ID}}" | xargs docker rm -f + rubocop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - uses: ruby/setup-ruby@v1.207.0 + - run: bundle install + - run: bundle exec rubocop --force-exclusion --parallel + check-licenses: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - uses: ruby/setup-ruby@v1.207.0 + - name: Install project dependencies + run: bundle install --jobs `getconf _NPROCESSORS_ONLN` + - name: Run license finder + run: license_finder + copyright_notice: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.ACTIONS_TOKEN }} + ref: ${{ github.head_ref }} + - uses: VinnyBabuManjaly/copyright-action@v1.0.0 + with: + CopyrightString: '# Copyright (C) 2024-2025 LibreWeddingPlanner contributors\n\n' + FileType: '.rb' + Path: 'app/, config/, db/, spec/' + IgnorePath: 'db' + - uses: VinnyBabuManjaly/copyright-action@v1.0.0 + with: + CopyrightString: '<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>\n\n' + FileType: '.erb' + Path: 'app/' + - name: Commit changes + run: | + git config --local user.email "bustikiller@bustikiller.com" + git config --local user.name "Manuel Bustillo" + git add . + + if [ -n "$(git status --porcelain)" ]; then + echo "there are changes"; + git commit -m "Add copyright notice" + git push + else + echo "no changes"; + fi + + build-static-assets: + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: + - unit_tests + - rubocop + - check-licenses + - copyright_notice + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to the private Docker registry + uses: docker/login-action@v3 + with: + registry: ${{ secrets.PRIVATE_REGISTRY_HOST }} + username: ${{ secrets.PRIVATE_REGISTRY_USERNAME }} + password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }} + + - name: Build and push intermediate stages (build) + uses: docker/build-push-action@v6 + with: + context: . + target: build + push: ${{ github.ref == 'refs/heads/main' }} + tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build + cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build + cache-to: type=inline + + - name: Build and push (final) + uses: docker/build-push-action@v6 + with: + context: . + push: ${{ github.ref == 'refs/heads/main' }} + tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest + cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest + cache-to: type=inline \ No newline at end of file diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index a8eafc7..32b0c16 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -1,6 +1,6 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> -<%<%<% + diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb index 0769757..9bdce1a 100644 --- a/app/views/layouts/mailer.text.erb +++ b/app/views/layouts/mailer.text.erb @@ -1,3 +1,3 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> -<%<%<%<%= yield %> +<%= yield %> diff --git a/app/views/users/mailer/confirmation_instructions.html.erb b/app/views/users/mailer/confirmation_instructions.html.erb index f477218..cd3b2f1 100644 --- a/app/views/users/mailer/confirmation_instructions.html.erb +++ b/app/views/users/mailer/confirmation_instructions.html.erb @@ -1,6 +1,6 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> -<%<%<%

    Welcome <%= @email %>!

    +

    Welcome <%= @email %>!

    You can confirm your account email through the link below:

    diff --git a/app/views/users/mailer/email_changed.html.erb b/app/views/users/mailer/email_changed.html.erb index 0e68a0a..f5f2998 100644 --- a/app/views/users/mailer/email_changed.html.erb +++ b/app/views/users/mailer/email_changed.html.erb @@ -1,6 +1,6 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> -<%<%<%

    Hello <%= @email %>!

    +

    Hello <%= @email %>!

    <% if @resource.try(:unconfirmed_email?) %>

    We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.

    diff --git a/app/views/users/mailer/password_change.html.erb b/app/views/users/mailer/password_change.html.erb index bf4de87..1181727 100644 --- a/app/views/users/mailer/password_change.html.erb +++ b/app/views/users/mailer/password_change.html.erb @@ -1,5 +1,5 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> -<%<%<%

    Hello <%= @resource.email %>!

    +

    Hello <%= @resource.email %>!

    We're contacting you to notify you that your password has been changed.

    diff --git a/app/views/users/mailer/reset_password_instructions.html.erb b/app/views/users/mailer/reset_password_instructions.html.erb index 0499866..95bc588 100644 --- a/app/views/users/mailer/reset_password_instructions.html.erb +++ b/app/views/users/mailer/reset_password_instructions.html.erb @@ -1,6 +1,6 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> -<%<%<%

    Hello <%= @resource.email %>!

    +

    Hello <%= @resource.email %>!

    Someone has requested a link to change your password. You can do this through the link below.

    diff --git a/app/views/users/mailer/unlock_instructions.html.erb b/app/views/users/mailer/unlock_instructions.html.erb index b59cb33..3efb341 100644 --- a/app/views/users/mailer/unlock_instructions.html.erb +++ b/app/views/users/mailer/unlock_instructions.html.erb @@ -1,6 +1,6 @@ -<%# Copyright (C) 22024-2025 LibreWeddingPlanner contributors %> +<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %> -<%<%<%

    Hello <%= @resource.email %>!

    +

    Hello <%= @resource.email %>!

    Your account has been locked due to an excessive number of unsuccessful sign in attempts.

    diff --git a/db/schema.rb b/db/schema.rb index 11aa68c..10ab0cd 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024-2025 LibreWeddingPlanner contributors - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -39,7 +37,7 @@ ActiveRecord::Schema[8.0].define(version: 2024_12_16_231415) do t.index "LEAST(group_a_id, group_b_id), GREATEST(group_a_id, group_b_id)", name: "uindex_group_pair", unique: true t.index ["group_a_id"], name: "index_group_affinities_on_group_a_id" t.index ["group_b_id"], name: "index_group_affinities_on_group_b_id" - t.check_constraint "discomfort >= 0::double precision AND discomfort <= 2::double precision" + t.check_constraint "discomfort >= 0::double precision AND discomfort <= 2::double precision", name: "check_valid_discomfort" t.check_constraint "group_a_id <> group_b_id", name: "check_distinct_groups" end From 2147d7ad5e082e161fff84775ea6b2695dc95f69 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 26 Jan 2025 12:53:21 +0000 Subject: [PATCH 282/283] Redo simulations lifecycle (#222) ## Why The current way of creating and deleting simulations doesn't scale for big instances. We cannot generate 50 simulations every time a guest confirms attendance, and we should not delete existing valuable simulations. For example, if a guest confirms attendance and declines right after, previously generated simulations should still be valid. ## What In this PR we are introducing a series of changes that make simulations management easier: 1. We're removing the automatic creation of simulations. 2. Simulations are not removed anymore, neither manually nor automatically. 3. A new endpoint has been defined to create simulations on demand. 4. A digest property has been defined to determine whether a simulation is still valid (meaning there have not been any change in the list of guests involved). Reviewed-on: https://gitea.bustikiller.com/bustikiller/wedding-planner/pulls/222 Co-authored-by: Manuel Bustillo Co-committed-by: Manuel Bustillo --- .../tables_arrangements_controller.rb | 16 +++++++++++++++- app/models/guest.rb | 11 ----------- app/models/tables_arrangement.rb | 1 + app/models/wedding.rb | 2 ++ app/services/tables/distribution.rb | 13 +++++++++++-- config/routes.rb | 2 +- ...uests_digest_column_to_tables_arrangements.rb | 5 +++++ db/schema.rb | 3 ++- spec/requests/tables_arrangements_spec.rb | 16 +++++++++++++++- 9 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 db/migrate/20250126091823_add_guests_digest_column_to_tables_arrangements.rb diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index c09d453..45cf633 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -4,7 +4,15 @@ class TablesArrangementsController < ApplicationController def index - render json: TablesArrangement.order(discomfort: :asc).limit(3).as_json(only: %i[id name discomfort]) + current_digest = Tables::Distribution.digest(current_tenant) + + render json: TablesArrangement + .order(valid: :desc) + .order(discomfort: :asc) + .select(:id, :name, :discomfort) + .select("digest = '#{current_digest}'::uuid as valid") + .limit(20) + .as_json(only: %i[id name discomfort valid]) end def show @@ -16,6 +24,12 @@ class TablesArrangementsController < ApplicationController .then { |result| render json: { id: params[:id], tables: result } } end + def create + TableSimulatorJob.perform_later(current_tenant.id) + + render json: {}, status: :created + end + private def format(number:, guests:) diff --git a/app/models/guest.rb b/app/models/guest.rb index ad0542f..d080679 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -41,16 +41,5 @@ class Guest < ApplicationRecord scope :potential, -> { where.not(status: %i[declined considered]) } - after_destroy :recalculate_simulations - after_save :recalculate_simulations, if: :saved_change_to_status? - has_many :seats, dependent: :delete_all - - private - - def recalculate_simulations - TablesArrangement.delete_all - - ActiveJob.perform_all_later(50.times.map { TableSimulatorJob.new(wedding_id) }) - end end diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index adece9a..a461555 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -7,6 +7,7 @@ # Table name: tables_arrangements # # id :uuid not null, primary key +# digest :uuid not null # discomfort :integer # name :string not null # created_at :datetime not null diff --git a/app/models/wedding.rb b/app/models/wedding.rb index 83525b5..5f0dabf 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -19,4 +19,6 @@ class Wedding < ApplicationRecord SLUG_REGEX = /[a-z\d-]+/ validates :slug, presence: true, uniqueness: true, format: { with: /\A#{SLUG_REGEX}\z/ } + + has_many :guests, dependent: :delete_all end diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 87dccb0..cc51308 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -6,7 +6,13 @@ require_relative '../../extensions/tree_node_extension' module Tables class Distribution - attr_accessor :tables, :min_per_table, :max_per_table + class << self + def digest(wedding) + Digest::UUID.uuid_v5(wedding.id, wedding.guests.potential.order(:id).pluck(:id).join) + end + end + + attr_accessor :tables, :min_per_table, :max_per_table, :hierarchy def initialize(min_per_table:, max_per_table:) @min_per_table = min_per_table @@ -54,7 +60,10 @@ module Tables Seat.insert_all!(records_to_store) - arrangement.update!(discomfort:) + arrangement.update!( + discomfort:, + digest: self.class.digest(tables.first.first.wedding) + ) end end diff --git a/config/routes.rb b/config/routes.rb index f53e7f1..39d0460 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -37,7 +37,7 @@ Rails.application.routes.draw do resources :expenses, only: %i[index create update destroy] do get :summary, on: :collection end - resources :tables_arrangements, only: %i[index show] + resources :tables_arrangements, only: %i[index show create] resources :summary, only: :index root to: redirect("/%{slug}") diff --git a/db/migrate/20250126091823_add_guests_digest_column_to_tables_arrangements.rb b/db/migrate/20250126091823_add_guests_digest_column_to_tables_arrangements.rb new file mode 100644 index 0000000..34a500b --- /dev/null +++ b/db/migrate/20250126091823_add_guests_digest_column_to_tables_arrangements.rb @@ -0,0 +1,5 @@ +class AddGuestsDigestColumnToTablesArrangements < ActiveRecord::Migration[8.0] + def change + add_column :tables_arrangements, :digest, :uuid, null: false, default: 'gen_random_uuid()' + end +end diff --git a/db/schema.rb b/db/schema.rb index 10ab0cd..5b61f3f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2024_12_16_231415) do +ActiveRecord::Schema[8.0].define(version: 2025_01_26_091823) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -206,6 +206,7 @@ ActiveRecord::Schema[8.0].define(version: 2024_12_16_231415) do t.datetime "updated_at", null: false t.string "name", null: false t.uuid "wedding_id", null: false + t.uuid "digest", default: -> { "gen_random_uuid()" }, null: false t.index ["wedding_id"], name: "index_tables_arrangements_on_wedding_id" end diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index 4e87cb2..3cc11c1 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -18,13 +18,27 @@ RSpec.describe 'tables_arrangements' do properties: { id: { type: :string, format: :uuid }, name: { type: :string }, - discomfort: { type: :integer } + discomfort: { type: :integer }, + valid: { type: :boolean } } } xit end regular_api_responses end + + post('create tables arrangement') do + tags 'Tables Arrangements' + produces 'application/json' + parameter Swagger::Schema::SLUG + response(201, 'successful') do + schema type: :object, + required: [], + properties: {} + xit + end + regular_api_responses + end end path '/{slug}/tables_arrangements/{id}' do From 567093c4498947012ad25d5df7e0efa2ac7313b5 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 27 Jan 2025 03:05:19 +0000 Subject: [PATCH 283/283] Update dependency rubocop-rails to v2.29.1 --- Gemfile.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index aa35e4c..7c365c5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -94,7 +94,7 @@ GEM logger (~> 1.5) chroma (0.2.0) coderay (1.1.3) - concurrent-ruby (1.3.4) + concurrent-ruby (1.3.5) connection_pool (2.4.1) crass (1.0.6) csv (3.3.2) @@ -130,7 +130,7 @@ GEM csv mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - i18n (1.14.6) + i18n (1.14.7) concurrent-ruby (~> 1.0) importmap-rails (2.1.0) actionpack (>= 6.0.0) @@ -343,7 +343,7 @@ GEM parser (>= 3.3.1.0) rubocop-factory_bot (2.26.1) rubocop (~> 1.61) - rubocop-rails (2.29.0) + rubocop-rails (2.29.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.52.0, < 2.0) @@ -481,7 +481,7 @@ CHECKSUMS childprocess (5.1.0) sha256=9a8d484be2fd4096a0e90a0cd3e449a05bc3aa33f8ac9e4d6dcef6ac1455b6ec chroma (0.2.0) sha256=64bdcd36a4765fbcd45adc64960cc153101300b4918f90ffdd89f4e2eb954b54 coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b - concurrent-ruby (1.3.4) sha256=d4aa926339b0a86b5b5054a0a8c580163e6f5dcbdfd0f4bb916b1a2570731c32 + concurrent-ruby (1.3.5) sha256=813b3e37aca6df2a21a3b9f1d497f8cbab24a2b94cab325bffe65ee0f6cbebc6 connection_pool (2.4.1) sha256=0f40cf997091f1f04ff66da67eabd61a9fe0d4928b9a3645228532512fab62f4 crass (1.0.6) sha256=dc516022a56e7b3b156099abc81b6d2b08ea1ed12676ac7a5657617f012bd45d csv (3.3.2) sha256=6ff0c135e65e485d1864dde6c1703b60d34cc9e19bed8452834a0b28a519bd4e @@ -499,7 +499,7 @@ CHECKSUMS fugit (1.11.1) sha256=e89485e7be22226d8e9c6da411664d0660284b4b1c08cacb540f505907869868 globalid (1.2.1) sha256=70bf76711871f843dbba72beb8613229a49429d1866828476f9c9d6ccc327ce9 httparty (0.22.0) sha256=78652a5c9471cf0093d3b2083c2295c9c8f12b44c65112f1846af2b71430fa6c - i18n (1.14.6) sha256=dc229a74f5d181f09942dd60ab5d6e667f7392c4ee826f35096db36d1fe3614c + i18n (1.14.7) sha256=ceba573f8138ff2c0915427f1fc5bdf4aa3ab8ae88c8ce255eb3ecf0a11a5d0f importmap-rails (2.1.0) sha256=9f10c67d60651a547579f448100d033df311c5d5db578301374aeb774faae741 io-console (0.8.0) sha256=cd6a9facbc69871d69b2cb8b926fc6ea7ef06f06e505e81a64f14a470fddefa2 irb (1.14.3) sha256=c457f1f2f1438ae9ce5c5be3981ae2138dec7fb894c7d73777eeeb0a6c0d0752 @@ -581,7 +581,7 @@ CHECKSUMS rubocop (1.71.0) sha256=e19679efd447346ac476122313d3788ae23c38214790bcf660e984c747608bf0 rubocop-ast (1.37.0) sha256=9513ac88aaf113d04b52912533ffe46475de1362d4aa41141b51b2455827c080 rubocop-factory_bot (2.26.1) sha256=8de13cd4edcee5ca800f255188167ecef8dbfc3d1fae9f15734e9d2e755392aa - rubocop-rails (2.29.0) sha256=35bffd140c80671453aafac0e2d5ab5b3dd65736a3fc8f3936ccca226b89c234 + rubocop-rails (2.29.1) sha256=41c2fcf48d5d62f4a5f574d5f1c97bbaf4cba88ee367936c98b3422d047b17aa rubocop-rspec (3.4.0) sha256=8721c13b6a8c9530a7ac481cea9423022f946fcf72428bda8289f8b57e4d4885 rubocop-rspec_rails (2.30.0) sha256=888112e83f9d7ef7ad2397e9d69a0b9614a4bae24f072c399804a180f80c4c46 ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33