Compare commits

..

15 Commits

Author SHA1 Message Date
278faa7319 Merge pull request 'Refine registration endpoint' (#165) from remove-wedding-date into main
Some checks failed
Check usage of free licenses / check-licenses (push) Successful in 47s
Run unit tests / unit_tests (push) Successful in 2m0s
Build Nginx-based docker image / build-static-assets (push) Successful in 22m55s
Add copyright notice / copyright_notice (pull_request) Successful in 20m54s
Check usage of free licenses / check-licenses (pull_request) Successful in 16m0s
Run unit tests / unit_tests (pull_request) Successful in 27m57s
renovate/artifacts Artifact file update failure
Reviewed-on: #165
2024-12-07 22:45:15 +00:00
93d907cdc8 Remove leftovers of the date attribute
All checks were successful
Check usage of free licenses / check-licenses (pull_request) Successful in 47s
Add copyright notice / copyright_notice (pull_request) Successful in 1m13s
Run unit tests / unit_tests (pull_request) Successful in 1m50s
2024-12-07 23:43:21 +01:00
fdef94be9a Revert "Fix tenant-related error retrieving captcha"
Some checks failed
Add copyright notice / copyright_notice (pull_request) Successful in 1m23s
Check usage of free licenses / check-licenses (pull_request) Successful in 1m50s
Run unit tests / unit_tests (pull_request) Failing after 2m26s
This reverts commit 3996ffc85c1fe3a912db14cbb317158fe9bcd8e2.
2024-12-07 23:18:23 +01:00
c62bb137ce Merge branch 'main' into remove-wedding-date
Some checks failed
Check usage of free licenses / check-licenses (pull_request) Successful in 38s
Add copyright notice / copyright_notice (pull_request) Successful in 1m3s
Run unit tests / unit_tests (pull_request) Failing after 2m51s
2024-12-07 22:17:30 +00:00
054561faa6 Merge pull request 'Fix tenant-related error retrieving captcha' (#168) from fix-tenant-captcha into main
All checks were successful
Check usage of free licenses / check-licenses (push) Successful in 55s
Run unit tests / unit_tests (push) Successful in 3m2s
Build Nginx-based docker image / build-static-assets (push) Successful in 25m30s
Reviewed-on: #168
2024-12-07 22:03:18 +00:00
3996ffc85c Fix tenant-related error retrieving captcha
All checks were successful
Check usage of free licenses / check-licenses (pull_request) Successful in 53s
Add copyright notice / copyright_notice (pull_request) Successful in 1m37s
Run unit tests / unit_tests (pull_request) Successful in 3m0s
2024-12-07 22:53:30 +01:00
82c543b167 Merge pull request 'Fix build of Docker image' (#167) from fix-build into main
All checks were successful
Check usage of free licenses / check-licenses (push) Successful in 1m4s
Run unit tests / unit_tests (push) Successful in 2m24s
Build Nginx-based docker image / build-static-assets (push) Successful in 22m41s
Reviewed-on: #167
2024-12-07 19:29:38 +00:00
dfe914a0b8 Fix build of Docker image
All checks were successful
Check usage of free licenses / check-licenses (pull_request) Successful in 58s
Add copyright notice / copyright_notice (pull_request) Successful in 1m17s
Run unit tests / unit_tests (pull_request) Successful in 1m53s
2024-12-07 20:27:28 +01:00
0e234b34a0 Merge pull request 'Fix production DB host' (#166) from fix-prod-db-host into main
Some checks failed
Check usage of free licenses / check-licenses (push) Successful in 45s
Run unit tests / unit_tests (push) Successful in 1m50s
Build Nginx-based docker image / build-static-assets (push) Failing after 11m36s
Reviewed-on: #166
2024-12-07 19:02:30 +00:00
2ab966faf8 Fix production DB host
All checks were successful
Check usage of free licenses / check-licenses (pull_request) Successful in 1m1s
Add copyright notice / copyright_notice (pull_request) Successful in 1m23s
Run unit tests / unit_tests (pull_request) Successful in 1m50s
2024-12-07 19:59:59 +01:00
9b612ce01d Add copyright notice
Some checks failed
Check usage of free licenses / check-licenses (pull_request) Successful in 1m37s
Add copyright notice / copyright_notice (pull_request) Successful in 2m38s
Run unit tests / unit_tests (pull_request) Failing after 4m38s
2024-12-07 18:09:21 +00:00
a3f14f4fec Include slug in root_url
Some checks failed
Add copyright notice / copyright_notice (pull_request) Successful in 51s
Check usage of free licenses / check-licenses (pull_request) Successful in 1m39s
Run unit tests / unit_tests (pull_request) Failing after 4m28s
2024-12-07 19:07:06 +01:00
022b58bb38 Fix issues with tenant during registration 2024-12-07 12:43:08 +01:00
8527b20075 Remove wedding date attribute 2024-12-07 12:39:43 +01:00
Renovate Bot
2c4befbcf6 Update dependency solid_queue to v1.1.0
Some checks failed
Add copyright notice / copyright_notice (pull_request) Successful in 5m15s
Check usage of free licenses / check-licenses (pull_request) Successful in 4m58s
Run unit tests / unit_tests (pull_request) Successful in 17m59s
Check usage of free licenses / check-licenses (push) Successful in 9m24s
Run unit tests / unit_tests (push) Successful in 6m19s
Build Nginx-based docker image / build-static-assets (push) Failing after 57m5s
2024-12-07 01:06:02 +00:00
12 changed files with 21 additions and 24 deletions

View File

@ -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

View File

@ -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)
@ -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)

View File

@ -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: {

View File

@ -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

View File

@ -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

View File

@ -83,6 +83,7 @@ test:
#
production:
<<: *default
host: db
database: wedding_planner_production
username: wedding_planner
password: <%= ENV["WEDDING_PLANNER_DATABASE_PASSWORD"] %>

View File

@ -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

View File

@ -0,0 +1,7 @@
# Copyright (C) 2024 Manuel Bustillo
class RemoveWeddingDate < ActiveRecord::Migration[8.0]
def change
remove_column :weddings, :date, :date, null: false
end
end

3
db/schema.rb generated
View File

@ -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_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 +222,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

View File

@ -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')

View File

@ -3,6 +3,5 @@
FactoryBot.define do
factory :wedding do
sequence(:slug) { |i| "wedding-#{i}" }
date { 1.year.from_now }
end
end

View File

@ -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
}
}