From c37b7f1870dbc774ebbad00d5d9ea3bbe30b721f Mon Sep 17 00:00:00 2001 From: Guido de Jong <35309288+guidojw@users.noreply.github.com> Date: Tue, 14 Nov 2023 10:52:46 +0100 Subject: [PATCH 1/8] refactor(cleanup-registry): use new action (#889) --- .github/workflows/cleanup-registry.yml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cleanup-registry.yml b/.github/workflows/cleanup-registry.yml index ba90d6107..32b82f8df 100644 --- a/.github/workflows/cleanup-registry.yml +++ b/.github/workflows/cleanup-registry.yml @@ -5,20 +5,14 @@ on: - cron: '0 0 * * 1' # https://crontab.guru/#0_0_*_*_1 workflow_dispatch: -env: - IMAGE_NAMES: sofia - jobs: cleanup: name: Cleanup runs-on: ubuntu-latest steps: - - name: Delete old versions - uses: snok/container-retention-policy@f617f1ca161a52bce48417eedd76924e71d0b4d9 # v2.1.0 + - name: Delete untagged images + uses: actions/delete-package-versions@0d39a63126868f5eefaa47169615edd3c0f61e20 # v4.1.1 with: - image-names: ${{ env.IMAGE_NAMES }} - cut-off: 2 days ago UTC - account-type: org - org-name: ${{ github.repository_owner }} - skip-tags: latest,staging - token: ${{ secrets.GH_PAT }} + package-name: ${{ github.event.repository.name }} + package-type: container + delete-only-untagged-versions: true From 34c05edd9ff4f1aadb094539caf99d7b7b34d77a Mon Sep 17 00:00:00 2001 From: Ellen Wittingen <101463776+Ellen-Wittingen@users.noreply.github.com> Date: Wed, 20 Dec 2023 13:22:10 +0100 Subject: [PATCH 2/8] Fixed error in mailing invoices (#898) --- app/mailers/invoice_mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mailers/invoice_mailer.rb b/app/mailers/invoice_mailer.rb index 6db7ee09d..83f7775ca 100644 --- a/app/mailers/invoice_mailer.rb +++ b/app/mailers/invoice_mailer.rb @@ -6,7 +6,7 @@ def invoice_mail(invoice) # rubocop:disable Metrics/AbcSize @cab_text = 'iDeal betaling' attachments["#{invoice.human_id}.pdf"] = WickedPdf.new.pdf_from_string( - render_to_string(pdf: invoice.human_id.to_s, template: 'invoices/show.html.erb', layout: 'pdf.html.erb') + render_to_string(pdf: invoice.human_id.to_s, template: 'invoices/show', layout: 'pdf') ) mail to: @invoice.email, subject: "Factuur #{invoice.human_id} #{Rails.application.config.x.company_name}" From 30370edf2c0f7fda83988f4aa56510c95d8ff25c Mon Sep 17 00:00:00 2001 From: DrumsnChocolate Date: Wed, 20 Dec 2023 14:48:50 +0100 Subject: [PATCH 3/8] fix host for staging --- config/credentials.yml.enc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc index 49d52e817..a439292ca 100644 --- a/config/credentials.yml.enc +++ b/config/credentials.yml.enc @@ -1 +1 @@ -1LhpMWiMRisfwMfJQ1iWl2U6cGoAUMpMsJNjdOuuKHX0EmmRGDmndzztLtetAechXLtEYrvZLo2xOWc2W+1uJ3keu77KvuoRbb3CCGDtNGSlLpISXO6+fTRdIRFu1KUK966Cg2quNlYGLQCMESNWMXMG6vv/SY7A2H86aLgi3vLixl9KtXdyH4E3fDeOpC53xkCV3QduNh8ljiOoeA4Ha4IsxtXbqaD0o923ncAtMbI+p3XeoZXauTsv2ZWJv/K5fhUAmbNDn/s+MiZCvViLkw+COXZGd1yU6Wl2FQB0I1q4+w49s4BnvYxvXmTZ+uUfrmcdGIVmyiJaJxAR21AvgnFUKz8WpeRY8+c6cGu6Tal55tTD6wsVtyp2mblhzAealdA3bEXaMijPkAoSdIiaD7nhGsQiNyPQ1XV9sMbwfwwuEWu7maGFYJnQrabIwawO0JNdEJoOQnGNJcAx/VdmxEgvdBVR5X1CQM8fFxYhSclAVKNIPDxS36RB84O7I3UafXhKPVGVaoYB3GPpvtgmv2Er3r28udjilKWUWoAKN8Levc9YKnL65jjPNh1n1gzq/3imYzbyunW+aajFB+3kjBcAgAdCAZ3HITHv8uzmQyYaBaaWhtkGm811ubNGlB3+qJQqvUWIKH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VL9eM39n5PiLkbnUQQp4QFNTi4+DMQ+46Ii2i1CJ0KhbHYGaj1R8QO0E7K2VyBCwCIts1b2qHfE3mOXMe/gx15ePWdUu5gnsJl2jiguvHIwPNL07eQcoFHw6a7aFgP6veUc6JPNhjslG9DoQ3Ptfw5Wub1DsUXjDjkUjNbaYg7FmcX7+sq5NXRAQPCLQ89h7H2baN9/3e2mf6dYMcV/L6SfA/tL/tZss6X6e7Zbp+js/977LvzdCoVe4fxpt9MEUJFM6P1M3ySfNIepnea5iAyEuc9oHHo8sLVM4+W4BoCeGRfb4XGE9Bp0je1jjXx4wDIlgdBK+rlUdH/Tsp0HMu/3414XpH1AynniONwbeMUeQo/2Q==--wal5s2ON5sIFV3HO--8BHpOTpImp88t8fHSJI1Pg== \ No newline at end of file From 7b1df9547ae6c456d867ae312a2ee95b7789eb89 Mon Sep 17 00:00:00 2001 From: Wilco Date: Thu, 4 Jan 2024 22:07:55 +0100 Subject: [PATCH 4/8] Add env for lux ad mosam (#882) * Add env for lux ad mosam * Add missing env variable * Resolve comments * Fix formatting Co-authored-by: Guido de Jong <35309288+guidojw@users.noreply.github.com> * Resolve comments * Fix usage of codes from env, add low alcohol and whiskey category * Add env variable for treasurer title * Remove vscode config * Add low alcohol beer * Add low alcohol beer --------- Co-authored-by: Guido de Jong <35309288+guidojw@users.noreply.github.com> --- .env.example | 4 +++ .github/workflows/continuous-delivery.yml | 26 +++++++++++++++-- .rubocop.yml | 1 + Dockerfile | 4 +-- .../credit_mutations_controller.rb | 2 +- app/controllers/payments_controller.rb | 16 ++++++++--- app/controllers/users_controller.rb | 2 +- .../credit_insufficient_notification_job.rb | 4 +-- app/jobs/payment_poll_job.rb | 2 +- app/mailers/invoice_mailer.rb | 10 +++++-- app/models/product.rb | 5 ++-- app/models/role.rb | 2 +- app/policies/payment_policy.rb | 12 +++++--- .../activities/_cannot_order_modal.html.erb | 2 +- app/views/activities/show.html.erb | 28 ++++++++++--------- app/views/invoice_mailer/invoice_mail.erb | 3 +- app/views/invoices/show.html.erb | 14 ++++++---- app/views/layouts/mailer.html.erb | 2 +- app/views/partials/_navigation_bar.html.erb | 12 ++++---- app/views/partials/_sofia_quote.html.erb | 2 +- app/views/price_lists/index.html.erb | 6 ++-- app/views/users/show.html.erb | 14 +++++++--- babel.config.js | 4 +-- config/application.rb | 28 +++++++++++-------- config/cable.yml | 3 ++ config/credentials.yml.enc | 2 +- config/database.yml | 3 ++ config/deploy.rb | 4 +++ config/environments/luxproduction.rb | 6 ++++ config/initializers/sentry.rb | 2 +- config/locales/nl.yml | 15 ++-------- config/webpack/loaders/eslint.js | 2 +- config/webpack/luxproduction.js | 5 ++++ config/webpacker.yml | 4 +++ db/seeds/products.rb | 12 +++++++- spec/factories/product.rb | 2 +- spec/models/product_spec.rb | 2 +- spec/models/role_spec.rb | 2 +- spec/rails_helper.rb | 2 +- 39 files changed, 180 insertions(+), 91 deletions(-) create mode 100644 config/environments/luxproduction.rb create mode 100644 config/webpack/luxproduction.js diff --git a/.env.example b/.env.example index 80ab17aa5..f98c69fb8 100644 --- a/.env.example +++ b/.env.example @@ -12,6 +12,7 @@ AMBER_CLIENT_SECRET= FROM_EMAIL=noreply@societeitflux.nl ICT_EMAIL=ict@csvalpha.nl ADMIN_EMAIL=streepsysteem@societeitflux.nl +TREASURER_TITLE=penningmeester TREASURER_EMAIL=penningmeester@societeitflux.nl TREASURER_NAME= TREASURER_PHONE= @@ -28,12 +29,15 @@ COMPANY_KVK=41 032 169 SITE_NAME=S.O.F.I.A. SITE_SHORT_NAME=SOFIA +SITE_LONG_NAME=Streepsysteem voor de Ordentelijke Festiviteiten van Inleggend Alpha SITE_ASSOCIATION=C.S.V. Alpha CODE_BEER=8010 +CODE_LOW_ALCOHOL_BEER=8011 CODE_CRAFT_BEER=8015 CODE_NON_ALCOHOLIC=8020 CODE_DISTILLED=8030 +CODE_WHISKEY=8035 CODE_WINE=8040 CODE_FOOD=8050 CODE_TOBACCO=8060 diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 441795fa2..738ed981c 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -7,6 +7,13 @@ on: description: Merge staging into master first? (y/N) required: false default: 'n' + target_env: + type: choice + description: Target environment + options: + - csvalpha + - luxadmosam + default: 'csvalpha' concurrency: group: cd-${{ github.ref_name }} @@ -20,11 +27,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Validate branch + env: + TARGET_ENV: ${{ github.event.inputs.target_env }} run: | if [ "$GITHUB_REF_NAME" != 'staging' ] && [ "$GITHUB_REF_NAME" != 'master' ]; then echo 'This workflow can only be run on branches staging and master.' exit 1 fi + if [ "$TARGET_ENV" == 'luxadmosam' ] && [ "$GITHUB_REF_NAME" != 'master' ]; then + echo 'Only the master branch can be deployed to Lux ad Mosam.' + exit 1 + fi metadata: name: Metadata @@ -41,6 +54,7 @@ jobs: id: get_metadata env: INPUT_MERGE: ${{ github.event.inputs.merge }} + TARGET_ENV: ${{ github.event.inputs.target_env }} run: | if [ "$GITHUB_REF_NAME" = 'master' ]; then if [ "${INPUT_MERGE,,}" = 'y' ]; then @@ -52,7 +66,11 @@ jobs: fi fi - echo 'stage=production' >> "$GITHUB_OUTPUT" + if [ "$TARGET_ENV" == 'luxadmosam' ]; then + echo 'stage=luxproduction' >> "$GITHUB_OUTPUT" + else + echo 'stage=production' >> "$GITHUB_OUTPUT" + fi else echo 'stage=staging' >> "$GITHUB_OUTPUT" fi @@ -130,8 +148,12 @@ jobs: steps: - name: Get environment URL id: get_url + env: + TARGET_ENV: ${{ github.event.inputs.target_env }} run: | - if [ "$GITHUB_REF_NAME" = 'master' ]; then + if [ "$TARGET_ENV" == 'luxadmosam' ] && [ "$GITHUB_REF_NAME" = 'master' ]; then + echo 'environment_url=https://luxstreep.csvalpha.nl' >> "$GITHUB_OUTPUT" + elif [ "$GITHUB_REF_NAME" = 'master' ]; then echo 'environment_url=https://streep.csvalpha.nl' >> "$GITHUB_OUTPUT" else echo 'environment_url=https://stagingstreep.csvalpha.nl' >> "$GITHUB_OUTPUT" diff --git a/.rubocop.yml b/.rubocop.yml index 29bf50a25..7e692d4f3 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -22,6 +22,7 @@ AllCops: Rails/UnknownEnv: Environments: - production + - luxproduction - development - test - staging diff --git a/Dockerfile b/Dockerfile index fa8dec243..c43ecb67e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ ARG RAILS_MASTER_KEY # Pre-install gems, so that they can be cached. COPY Gemfile* /app/ -RUN if [ "$RAILS_ENV" = 'production' ] || [ "$RAILS_ENV" = 'staging' ]; then \ +RUN if [ "$RAILS_ENV" = 'production' ] || [ "$RAILS_ENV" = 'staging' ] || [ "$RAILS_ENV" = 'luxproduction' ]; then \ bundle config set --local without 'development test'; \ else \ bundle config set --local without 'development'; \ @@ -44,7 +44,7 @@ COPY . /app/ # Precompile assets after copying app because whole Rails pipeline is needed. RUN --mount=type=secret,id=rails_master_key \ - if [ "$RAILS_ENV" = 'production' ] || [ "$RAILS_ENV" = 'staging' ]; then \ + if [ "$RAILS_ENV" = 'production' ] || [ "$RAILS_ENV" = 'staging' ] || [ "$RAILS_ENV" = 'luxproduction' ]; then \ # Use secret if RAILS_MASTER_KEY build arg is not set. RAILS_MASTER_KEY="${RAILS_MASTER_KEY:-$(cat /run/secrets/rails_master_key)}" bundle exec rails assets:precompile; \ else \ diff --git a/app/controllers/credit_mutations_controller.rb b/app/controllers/credit_mutations_controller.rb index 17bba8bbf..4ed43df97 100644 --- a/app/controllers/credit_mutations_controller.rb +++ b/app/controllers/credit_mutations_controller.rb @@ -17,7 +17,7 @@ def create # rubocop:disable Metrics/MethodLength, Metrics/AbcSize respond_to do |format| if @mutation.save - NewCreditMutationNotificationJob.perform_later(@mutation) if Rails.env.production? || Rails.env.staging? + NewCreditMutationNotificationJob.perform_later(@mutation) if Rails.env.production? || Rails.env.staging? || Rails.env.luxproduction? format.html { redirect_to which_redirect?, flash: { success: 'Inleg of mutatie aangemaakt' } } format.json do render json: @mutation, include: { user: { methods: User.orderscreen_json_includes } } diff --git a/app/controllers/payments_controller.rb b/app/controllers/payments_controller.rb index 0be81a169..4f6ed90e6 100644 --- a/app/controllers/payments_controller.rb +++ b/app/controllers/payments_controller.rb @@ -22,9 +22,15 @@ def create # rubocop:disable Metrics/AbcSize end end - def add + def add # rubocop:disable Metrics/AbcSize authorize :payment + if Rails.application.config.x.mollie_api_key.blank? + flash[:error] = 'iDEAL is niet beschikbaar' + redirect_to users_path + return + end + @user = current_user @payment = Payment.new @@ -39,7 +45,9 @@ def callback # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/Pe end if payment.completed? - flash[:error] = 'Deze betaling is al gesloten. Mocht het bedrag niet bij uw inleg staan neem dan contact op met de penningmeester.' + flash[:error] = + "Deze betaling is al gesloten. Mocht het bedrag niet bij uw inleg staan + neem dan contact op met de #{Rails.application.config.x.treasurer_title}" else tries = 3 begin @@ -47,8 +55,8 @@ def callback # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/Pe if payment.mollie_payment.paid? flash[:success] = 'iDEAL betaling geslaagd' else - flash[:error] = 'Uw iDEAL betaling is mislukt. - Mocht het bedrag wel van uw rekening zijn gegaan neem dan contact op met de penningmeester' + flash[:error] = "Uw iDEAL betaling is mislukt. Mocht het bedrag wel van uw rekening zijn gegaan + neem dan contact op met de #{Rails.application.config.x.treasurer_title}" end rescue ActiveRecord::StaleObjectError => e raise e unless (tries -= 1).positive? diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 48481299e..7255bf066 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -117,7 +117,7 @@ def activities # rubocop:disable Metrics/AbcSize private def send_slack_users_refresh_notification - return unless Rails.env.production? || Rails.env.staging? + return unless Rails.env.production? || Rails.env.staging? || Rails.env.luxproduction? # :nocov: SlackMessageJob.perform_later("User ##{current_user.id} (#{current_user.name}) "\ diff --git a/app/jobs/credit_insufficient_notification_job.rb b/app/jobs/credit_insufficient_notification_job.rb index ad3ab2d6e..74b26728b 100644 --- a/app/jobs/credit_insufficient_notification_job.rb +++ b/app/jobs/credit_insufficient_notification_job.rb @@ -23,14 +23,14 @@ def users_with_insufficient_credit User.all.select { |user| user.credit.negative? } end - def send_notification_delivery_reports(success_count, unnotifyable_users) + def send_notification_delivery_reports(success_count, unnotifyable_users) # rubocop:disable Metrics/AbcSize User.treasurer.each do |treasurer| UserCreditMailer.credit_delivery_report_mail( treasurer, success_count, unnotifyable_users ).deliver_later end - return unless Rails.env.production? || Rails.env.staging? + return unless Rails.env.production? || Rails.env.staging? || Rails.env.luxproduction? SlackMessageJob.perform_later("Er is voor #{Rails.application.config.x.amber_api_host} een saldomail "\ "verstuurd naar #{success_count} mensen, en #{unnotifyable_users.count} saldomail(s) kon(den) niet "\ diff --git a/app/jobs/payment_poll_job.rb b/app/jobs/payment_poll_job.rb index 4ecee9bd2..de1e5e1cb 100644 --- a/app/jobs/payment_poll_job.rb +++ b/app/jobs/payment_poll_job.rb @@ -9,7 +9,7 @@ def perform # it will be checked again the next time this poll job runs end - return unless Rails.env.production? || Rails.env.staging? + return unless Rails.env.production? || Rails.env.staging? || Rails.env.luxproduction? HealthCheckJob.perform_later('payment_poll') end diff --git a/app/mailers/invoice_mailer.rb b/app/mailers/invoice_mailer.rb index 83f7775ca..b22410cf3 100644 --- a/app/mailers/invoice_mailer.rb +++ b/app/mailers/invoice_mailer.rb @@ -1,9 +1,13 @@ class InvoiceMailer < ApplicationMailer - def invoice_mail(invoice) # rubocop:disable Metrics/AbcSize + def invoice_mail(invoice) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength @user = Struct.new(:name).new(invoice.name) @invoice = invoice - @cab_link = url_for(controller: 'invoices', action: 'show', id: invoice.token) - @cab_text = 'iDeal betaling' + if Rails.application.config.x.mollie_api_key.present? + @cab_link = url_for(controller: 'invoices', action: 'show', id: invoice.token) + @cab_text = 'iDeal betaling' + else + @cab_disabled = true + end attachments["#{invoice.human_id}.pdf"] = WickedPdf.new.pdf_from_string( render_to_string(pdf: invoice.human_id.to_s, template: 'invoices/show', layout: 'pdf') diff --git a/app/models/product.rb b/app/models/product.rb index c01cb05c1..8082251ac 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -1,5 +1,6 @@ class Product < ApplicationRecord - enum category: { beer: 0, craft_beer: 6, non_alcoholic: 1, distilled: 2, wine: 3, food: 4, tobacco: 5, donation: 7 } + enum category: { beer: 0, low_alcohol_beer: 9, craft_beer: 6, non_alcoholic: 1, distilled: 2, whiskey: 8, wine: 3, food: 4, tobacco: 5, + donation: 7 } has_many :product_prices, dependent: :destroy has_many :price_lists, through: :product_prices, dependent: :restrict_with_error @@ -10,7 +11,7 @@ class Product < ApplicationRecord accepts_nested_attributes_for :product_prices, allow_destroy: true def requires_age - %w[beer craft_beer distilled wine tobacco].include? category + %w[beer craft_beer distilled whiskey wine tobacco].include? category end def t_category diff --git a/app/models/role.rb b/app/models/role.rb index afb6680fa..a607b2075 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -7,7 +7,7 @@ class Role < ApplicationRecord def name if treasurer? - 'Penningmeester' + Rails.application.config.x.treasurer_title elsif main_bartender? 'Hoofdtapper' end diff --git a/app/policies/payment_policy.rb b/app/policies/payment_policy.rb index 9d3036a15..aba51a76d 100644 --- a/app/policies/payment_policy.rb +++ b/app/policies/payment_policy.rb @@ -1,17 +1,21 @@ class PaymentPolicy < ApplicationPolicy def index? - user.treasurer? + mollie_enabled? && user.treasurer? end def create? - user + mollie_enabled? && user end def add? - user + mollie_enabled? && user end def invoice_callback? - record && !record.completed? + mollie_enabled? && record && !record.completed? + end + + def mollie_enabled? + Rails.application.config.x.mollie_api_key.present? end end diff --git a/app/views/activities/_cannot_order_modal.html.erb b/app/views/activities/_cannot_order_modal.html.erb index df30baef1..ad6e47f39 100644 --- a/app/views/activities/_cannot_order_modal.html.erb +++ b/app/views/activities/_cannot_order_modal.html.erb @@ -7,7 +7,7 @@ - - <%= content_tag :table, id: 'price_lists_table', class: 'price_lists_table table table-striped table-responsive-md', - data: {price_lists: @recent_price_lists_json, products: @products_json} do %> +
+ + +
+ + - - @@ -48,12 +54,12 @@ <%= fa_icon 'times lg' %> - - - - - + - <% end %> +
ID Product Categorie +
{{ priceList.name }}
+
+
+
+
@@ -77,15 +83,15 @@
+
+ + +
+<% end %> diff --git a/config/routes.rb b/config/routes.rb index 18807cd79..94c0d9774 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,7 +12,12 @@ end resources :orders, only: %i[index create update destroy] - resources :price_lists, only: %i[index create update] + resources :price_lists, only: %i[index create update] do + member do + post :archive + post :unarchive + end + end resources :users, only: %i[index show create update] do collection do diff --git a/db/migrate/20240202124405_add_archived_at_to_price_list.rb b/db/migrate/20240202124405_add_archived_at_to_price_list.rb new file mode 100644 index 000000000..99e50757b --- /dev/null +++ b/db/migrate/20240202124405_add_archived_at_to_price_list.rb @@ -0,0 +1,5 @@ +class AddArchivedAtToPriceList < ActiveRecord::Migration[7.0] + def change + add_column :price_lists, :archived_at, :datetime + end +end diff --git a/db/schema.rb b/db/schema.rb index 5497d9d59..26fcbda0c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,8 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_10_12_161008) do - +ActiveRecord::Schema[7.0].define(version: 2024_02_02_124405) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -50,8 +49,8 @@ t.integer "amount", null: false t.decimal "price", precision: 8, scale: 2, null: false t.datetime "deleted_at" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["invoice_id"], name: "index_invoice_rows_on_invoice_id" end @@ -115,6 +114,7 @@ t.datetime "deleted_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.datetime "archived_at" end create_table "product_prices", force: :cascade do |t| From 18f18df77bbd967b21539a677e73d204c7249423 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 21:32:49 +0100 Subject: [PATCH 8/8] chore(deps): update dependency paranoia to v3 (#931) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile | 2 +- Gemfile.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index a667c3383..69f77d7ad 100644 --- a/Gemfile +++ b/Gemfile @@ -21,7 +21,7 @@ gem 'omniauth', '~> 2.0.0' gem 'omniauth-oauth2', '~> 1.7.0' gem 'omniauth-rails_csrf_protection', '~> 1.0' gem 'paper_trail', '~> 14.0.0' -gem 'paranoia', '~> 2.6.0' +gem 'paranoia', '~> 3.0.0' gem 'pg', '~> 1.3.0' gem 'puma', '~> 6.1.1' gem 'pundit', '~> 2.2.0' diff --git a/Gemfile.lock b/Gemfile.lock index 1d59c3a6c..c3036a3e5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -100,7 +100,7 @@ GEM sidekiq (>= 6.0) coderay (1.1.3) colorize (0.8.1) - concurrent-ruby (1.2.2) + concurrent-ruby (1.3.4) connection_pool (2.3.0) consistency_fail (0.3.7) crass (1.0.6) @@ -183,7 +183,7 @@ GEM domain_name (~> 0.5) http-form_data (2.3.0) http_parser.rb (0.8.0) - i18n (1.13.0) + i18n (1.14.5) concurrent-ruby (~> 1.0) jbuilder (2.11.5) actionview (>= 5.0.0) @@ -234,7 +234,7 @@ GEM mini_portile2 (2.8.2) mini_racer (0.6.2) libv8-node (~> 16.10.0.0) - minitest (5.18.0) + minitest (5.24.1) mollie-api-ruby (4.7.1) msgpack (1.5.2) multi_json (1.15.0) @@ -289,8 +289,8 @@ GEM activerecord (>= 6.0) request_store (~> 1.4) parallel (1.22.1) - paranoia (2.6.0) - activerecord (>= 5.1, < 7.1) + paranoia (3.0.0) + activerecord (>= 6, < 8.1) parser (3.1.2.0) ast (~> 2.4.1) pg (1.3.5) @@ -567,7 +567,7 @@ DEPENDENCIES omniauth-oauth2 (~> 1.7.0) omniauth-rails_csrf_protection (~> 1.0) paper_trail (~> 14.0.0) - paranoia (~> 2.6.0) + paranoia (~> 3.0.0) pg (~> 1.3.0) pry-byebug pry-rails