+ <% end %>
+ <% if @import.file.attached? %>
+ <%= link_to @import.file,
+ class: "btn btn-outline-primary",
+ download: @import.file_name do %>
+ Download Original File
+ <% end %>
+ <% end %>
+
+
+
+
+
+ <% if @import.error_details.present? %>
+
+
+
+ Error Details
+
+
+
+
<%= @import.error_details %>
+
+
+ <% end %>
+
+
+<% if @import.processing? %>
+
+<% end %>
diff --git a/app/views/admin/users/edit.html.erb b/app/views/admin/users/edit.html.erb
new file mode 100644
index 000000000..cc6801eb3
--- /dev/null
+++ b/app/views/admin/users/edit.html.erb
@@ -0,0 +1,316 @@
+<% content_for :title, "Edit User - #{@user.display_name}" %>
+
+
+
+
+
Edit User
+
Update user information and settings
+
+
+ <%= link_to admin_user_path(@user), class: "btn btn-outline-primary" do %>
+ View User
+ <% end %>
+ <%= link_to admin_users_path, class: "btn btn-outline-secondary" do %>
+ Back to Users
+ <% end %>
+
+
+ <% if @user.admin? %>
+ Administrator
+ <% else %>
+ Regular User
+ <% end %>
+
+
+
+
+
+
+
+
+ Account Information
+
+
+
+
+ Member since:
+ <%= @user.created_at.strftime("%B %d, %Y") %>
+
+
+ Last sign in:
+
+ <% if @user.current_sign_in_at %>
+ <%= time_ago_in_words(@user.current_sign_in_at) %> ago
+ <% else %>
+ Never signed in
+ <% end %>
+
+
+
+ Sign in count:
+ <%= @user.sign_in_count || 0 %> times
+
+ <% if user.admin? %>
+
+ Admin
+
+ <% else %>
+
+ User
+
+ <% end %>
+
+
+ <% if user.current_sign_in_at.present? %>
+ <% if user.current_sign_in_at > 30.days.ago %>
+ Active
+ <% else %>
+ Inactive
+ <% end %>
+ <% else %>
+ Never logged in
+ <% end %>
+
+
+
+ <%= time_ago_in_words(user.created_at) %> ago
+
+
+
+
+
+
+
+ <%= link_to admin_user_path(user), class: "dropdown-item" do %>
+ View
+ <% end %>
+
+
+ <%= link_to edit_admin_user_path(user), class: "dropdown-item" do %>
+ Edit
+ <% end %>
+
+
+ <%= link_to toggle_role_admin_user_path(user),
+ method: :patch,
+ class: "dropdown-item #{'disabled' if user == current_user}",
+ data: { confirm: "Are you sure you want to change this user's role?" } do %>
+
+ Toggle Role
+ <% end %>
+
+
+
+ <%= button_to admin_user_path(user),
+ method: :delete,
+ class: "dropdown-item text-danger #{'disabled' if user == current_user}",
+ data: { confirm: "Are you sure you want to delete this user? This action cannot be undone." } do %>
+ Delete
+ <% end %>
+
+
+
+
+
+ <% end %>
+
+
+
+
+
+ <% else %>
+
+
+
No users found
+ <% if params[:search].present? || params[:role].present? %>
+
+ <%= link_to edit_admin_user_path(@user), class: "btn btn-primary" do %>
+ Edit User
+ <% end %>
+ <%= link_to admin_users_path, class: "btn btn-outline-secondary" do %>
+ Back to Users
+ <% end %>
+
+ <% if @user.current_sign_in_at %>
+ <%= @user.current_sign_in_at.strftime("%B %d, %Y at %I:%M %p") %>
+ <%= time_ago_in_words(@user.current_sign_in_at) %> ago
+ <% else %>
+ Never signed in
+ <% end %>
+
+
+
+
+
+
+
+ <%= @user.sign_in_count || 0 %> times
+
+
+
+
+
+
+
+ <% if @user.current_sign_in_at.present? && @user.current_sign_in_at > 30.days.ago %>
+ Active
+ <% elsif @user.current_sign_in_at.present? %>
+ Inactive
+ <% else %>
+ Never logged in
+ <% end %>
+
+ <% resource.errors.full_messages.each do |message| %>
+
<%= message %>
+ <% end %>
+
+
+<% end %>
diff --git a/app/views/devise/shared/_flash_messages.html.erb b/app/views/devise/shared/_flash_messages.html.erb
new file mode 100644
index 000000000..6d4042694
--- /dev/null
+++ b/app/views/devise/shared/_flash_messages.html.erb
@@ -0,0 +1,26 @@
+<% flash.each do |type, message| %>
+ <%
+ # Map Rails flash types to Bootstrap alert classes
+ alert_class = case type.to_s
+ when 'notice' then 'alert-success'
+ when 'alert' then 'alert-danger'
+ when 'error' then 'alert-danger'
+ when 'warning' then 'alert-warning'
+ when 'info' then 'alert-info'
+ else 'alert-info'
+ end
+ %>
+
+ <% case type.to_s %>
+ <% when 'notice' %>
+
+ <% when 'alert', 'error' %>
+
+ <% when 'warning' %>
+
+ <% when 'info' %>
+
+ <% end %>
+ <%= message %>
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb
new file mode 100644
index 000000000..b7be42eb2
--- /dev/null
+++ b/app/views/devise/shared/_links.html.erb
@@ -0,0 +1,45 @@
+<%- if controller_name != 'sessions' %>
+ <%= link_to new_session_path(resource_name), class: "btn btn-outline-primary w-100" do %>
+ Sign In
+ <% end %>
+<% end %>
+
+<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
+ <%= link_to new_registration_path(resource_name), class: "btn btn-outline-success w-100 mt-2" do %>
+ Create Account
+ <% end %>
+<% end %>
+
+<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
+
+ <%= link_to new_password_path(resource_name), class: "text-decoration-none" do %>
+ Forgot your password?
+ <% end %>
+
+<% end %>
+
+<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
+
+ <%= link_to new_confirmation_path(resource_name), class: "text-decoration-none" do %>
+ Didn't receive confirmation instructions?
+ <% end %>
+
+<% end %>
+
+<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
+
+ <%= link_to new_unlock_path(resource_name), class: "text-decoration-none" do %>
+ Didn't receive unlock instructions?
+ <% end %>
+
+<% end %>
+
+<%- if devise_mapping.omniauthable? %>
+ <%- resource_class.omniauth_providers.each do |provider| %>
+ <%= button_to omniauth_authorize_path(resource_name, provider),
+ class: "btn btn-outline-secondary w-100 mt-2",
+ data: { turbo: false } do %>
+ Sign in with <%= OmniAuth::Utils.camelize(provider) %>
+ <% end %>
+ <% end %>
+<% end %>
diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb
new file mode 100644
index 000000000..c42de1738
--- /dev/null
+++ b/app/views/devise/unlocks/new.html.erb
@@ -0,0 +1,19 @@
+
+ <% flash.each do |type, message| %>
+ <%
+ # Map Rails flash types to Bootstrap alert classes
+ alert_class = case type.to_s
+ when 'notice' then 'alert-success'
+ when 'alert' then 'alert-danger'
+ when 'error' then 'alert-danger'
+ when 'warning' then 'alert-warning'
+ when 'info' then 'alert-info'
+ else 'alert-info'
+ end
+ %>
+
+ <% case type.to_s %>
+ <% when 'notice' %>
+
+ <% when 'alert', 'error' %>
+
+ <% when 'warning' %>
+
+ <% when 'info' %>
+
+ <% end %>
+ <%= message %>
+
+
+ <% end %>
+
+
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/shared/_navbar.html.erb b/app/views/shared/_navbar.html.erb
new file mode 100644
index 000000000..8709415a7
--- /dev/null
+++ b/app/views/shared/_navbar.html.erb
@@ -0,0 +1,46 @@
+
\ No newline at end of file
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb
new file mode 100644
index 000000000..9caba46fa
--- /dev/null
+++ b/app/views/users/edit.html.erb
@@ -0,0 +1,207 @@
+<% content_for :title, "Edit Profile" %>
+
+
+
+
+
+
+
Edit Profile
+
Update your personal information
+
+ <%= link_to profile_path, class: "btn btn-outline-secondary" do %>
+ Back to Profile
+ <% end %>
+
+
+
+ Member since <%= @user.created_at.strftime("%B %Y") %>
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile Settings
+
+
+
+
+
+
Personal Information
+
+ Update your personal details and avatar image.
+
+
+
+ <%= link_to profile_edit_path, class: "btn btn-primary" do %>
+ Edit Profile
+ <% end %>
+
+
+
+
+
+
+
+
Danger Zone
+
+ Permanently delete your account and all data.
+
+
+
+ <%= link_to profile_path,
+ method: :delete,
+ class: "btn btn-outline-danger",
+ data: {
+ confirm: "Are you sure you want to delete your account? This action cannot be undone."
+ } do %>
+ Delete Account
+ <% end %>
+
+
+
+
+
+
+
diff --git a/bin/brakeman b/bin/brakeman
new file mode 100755
index 000000000..ace1c9ba0
--- /dev/null
+++ b/bin/brakeman
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+require "rubygems"
+require "bundler/setup"
+
+ARGV.unshift("--ensure-latest")
+
+load Gem.bin_path("brakeman", "brakeman")
diff --git a/bin/bundle b/bin/bundle
new file mode 100755
index 000000000..50da5fdf9
--- /dev/null
+++ b/bin/bundle
@@ -0,0 +1,109 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'bundle' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require "rubygems"
+
+m = Module.new do
+ module_function
+
+ def invoked_as_script?
+ File.expand_path($0) == File.expand_path(__FILE__)
+ end
+
+ def env_var_version
+ ENV["BUNDLER_VERSION"]
+ end
+
+ def cli_arg_version
+ return unless invoked_as_script? # don't want to hijack other binstubs
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
+ bundler_version = nil
+ update_index = nil
+ ARGV.each_with_index do |a, i|
+ if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
+ bundler_version = a
+ end
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
+ bundler_version = $1
+ update_index = i
+ end
+ bundler_version
+ end
+
+ def gemfile
+ gemfile = ENV["BUNDLE_GEMFILE"]
+ return gemfile if gemfile && !gemfile.empty?
+
+ File.expand_path("../Gemfile", __dir__)
+ end
+
+ def lockfile
+ lockfile =
+ case File.basename(gemfile)
+ when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
+ else "#{gemfile}.lock"
+ end
+ File.expand_path(lockfile)
+ end
+
+ def lockfile_version
+ return unless File.file?(lockfile)
+ lockfile_contents = File.read(lockfile)
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
+ Regexp.last_match(1)
+ end
+
+ def bundler_requirement
+ @bundler_requirement ||=
+ env_var_version ||
+ cli_arg_version ||
+ bundler_requirement_for(lockfile_version)
+ end
+
+ def bundler_requirement_for(version)
+ return "#{Gem::Requirement.default}.a" unless version
+
+ bundler_gem_version = Gem::Version.new(version)
+
+ bundler_gem_version.approximate_recommendation
+ end
+
+ def load_bundler!
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
+
+ activate_bundler
+ end
+
+ def activate_bundler
+ gem_error = activation_error_handling do
+ gem "bundler", bundler_requirement
+ end
+ return if gem_error.nil?
+ require_error = activation_error_handling do
+ require "bundler/version"
+ end
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
+ exit 42
+ end
+
+ def activation_error_handling
+ yield
+ nil
+ rescue StandardError, LoadError => e
+ e
+ end
+end
+
+m.load_bundler!
+
+if m.invoked_as_script?
+ load Gem.bin_path("bundler", "bundle")
+end
diff --git a/bin/dev b/bin/dev
new file mode 100755
index 000000000..74ade1664
--- /dev/null
+++ b/bin/dev
@@ -0,0 +1,8 @@
+#!/usr/bin/env sh
+
+if ! gem list foreman -i --silent; then
+ echo "Installing foreman..."
+ gem install foreman
+fi
+
+exec foreman start -f Procfile.dev "$@"
diff --git a/bin/docker-entrypoint b/bin/docker-entrypoint
new file mode 100755
index 000000000..57567d69b
--- /dev/null
+++ b/bin/docker-entrypoint
@@ -0,0 +1,14 @@
+#!/bin/bash -e
+
+# Enable jemalloc for reduced memory usage and latency.
+if [ -z "${LD_PRELOAD+x}" ]; then
+ LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
+ export LD_PRELOAD
+fi
+
+# If running the rails server then create or migrate existing database
+if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
+ ./bin/rails db:prepare
+fi
+
+exec "${@}"
diff --git a/bin/importmap b/bin/importmap
new file mode 100755
index 000000000..36502ab16
--- /dev/null
+++ b/bin/importmap
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+
+require_relative "../config/application"
+require "importmap/commands"
diff --git a/bin/jobs b/bin/jobs
new file mode 100755
index 000000000..dcf59f309
--- /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/bin/kamal b/bin/kamal
new file mode 100755
index 000000000..cbe59b95e
--- /dev/null
+++ b/bin/kamal
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'kamal' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("kamal", "kamal")
diff --git a/bin/rails b/bin/rails
new file mode 100755
index 000000000..efc037749
--- /dev/null
+++ b/bin/rails
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+APP_PATH = File.expand_path("../config/application", __dir__)
+require_relative "../config/boot"
+require "rails/commands"
diff --git a/bin/rake b/bin/rake
new file mode 100755
index 000000000..4fbf10b96
--- /dev/null
+++ b/bin/rake
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+require_relative "../config/boot"
+require "rake"
+Rake.application.run
diff --git a/bin/rubocop b/bin/rubocop
new file mode 100755
index 000000000..40330c0ff
--- /dev/null
+++ b/bin/rubocop
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+require "rubygems"
+require "bundler/setup"
+
+# explicit rubocop config increases performance slightly while avoiding config confusion.
+ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
+
+load Gem.bin_path("rubocop", "rubocop")
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 000000000..be3db3c0d
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+require "fileutils"
+
+APP_ROOT = File.expand_path("..", __dir__)
+
+def system!(*args)
+ system(*args, exception: true)
+end
+
+FileUtils.chdir APP_ROOT do
+ # This script is a way to set up or update your development environment automatically.
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
+ # Add necessary setup steps to this file.
+
+ puts "== Installing dependencies =="
+ system("bundle check") || system!("bundle install")
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?("config/database.yml")
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
+ # end
+
+ puts "\n== Preparing database =="
+ system! "bin/rails db:prepare"
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! "bin/rails log:clear tmp:clear"
+
+ unless ARGV.include?("--skip-server")
+ puts "\n== Starting development server =="
+ STDOUT.flush # flush the output before exec(2) so that it displays
+ exec "bin/dev"
+ end
+end
diff --git a/bin/thrust b/bin/thrust
new file mode 100755
index 000000000..36bde2d83
--- /dev/null
+++ b/bin/thrust
@@ -0,0 +1,5 @@
+#!/usr/bin/env ruby
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("thruster", "thrust")
diff --git a/config.ru b/config.ru
new file mode 100644
index 000000000..4a3c09a68
--- /dev/null
+++ b/config.ru
@@ -0,0 +1,6 @@
+# This file is used by Rack-based servers to start the application.
+
+require_relative "config/environment"
+
+run Rails.application
+Rails.application.load_server
diff --git a/config/application.rb b/config/application.rb
new file mode 100644
index 000000000..fc06223b9
--- /dev/null
+++ b/config/application.rb
@@ -0,0 +1,27 @@
+require_relative "boot"
+
+require "rails/all"
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module UserManagementApp
+ class Application < Rails::Application
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 8.0
+
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
+ config.autoload_lib(ignore: %w[assets tasks])
+
+ # Configuration for the application, engines, and railties goes here.
+ #
+ # These settings can be overridden in specific environments using the files
+ # in config/environments, which are processed later.
+ #
+ # config.time_zone = "Central Time (US & Canada)"
+ # config.eager_load_paths << Rails.root.join("extras")
+ end
+end
diff --git a/config/boot.rb b/config/boot.rb
new file mode 100644
index 000000000..988a5ddc4
--- /dev/null
+++ b/config/boot.rb
@@ -0,0 +1,4 @@
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+require "bundler/setup" # Set up gems listed in the Gemfile.
+require "bootsnap/setup" # Speed up boot time by caching expensive operations.
diff --git a/config/cable.yml b/config/cable.yml
new file mode 100644
index 000000000..b9adc5aa3
--- /dev/null
+++ b/config/cable.yml
@@ -0,0 +1,17 @@
+# Async adapter only works within the same process, so for manually triggering cable updates from a console,
+# and seeing results in the browser, you must do so from the web console (running inside the dev process),
+# not a terminal started via bin/rails console! Add "console" to any action or any ERB template view
+# to make the web console appear.
+development:
+ adapter: async
+
+test:
+ adapter: test
+
+production:
+ adapter: solid_cable
+ connects_to:
+ database:
+ writing: cable
+ polling_interval: 0.1.seconds
+ message_retention: 1.day
diff --git a/config/cache.yml b/config/cache.yml
new file mode 100644
index 000000000..19d490843
--- /dev/null
+++ b/config/cache.yml
@@ -0,0 +1,16 @@
+default: &default
+ store_options:
+ # Cap age of oldest cache entry to fulfill retention policies
+ # max_age: <%= 60.days.to_i %>
+ max_size: <%= 256.megabytes %>
+ namespace: <%= Rails.env %>
+
+development:
+ <<: *default
+
+test:
+ <<: *default
+
+production:
+ database: cache
+ <<: *default
diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc
new file mode 100644
index 000000000..ef7fbf3ab
--- /dev/null
+++ b/config/credentials.yml.enc
@@ -0,0 +1 @@
+ifgLmHlLsUsIuLqz3B0fCAHN76bFRQmGX3WyGsIGp1DbwqjAmCkUAcSDynvD1bSPpygx4O0tKMHfczGCEBup0JNNv/H35scZQCPEVDyRFBHiOppTWoqf/Hp/kU/vycHFFn+p1c8GrG0bf6dht14cGGHiWyOSfMliTUVWeTwqmuUjKPFbynwpap8JukFC49DDjJ/mu0UM0v3/HES4MxLejR3FNr8Hc6q3DuxFbwJRlTnmjAT5c4BXOdsOl63HpVH24Z+V8ZlK7U3cccpgsC9kmKSQ2FA7PcZiRdl6H39hCnYYln98QawqyXDnPLThIwlm2qJvvIXJdwXBr9xKM5yPX9vvPUYHbdmpyNLiE36c6II9uKmJVtqxR5TdPCDpDTpfm3+doYP6mb/+pN7LojC2MbUTISgm3VxlvzwBhVbw2KdXDBLXT0h02+L6TEgNzXofkj3V3pRDvZFT2GarumOdD1l0WYPp1eqpG+haKEN7eM1dwCB+hSvJnu5f--KlJV7eGP5KbD/Rww--R2gvaFIVw5yJ+7AOOJ2d9Q==
\ No newline at end of file
diff --git a/config/database.yml b/config/database.yml
new file mode 100644
index 000000000..b3e918161
--- /dev/null
+++ b/config/database.yml
@@ -0,0 +1,69 @@
+# PostgreSQL. Versions 9.3 and up are supported.
+#
+# Install the pg driver:
+# gem install pg
+# On macOS with Homebrew:
+# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
+# On Windows:
+# gem install pg
+# Choose the win32 build.
+# Install PostgreSQL and put its /bin directory on your path.
+#
+# Configure Using Gemfile
+# gem "pg"
+#
+default: &default
+ adapter: <%= ENV['DATABASE_URL'] ? 'postgresql' : 'sqlite3' %>
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
+ timeout: 5000
+
+development:
+ <<: *default
+ <% if ENV['DATABASE_URL'] %>
+ url: <%= ENV['DATABASE_URL'] %>
+ <% else %>
+ database: storage/development.sqlite3
+ <% end %>
+
+test:
+ <<: *default
+ database: storage/test.sqlite3
+
+# As with config/credentials.yml, you never want to store sensitive information,
+# like your database password, in your source code. If your source code is
+# ever seen by anyone, they now have access to your database.
+#
+# Instead, provide the password or a full connection URL as an environment
+# variable when you boot the app. For example:
+#
+# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
+#
+# If the connection URL is provided in the special DATABASE_URL environment
+# variable, Rails will automatically merge its configuration values on top of
+# the values provided in this file. Alternatively, you can specify a connection
+# URL environment variable explicitly:
+#
+# production:
+# url: <%= ENV["MY_APP_DATABASE_URL"] %>
+#
+# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
+# for a full overview on how database connection configuration can be specified.
+#
+production:
+ primary: &primary_production
+ <<: *default
+ database: user_management_app_production
+ username: user_management_app
+ password: <%= ENV["USER_MANAGEMENT_APP_DATABASE_PASSWORD"] %>
+ cache:
+ <<: *primary_production
+ database: user_management_app_production_cache
+ migrations_paths: db/cache_migrate
+ queue:
+ <<: *primary_production
+ database: user_management_app_production_queue
+ migrations_paths: db/queue_migrate
+ cable:
+ <<: *primary_production
+ database: user_management_app_production_cable
+ migrations_paths: db/cable_migrate
diff --git a/config/deploy.yml b/config/deploy.yml
new file mode 100644
index 000000000..ee361c033
--- /dev/null
+++ b/config/deploy.yml
@@ -0,0 +1,116 @@
+# Name of your application. Used to uniquely configure containers.
+service: user_management_app
+
+# Name of the container image.
+image: your-user/user_management_app
+
+# Deploy to these servers.
+servers:
+ web:
+ - 192.168.0.1
+ # job:
+ # hosts:
+ # - 192.168.0.1
+ # cmd: bin/jobs
+
+# Enable SSL auto certification via Let's Encrypt and allow for multiple apps on a single web server.
+# Remove this section when using multiple web servers and ensure you terminate SSL at your load balancer.
+#
+# Note: If using Cloudflare, set encryption mode in SSL/TLS setting to "Full" to enable CF-to-app encryption.
+proxy:
+ ssl: true
+ host: app.example.com
+
+# Credentials for your image host.
+registry:
+ # Specify the registry server, if you're not using Docker Hub
+ # server: registry.digitalocean.com / ghcr.io / ...
+ username: your-user
+
+ # Always use an access token rather than real password when possible.
+ password:
+ - KAMAL_REGISTRY_PASSWORD
+
+# Inject ENV variables into containers (secrets come from .kamal/secrets).
+env:
+ secret:
+ - RAILS_MASTER_KEY
+ clear:
+ # Run the Solid Queue Supervisor inside the web server's Puma process to do jobs.
+ # When you start using multiple servers, you should split out job processing to a dedicated machine.
+ SOLID_QUEUE_IN_PUMA: true
+
+ # Set number of processes dedicated to Solid Queue (default: 1)
+ # JOB_CONCURRENCY: 3
+
+ # Set number of cores available to the application on each server (default: 1).
+ # WEB_CONCURRENCY: 2
+
+ # Match this to any external database server to configure Active Record correctly
+ # Use user_management_app-db for a db accessory server on same machine via local kamal docker network.
+ # DB_HOST: 192.168.0.2
+
+ # Log everything from Rails
+ # RAILS_LOG_LEVEL: debug
+
+# Aliases are triggered with "bin/kamal ". You can overwrite arguments on invocation:
+# "bin/kamal logs -r job" will tail logs from the first server in the job section.
+aliases:
+ console: app exec --interactive --reuse "bin/rails console"
+ shell: app exec --interactive --reuse "bash"
+ logs: app logs -f
+ dbc: app exec --interactive --reuse "bin/rails dbconsole"
+
+
+# Use a persistent storage volume for sqlite database files and local Active Storage files.
+# Recommended to change this to a mounted volume path that is backed up off server.
+volumes:
+ - "user_management_app_storage:/rails/storage"
+
+
+# Bridge fingerprinted assets, like JS and CSS, between versions to avoid
+# hitting 404 on in-flight requests. Combines all files from new and old
+# version inside the asset_path.
+asset_path: /rails/public/assets
+
+# Configure the image builder.
+builder:
+ arch: amd64
+
+ # # Build image via remote server (useful for faster amd64 builds on arm64 computers)
+ # remote: ssh://docker@docker-builder-server
+ #
+ # # Pass arguments and secrets to the Docker build process
+ # args:
+ # RUBY_VERSION: 3.4.4
+ # secrets:
+ # - GITHUB_TOKEN
+ # - RAILS_MASTER_KEY
+
+# Use a different ssh user than root
+# ssh:
+# user: app
+
+# Use accessory services (secrets come from .kamal/secrets).
+# accessories:
+# db:
+# image: mysql:8.0
+# host: 192.168.0.2
+# # Change to 3306 to expose port to the world instead of just local network.
+# port: "127.0.0.1:3306:3306"
+# env:
+# clear:
+# MYSQL_ROOT_HOST: '%'
+# secret:
+# - MYSQL_ROOT_PASSWORD
+# files:
+# - config/mysql/production.cnf:/etc/mysql/my.cnf
+# - db/production.sql:/docker-entrypoint-initdb.d/setup.sql
+# directories:
+# - data:/var/lib/mysql
+# redis:
+# image: redis:7.0
+# host: 192.168.0.2
+# port: 6379
+# directories:
+# - data:/data
diff --git a/config/environment.rb b/config/environment.rb
new file mode 100644
index 000000000..cac531577
--- /dev/null
+++ b/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require_relative "application"
+
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
new file mode 100644
index 000000000..3ed998833
--- /dev/null
+++ b/config/environments/development.rb
@@ -0,0 +1,75 @@
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Make code changes take effect immediately without server restart.
+ config.enable_reloading = true
+
+ # Do not eager load code on boot.
+ config.eager_load = false
+
+ # Show full error reports.
+ config.consider_all_requests_local = true
+
+ # Enable server timing.
+ config.server_timing = true
+
+ # Enable/disable Action Controller caching. By default Action Controller caching is disabled.
+ # Run rails dev:cache to toggle Action Controller caching.
+ if Rails.root.join("tmp/caching-dev.txt").exist?
+ config.action_controller.perform_caching = true
+ config.action_controller.enable_fragment_cache_logging = true
+ config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
+ else
+ config.action_controller.perform_caching = false
+ end
+
+ # Change to :null_store to avoid any caching.
+ config.cache_store = :memory_store
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+
+ # Make template changes take effect immediately.
+ config.action_mailer.perform_caching = false
+
+ # Set localhost to be used by links generated in mailer templates.
+ config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
+
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
+
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
+
+ # Highlight code that triggered database queries in logs.
+ config.active_record.verbose_query_logs = true
+
+ # Append comments with runtime information tags to SQL queries in logs.
+ config.active_record.query_log_tags_enabled = true
+
+ # Highlight code that enqueued background job in logs.
+ config.active_job.verbose_enqueue_logs = true
+
+ # Configure ActiveJob to use Sidekiq
+ config.active_job.queue_adapter = :sidekiq
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Uncomment if you wish to allow Action Cable access from any origin.
+ # config.action_cable.disable_request_forgery_protection = true
+
+ # Raise error when a before_action's only/except options reference missing actions.
+ config.action_controller.raise_on_missing_callback_actions = true
+
+ # Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
+ # config.generators.apply_rubocop_autocorrect_after_generate!
+end
diff --git a/config/environments/production.rb b/config/environments/production.rb
new file mode 100644
index 000000000..44b0bc0c7
--- /dev/null
+++ b/config/environments/production.rb
@@ -0,0 +1,90 @@
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Code is not reloaded between requests.
+ config.enable_reloading = false
+
+ # Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
+ config.eager_load = true
+
+ # Full error reports are disabled.
+ config.consider_all_requests_local = false
+
+ # Turn on fragment caching in view templates.
+ config.action_controller.perform_caching = true
+
+ # Cache assets for far-future expiry since they are all digest stamped.
+ config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.asset_host = "http://assets.example.com"
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
+ config.assume_ssl = true
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ config.force_ssl = true
+
+ # Skip http-to-https redirect for the default health check endpoint.
+ # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
+
+ # Log to STDOUT with the current request id as a default log tag.
+ config.log_tags = [ :request_id ]
+ config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
+
+ # Change to "debug" to log everything (including potentially personally-identifiable information!)
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
+
+ # Prevent health checks from clogging up the logs.
+ config.silence_healthcheck_path = "/up"
+
+ # Don't log any deprecations.
+ config.active_support.report_deprecations = false
+
+ # Replace the default in-process memory cache store with a durable alternative.
+ config.cache_store = :solid_cache_store
+
+ # Replace the default in-process and non-durable queuing backend for Active Job.
+ config.active_job.queue_adapter = :sidekiq
+ # config.solid_queue.connects_to = { database: { writing: :queue } }
+
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Set host to be used by links generated in mailer templates.
+ config.action_mailer.default_url_options = { host: "example.com" }
+
+ # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
+ # config.action_mailer.smtp_settings = {
+ # user_name: Rails.application.credentials.dig(:smtp, :user_name),
+ # password: Rails.application.credentials.dig(:smtp, :password),
+ # address: "smtp.example.com",
+ # port: 587,
+ # authentication: :plain
+ # }
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+
+ # Only use :id for inspections in production.
+ config.active_record.attributes_for_inspect = [ :id ]
+
+ # Enable DNS rebinding protection and other `Host` header attacks.
+ # config.hosts = [
+ # "example.com", # Allow requests from example.com
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
+ # ]
+ #
+ # Skip DNS rebinding protection for the default health check endpoint.
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
+end
diff --git a/config/environments/test.rb b/config/environments/test.rb
new file mode 100644
index 000000000..c2095b117
--- /dev/null
+++ b/config/environments/test.rb
@@ -0,0 +1,53 @@
+# The test environment is used exclusively to run your application's
+# test suite. You never need to work with it otherwise. Remember that
+# your test database is "scratch space" for the test suite and is wiped
+# and recreated between test runs. Don't rely on the data there!
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # While tests run files are not watched, reloading is not necessary.
+ config.enable_reloading = false
+
+ # Eager loading loads your entire application. When running a single test locally,
+ # this is usually not necessary, and can slow down your test suite. However, it's
+ # recommended that you enable it in continuous integration systems to ensure eager
+ # loading is working properly before deploying your code.
+ config.eager_load = ENV["CI"].present?
+
+ # Configure public file server for tests with cache-control for performance.
+ config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
+
+ # Show full error reports.
+ config.consider_all_requests_local = true
+ config.cache_store = :null_store
+
+ # Render exception templates for rescuable exceptions and raise for other exceptions.
+ config.action_dispatch.show_exceptions = :rescuable
+
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+
+ # Store uploaded files on the local file system in a temporary directory.
+ config.active_storage.service = :test
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Set host to be used by links generated in mailer templates.
+ config.action_mailer.default_url_options = { host: "example.com" }
+
+ # Print deprecation notices to the stderr.
+ config.active_support.deprecation = :stderr
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Raise error when a before_action's only/except options reference missing actions.
+ config.action_controller.raise_on_missing_callback_actions = true
+end
diff --git a/config/importmap.rb b/config/importmap.rb
new file mode 100644
index 000000000..4f0ed8625
--- /dev/null
+++ b/config/importmap.rb
@@ -0,0 +1,9 @@
+# Pin npm packages by running ./bin/importmap
+
+pin "application"
+pin "@hotwired/turbo-rails", to: "turbo.min.js"
+pin "@hotwired/stimulus", to: "stimulus.min.js"
+pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
+pin_all_from "app/javascript/controllers", under: "controllers"
+pin "@rails/actioncable", to: "actioncable.esm.js"
+pin_all_from "app/javascript/channels", under: "channels"
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
new file mode 100644
index 000000000..487324424
--- /dev/null
+++ b/config/initializers/assets.rb
@@ -0,0 +1,7 @@
+# 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.
+Rails.application.config.assets.version = "1.0"
+
+# Add additional assets to the asset load path.
+# Rails.application.config.assets.paths << Emoji.images_path
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb
new file mode 100644
index 000000000..b3076b38f
--- /dev/null
+++ b/config/initializers/content_security_policy.rb
@@ -0,0 +1,25 @@
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide content security policy.
+# See the Securing Rails Applications Guide for more information:
+# https://guides.rubyonrails.org/security.html#content-security-policy-header
+
+# Rails.application.configure do
+# config.content_security_policy do |policy|
+# policy.default_src :self, :https
+# policy.font_src :self, :https, :data
+# policy.img_src :self, :https, :data
+# policy.object_src :none
+# policy.script_src :self, :https
+# policy.style_src :self, :https
+# # Specify URI for violation reports
+# # policy.report_uri "/csp-violation-report-endpoint"
+# end
+#
+# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
+# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
+# config.content_security_policy_nonce_directives = %w(script-src style-src)
+#
+# # Report violations without enforcing the policy.
+# # config.content_security_policy_report_only = true
+# end
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
new file mode 100644
index 000000000..14de78390
--- /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 = '87e07ca0cbe93c05724a7ae1631036f08e677e7c8af060bb28630ec7d00dee6d815dcbf77ac6271c9472b16308782cf60f27441dd8b880b01a5717c6b04c2933'
+
+ # ==> 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 = 'please-change-me-at-config-initializers-devise@example.com'
+
+ # 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 = '4bcfa3e072bddad20362a22f0a8074b21dc080efb208b638d1acfc17d6fd6e226cc92eb86b99f2aed673780bcafe35c5fe6b786bab6541407d7ebeee76f579e5'
+
+ # 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 = 6..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 = 20
+
+ # 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/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 000000000..c0b717f7e
--- /dev/null
+++ b/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,8 @@
+# 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.
+# Use this to limit dissemination of sensitive information.
+# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
+Rails.application.config.filter_parameters += [
+ :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
+]
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
new file mode 100644
index 000000000..3860f659e
--- /dev/null
+++ b/config/initializers/inflections.rb
@@ -0,0 +1,16 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, "\\1en"
+# inflect.singular /^(ox)en/i, "\\1"
+# inflect.irregular "person", "people"
+# inflect.uncountable %w( fish sheep )
+# end
+
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.acronym "RESTful"
+# end
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
new file mode 100644
index 000000000..debac1f30
--- /dev/null
+++ b/config/initializers/sidekiq.rb
@@ -0,0 +1,25 @@
+require "sidekiq"
+require "sidekiq/web"
+
+Sidekiq.configure_server do |config|
+ config.redis = {
+ url: ENV.fetch("REDIS_URL", "redis://localhost:6379/0"),
+ network_timeout: 5
+ }
+
+ # Configure the number of threads
+ config.concurrency = ENV.fetch("SIDEKIQ_CONCURRENCY", 5).to_i
+end
+
+Sidekiq.configure_client do |config|
+ config.redis = {
+ url: ENV.fetch("REDIS_URL", "redis://localhost:6379/0"),
+ network_timeout: 5
+ }
+end
+
+# Configure queues
+Sidekiq.default_job_options = {
+ "backtrace" => true,
+ "retry" => 3
+}
diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb
new file mode 100644
index 000000000..d26878480
--- /dev/null
+++ b/config/initializers/simple_form.rb
@@ -0,0 +1,176 @@
+# frozen_string_literal: true
+#
+# Uncomment this and change the path if necessary to include your own
+# components.
+# See https://github.com/heartcombo/simple_form#custom-components to know
+# more about custom components.
+# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
+#
+# Use this setup block to configure all options available in SimpleForm.
+SimpleForm.setup do |config|
+ # Wrappers are used by the form builder to generate a
+ # complete input. You can remove any component from the
+ # wrapper, change the order or even add your own to the
+ # stack. The options given below are used to wrap the
+ # whole input.
+ config.wrappers :default, class: :input,
+ hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b|
+ ## Extensions enabled by default
+ # Any of these extensions can be disabled for a
+ # given input by passing: `f.input EXTENSION_NAME => false`.
+ # You can make any of these extensions optional by
+ # renaming `b.use` to `b.optional`.
+
+ # Determines whether to use HTML5 (:email, :url, ...)
+ # and required attributes
+ b.use :html5
+
+ # Calculates placeholders automatically from I18n
+ # You can also pass a string as f.input placeholder: "Placeholder"
+ b.use :placeholder
+
+ ## Optional extensions
+ # They are disabled unless you pass `f.input EXTENSION_NAME => true`
+ # to the input. If so, they will retrieve the values from the model
+ # if any exists. If you want to enable any of those
+ # extensions by default, you can change `b.optional` to `b.use`.
+
+ # Calculates maxlength from length validations for string inputs
+ # and/or database column lengths
+ b.optional :maxlength
+
+ # Calculate minlength from length validations for string inputs
+ b.optional :minlength
+
+ # Calculates pattern from format validations for string inputs
+ b.optional :pattern
+
+ # Calculates min and max from length validations for numeric inputs
+ b.optional :min_max
+
+ # Calculates readonly automatically from readonly attributes
+ b.optional :readonly
+
+ ## Inputs
+ # b.use :input, class: 'input', error_class: 'is-invalid', valid_class: 'is-valid'
+ b.use :label_input
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
+ b.use :error, wrap_with: { tag: :span, class: :error }
+
+ ## full_messages_for
+ # If you want to display the full error message for the attribute, you can
+ # use the component :full_error, like:
+ #
+ # b.use :full_error, wrap_with: { tag: :span, class: :error }
+ end
+
+ # The default wrapper to be used by the FormBuilder.
+ config.default_wrapper = :default
+
+ # Define the way to render check boxes / radio buttons with labels.
+ # Defaults to :nested for bootstrap config.
+ # inline: input + label
+ # nested: label > input
+ config.boolean_style = :nested
+
+ # Default class for buttons
+ config.button_class = 'btn'
+
+ # Method used to tidy up errors. Specify any Rails Array method.
+ # :first lists the first message for each field.
+ # Use :to_sentence to list all errors for each field.
+ # config.error_method = :first
+
+ # Default tag used for error notification helper.
+ config.error_notification_tag = :div
+
+ # CSS class to add for error notification helper.
+ config.error_notification_class = 'error_notification'
+
+ # Series of attempts to detect a default label method for collection.
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
+
+ # Series of attempts to detect a default value method for collection.
+ # config.collection_value_methods = [ :id, :to_s ]
+
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
+ # config.collection_wrapper_tag = nil
+
+ # You can define the class to use on all collection wrappers. Defaulting to none.
+ # config.collection_wrapper_class = nil
+
+ # You can wrap each item in a collection of radio/check boxes with a tag,
+ # defaulting to :span.
+ # config.item_wrapper_tag = :span
+
+ # You can define a class to use in all item wrappers. Defaulting to none.
+ # config.item_wrapper_class = nil
+
+ # How the label text should be generated altogether with the required text.
+ # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
+
+ # You can define the class to use on all labels. Default is nil.
+ # config.label_class = nil
+
+ # You can define the default class to be used on forms. Can be overridden
+ # with `html: { :class }`. Defaulting to none.
+ # config.default_form_class = nil
+
+ # You can define which elements should obtain additional classes
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
+
+ # Whether attributes are required by default (or not). Default is true.
+ # config.required_by_default = true
+
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
+ # These validations are enabled in SimpleForm's internal config but disabled by default
+ # in this configuration, which is recommended due to some quirks from different browsers.
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
+ # change this configuration to true.
+ config.browser_validations = false
+
+ # Custom mappings for input types. This should be a hash containing a regexp
+ # to match as key, and the input type that will be used when the field name
+ # matches the regexp as value.
+ # config.input_mappings = { /count/ => :integer }
+
+ # Custom wrappers for input types. This should be a hash containing an input
+ # type as key and the wrapper that will be used for all inputs with specified type.
+ # config.wrapper_mappings = { string: :prepend }
+
+ # Namespaces where SimpleForm should look for custom input classes that
+ # override default inputs.
+ # config.custom_inputs_namespaces << "CustomInputs"
+
+ # Default priority for time_zone inputs.
+ # config.time_zone_priority = nil
+
+ # Default priority for country inputs.
+ # config.country_priority = nil
+
+ # When false, do not use translations for labels.
+ # config.translate_labels = true
+
+ # Automatically discover new inputs in Rails' autoload path.
+ # config.inputs_discovery = true
+
+ # Cache SimpleForm inputs discovery
+ # config.cache_discovery = !Rails.env.development?
+
+ # Default class for inputs
+ # config.input_class = nil
+
+ # Define the default class of the input wrapper of the boolean input.
+ config.boolean_label_class = 'checkbox'
+
+ # Defines if the default input wrapper class should be included in radio
+ # collection wrappers.
+ # config.include_default_input_wrapper_class = true
+
+ # Defines which i18n scope will be used in Simple Form.
+ # config.i18n_scope = 'simple_form'
+
+ # Defines validation classes to the input_field. By default it's nil.
+ # config.input_field_valid_class = 'is-valid'
+ # config.input_field_error_class = 'is-invalid'
+end
diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb
new file mode 100644
index 000000000..7ec2ec6d3
--- /dev/null
+++ b/config/initializers/simple_form_bootstrap.rb
@@ -0,0 +1,372 @@
+# frozen_string_literal: true
+
+# These defaults are defined and maintained by the community at
+# https://github.com/heartcombo/simple_form-bootstrap
+# Please submit feedback, changes and tests only there.
+
+# Uncomment this and change the path if necessary to include your own
+# components.
+# See https://github.com/heartcombo/simple_form#custom-components
+# to know more about custom components.
+# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
+
+# Use this setup block to configure all options available in SimpleForm.
+SimpleForm.setup do |config|
+ # Default class for buttons
+ config.button_class = 'btn'
+
+ # Define the default class of the input wrapper of the boolean input.
+ config.boolean_label_class = 'form-check-label'
+
+ # How the label text should be generated altogether with the required text.
+ config.label_text = lambda { |label, required, explicit_label| "#{label} #{required}" }
+
+ # Define the way to render check boxes / radio buttons with labels.
+ config.boolean_style = :inline
+
+ # You can wrap each item in a collection of radio/check boxes with a tag
+ config.item_wrapper_tag = :div
+
+ # Defines if the default input wrapper class should be included in radio
+ # collection wrappers.
+ config.include_default_input_wrapper_class = false
+
+ # CSS class to add for error notification helper.
+ config.error_notification_class = 'alert alert-danger'
+
+ # Method used to tidy up errors. Specify any Rails Array method.
+ # :first lists the first message for each field.
+ # :to_sentence to list all errors for each field.
+ config.error_method = :to_sentence
+
+ # add validation classes to `input_field`
+ config.input_field_error_class = 'is-invalid'
+ config.input_field_valid_class = 'is-valid'
+
+
+ # vertical forms
+ #
+ # vertical default_wrapper
+ config.wrappers :vertical_form, class: 'mb-3' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :maxlength
+ b.optional :minlength
+ b.optional :pattern
+ b.optional :min_max
+ b.optional :readonly
+ b.use :label, class: 'form-label'
+ b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
+ b.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ b.use :hint, wrap_with: { class: 'form-text' }
+ end
+
+ # vertical input for boolean
+ config.wrappers :vertical_boolean, tag: 'fieldset', class: 'mb-3' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.wrapper :form_check_wrapper, class: 'form-check' do |bb|
+ bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
+ bb.use :label, class: 'form-check-label'
+ bb.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ bb.use :hint, wrap_with: { class: 'form-text' }
+ end
+ end
+
+ # vertical input for radio buttons and check boxes
+ config.wrappers :vertical_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label', tag: 'fieldset', class: 'mb-3' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
+ ba.use :label_text
+ end
+ b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
+ b.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
+ b.use :hint, wrap_with: { class: 'form-text' }
+ end
+
+ # vertical input for inline radio buttons and check boxes
+ config.wrappers :vertical_collection_inline, item_wrapper_class: 'form-check form-check-inline', item_label_class: 'form-check-label', tag: 'fieldset', class: 'mb-3' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
+ ba.use :label_text
+ end
+ b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
+ b.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
+ b.use :hint, wrap_with: { class: 'form-text' }
+ end
+
+ # vertical file input
+ config.wrappers :vertical_file, class: 'mb-3' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :maxlength
+ b.optional :minlength
+ b.optional :readonly
+ b.use :label, class: 'form-label'
+ b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
+ b.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ b.use :hint, wrap_with: { class: 'form-text' }
+ end
+
+ # vertical select input
+ config.wrappers :vertical_select, class: 'mb-3' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.use :label, class: 'form-label'
+ b.use :input, class: 'form-select', error_class: 'is-invalid', valid_class: 'is-valid'
+ b.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ b.use :hint, wrap_with: { class: 'form-text' }
+ end
+
+ # vertical multi select
+ config.wrappers :vertical_multi_select, class: 'mb-3' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.use :label, class: 'form-label'
+ b.wrapper class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
+ ba.use :input, class: 'form-select mx-1', error_class: 'is-invalid', valid_class: 'is-valid'
+ end
+ b.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
+ b.use :hint, wrap_with: { class: 'form-text' }
+ end
+
+ # vertical range input
+ config.wrappers :vertical_range, class: 'mb-3' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :readonly
+ b.optional :step
+ b.use :label, class: 'form-label'
+ b.use :input, class: 'form-range', error_class: 'is-invalid', valid_class: 'is-valid'
+ b.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ b.use :hint, wrap_with: { class: 'form-text' }
+ end
+
+
+ # horizontal forms
+ #
+ # horizontal default_wrapper
+ config.wrappers :horizontal_form, class: 'row mb-3' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :maxlength
+ b.optional :minlength
+ b.optional :pattern
+ b.optional :min_max
+ b.optional :readonly
+ b.use :label, class: 'col-sm-3 col-form-label'
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
+ ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ ba.use :hint, wrap_with: { class: 'form-text' }
+ end
+ end
+
+ # horizontal input for boolean
+ config.wrappers :horizontal_boolean, class: 'row mb-3' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.wrapper :grid_wrapper, class: 'col-sm-9 offset-sm-3' do |wr|
+ wr.wrapper :form_check_wrapper, class: 'form-check' do |bb|
+ bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
+ bb.use :label, class: 'form-check-label'
+ bb.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ bb.use :hint, wrap_with: { class: 'form-text' }
+ end
+ end
+ end
+
+ # horizontal input for radio buttons and check boxes
+ config.wrappers :horizontal_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label', class: 'row mb-3' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.use :label, class: 'col-sm-3 col-form-label pt-0'
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
+ ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
+ ba.use :hint, wrap_with: { class: 'form-text' }
+ end
+ end
+
+ # horizontal input for inline radio buttons and check boxes
+ config.wrappers :horizontal_collection_inline, item_wrapper_class: 'form-check form-check-inline', item_label_class: 'form-check-label', class: 'row mb-3' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.use :label, class: 'col-sm-3 col-form-label pt-0'
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
+ ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
+ ba.use :hint, wrap_with: { class: 'form-text' }
+ end
+ end
+
+ # horizontal file input
+ config.wrappers :horizontal_file, class: 'row mb-3' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :maxlength
+ b.optional :minlength
+ b.optional :readonly
+ b.use :label, class: 'col-sm-3 col-form-label'
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
+ ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ ba.use :hint, wrap_with: { class: 'form-text' }
+ end
+ end
+
+ # horizontal select input
+ config.wrappers :horizontal_select, class: 'row mb-3' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.use :label, class: 'col-sm-3 col-form-label'
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
+ ba.use :input, class: 'form-select', error_class: 'is-invalid', valid_class: 'is-valid'
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ ba.use :hint, wrap_with: { class: 'form-text' }
+ end
+ end
+
+ # horizontal multi select
+ config.wrappers :horizontal_multi_select, class: 'row mb-3' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.use :label, class: 'col-sm-3 col-form-label'
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
+ ba.wrapper class: 'd-flex flex-row justify-content-between align-items-center' do |bb|
+ bb.use :input, class: 'form-select mx-1', error_class: 'is-invalid', valid_class: 'is-valid'
+ end
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
+ ba.use :hint, wrap_with: { class: 'form-text' }
+ end
+ end
+
+ # horizontal range input
+ config.wrappers :horizontal_range, class: 'row mb-3' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :readonly
+ b.optional :step
+ b.use :label, class: 'col-sm-3 col-form-label pt-0'
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
+ ba.use :input, class: 'form-range', error_class: 'is-invalid', valid_class: 'is-valid'
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ ba.use :hint, wrap_with: { class: 'form-text' }
+ end
+ end
+
+
+ # inline forms
+ #
+ # inline default_wrapper
+ config.wrappers :inline_form, class: 'col-12' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :maxlength
+ b.optional :minlength
+ b.optional :pattern
+ b.optional :min_max
+ b.optional :readonly
+ b.use :label, class: 'visually-hidden'
+
+ b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
+ b.use :error, wrap_with: { class: 'invalid-feedback' }
+ b.optional :hint, wrap_with: { class: 'form-text' }
+ end
+
+ # inline input for boolean
+ config.wrappers :inline_boolean, class: 'col-12' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.wrapper :form_check_wrapper, class: 'form-check' do |bb|
+ bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
+ bb.use :label, class: 'form-check-label'
+ bb.use :error, wrap_with: { class: 'invalid-feedback' }
+ bb.optional :hint, wrap_with: { class: 'form-text' }
+ end
+ end
+
+
+ # bootstrap custom forms
+ #
+ # custom input switch for boolean
+ config.wrappers :custom_boolean_switch, class: 'mb-3' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.wrapper :form_check_wrapper, tag: 'div', class: 'form-check form-switch' do |bb|
+ bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
+ bb.use :label, class: 'form-check-label'
+ bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
+ bb.use :hint, wrap_with: { class: 'form-text' }
+ end
+ end
+
+
+ # Input Group - custom component
+ # see example app and config at https://github.com/heartcombo/simple_form-bootstrap
+ config.wrappers :input_group, class: 'mb-3' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :maxlength
+ b.optional :minlength
+ b.optional :pattern
+ b.optional :min_max
+ b.optional :readonly
+ b.use :label, class: 'form-label'
+ b.wrapper :input_group_tag, class: 'input-group' do |ba|
+ ba.optional :prepend
+ ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
+ ba.optional :append
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ end
+ b.use :hint, wrap_with: { class: 'form-text' }
+ end
+
+
+ # Floating Labels form
+ #
+ # floating labels default_wrapper
+ config.wrappers :floating_labels_form, class: 'form-floating mb-3' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :maxlength
+ b.optional :minlength
+ b.optional :pattern
+ b.optional :min_max
+ b.optional :readonly
+ b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
+ b.use :label
+ b.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ b.use :hint, wrap_with: { class: 'form-text' }
+ end
+
+ # custom multi select
+ config.wrappers :floating_labels_select, class: 'form-floating mb-3' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.use :input, class: 'form-select', error_class: 'is-invalid', valid_class: 'is-valid'
+ b.use :label
+ b.use :full_error, wrap_with: { class: 'invalid-feedback' }
+ b.use :hint, wrap_with: { class: 'form-text' }
+ end
+
+
+ # The default wrapper to be used by the FormBuilder.
+ config.default_wrapper = :vertical_form
+
+ # Custom wrappers for input types. This should be a hash containing an input
+ # type as key and the wrapper that will be used for all inputs with specified type.
+ config.wrapper_mappings = {
+ boolean: :vertical_boolean,
+ check_boxes: :vertical_collection,
+ date: :vertical_multi_select,
+ datetime: :vertical_multi_select,
+ file: :vertical_file,
+ radio_buttons: :vertical_collection,
+ range: :vertical_range,
+ time: :vertical_multi_select,
+ select: :vertical_select
+ }
+end
diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml
new file mode 100644
index 000000000..260e1c4ba
--- /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/locales/en.yml b/config/locales/en.yml
new file mode 100644
index 000000000..6c349ae5e
--- /dev/null
+++ b/config/locales/en.yml
@@ -0,0 +1,31 @@
+# Files in the config/locales directory are used for internationalization and
+# are automatically loaded by Rails. If you want to use locales other than
+# English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t "hello"
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t("hello") %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# To learn more about the API, please read the Rails Internationalization guide
+# at https://guides.rubyonrails.org/i18n.html.
+#
+# Be aware that YAML interprets the following case-insensitive strings as
+# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
+# must be quoted to be interpreted as strings. For example:
+#
+# en:
+# "yes": yup
+# enabled: "ON"
+
+en:
+ hello: "Hello world"
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
new file mode 100644
index 000000000..237438334
--- /dev/null
+++ b/config/locales/simple_form.en.yml
@@ -0,0 +1,31 @@
+en:
+ simple_form:
+ "yes": 'Yes'
+ "no": 'No'
+ required:
+ text: 'required'
+ mark: '*'
+ # You can uncomment the line below if you need to overwrite the whole required html.
+ # When using html, text and mark won't be used.
+ # html: '*'
+ error_notification:
+ default_message: "Please review the problems below:"
+ # Examples
+ # labels:
+ # defaults:
+ # password: 'Password'
+ # user:
+ # new:
+ # email: 'E-mail to sign in.'
+ # edit:
+ # email: 'E-mail.'
+ # hints:
+ # defaults:
+ # username: 'User name to sign in.'
+ # password: 'No special characters, please.'
+ # include_blanks:
+ # defaults:
+ # age: 'Rather not say'
+ # prompts:
+ # defaults:
+ # age: 'Select your age'
diff --git a/config/puma.rb b/config/puma.rb
new file mode 100644
index 000000000..a248513b2
--- /dev/null
+++ b/config/puma.rb
@@ -0,0 +1,41 @@
+# 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.
+#
+# Puma starts a configurable number of processes (workers) and each process
+# serves each request in a thread from an internal thread pool.
+#
+# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
+# should only set this value when you want to run 2 or more workers. The
+# default is already 1.
+#
+# The ideal number of threads per worker depends both on how much time the
+# application spends waiting for IO operations and on how much you wish to
+# prioritize throughput over latency.
+#
+# As a rule of thumb, increasing the number of threads will increase how much
+# traffic a given process can handle (throughput), but due to CRuby's
+# Global VM Lock (GVL) it has diminishing returns and will degrade the
+# response time (latency) of the application.
+#
+# The default is set to 3 threads as it's deemed a decent compromise between
+# throughput and latency for the average Rails application.
+#
+# Any libraries that use a connection pool or another resource pool should
+# be configured to provide at least as many connections as the number of
+# threads. This includes Active Record's `pool` parameter in `database.yml`.
+threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
+threads threads_count, threads_count
+
+# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
+port ENV.fetch("PORT", 3000)
+
+# Allow puma to be restarted by `bin/rails restart` command.
+plugin :tmp_restart
+
+# Run the Solid Queue supervisor inside of Puma for single-server deployments
+plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
+
+# Specify the PID file. Defaults to tmp/pids/server.pid in development.
+# In other environments, only set the PID file if requested.
+pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
diff --git a/config/queue.yml b/config/queue.yml
new file mode 100644
index 000000000..9eace59c4
--- /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 000000000..b4207f9b0
--- /dev/null
+++ b/config/recurring.yml
@@ -0,0 +1,15 @@
+# examples:
+# periodic_cleanup:
+# class: CleanSoftDeletedRecordsJob
+# queue: background
+# args: [ 1000, { batch_size: 500 } ]
+# schedule: every hour
+# periodic_cleanup_with_command:
+# command: "SoftDeletedRecord.due.delete_all"
+# priority: 2
+# schedule: at 5am every day
+
+production:
+ clear_solid_queue_finished_jobs:
+ command: "SolidQueue::Job.clear_finished_in_batches(sleep_between_batches: 0.3)"
+ schedule: every hour at minute 12
diff --git a/config/routes.rb b/config/routes.rb
new file mode 100644
index 000000000..aac062748
--- /dev/null
+++ b/config/routes.rb
@@ -0,0 +1,33 @@
+Rails.application.routes.draw do
+ devise_for :users
+
+ # Root routes
+ root to: "home#index"
+
+ # Admin routes
+ namespace :admin do
+ get "dashboard", to: "dashboard#index"
+
+ resources :users do
+ member do
+ patch :toggle_role
+ end
+ end
+
+ resources :imports, only: [ :index, :create, :show ]
+ end
+
+ # User profile routes
+ get "profile", to: "users#show"
+ get "profile/edit", to: "users#edit"
+ patch "profile", to: "users#update"
+ delete "profile", to: "users#destroy"
+
+ # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
+ # Can be used by load balancers and uptime monitors to verify that the app is live.
+ get "up" => "rails/health#show", as: :rails_health_check
+
+ # Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
+ # get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
+ # get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
+end
diff --git a/config/storage.yml b/config/storage.yml
new file mode 100644
index 000000000..4942ab669
--- /dev/null
+++ b/config/storage.yml
@@ -0,0 +1,34 @@
+test:
+ service: Disk
+ root: <%= Rails.root.join("tmp/storage") %>
+
+local:
+ service: Disk
+ root: <%= Rails.root.join("storage") %>
+
+# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
+# amazon:
+# service: S3
+# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
+# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
+# region: us-east-1
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Remember not to checkin your GCS keyfile to a repository
+# google:
+# service: GCS
+# project: your_project
+# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
+# microsoft:
+# service: AzureStorage
+# storage_account_name: your_account_name
+# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
+# container: your_container_name-<%= Rails.env %>
+
+# mirror:
+# service: Mirror
+# primary: local
+# mirrors: [ amazon, google, microsoft ]
diff --git a/db/cable_schema.rb b/db/cable_schema.rb
new file mode 100644
index 000000000..23666604a
--- /dev/null
+++ b/db/cable_schema.rb
@@ -0,0 +1,11 @@
+ActiveRecord::Schema[7.1].define(version: 1) do
+ create_table "solid_cable_messages", force: :cascade do |t|
+ t.binary "channel", limit: 1024, null: false
+ t.binary "payload", limit: 536870912, null: false
+ t.datetime "created_at", null: false
+ t.integer "channel_hash", limit: 8, null: false
+ t.index ["channel"], name: "index_solid_cable_messages_on_channel"
+ t.index ["channel_hash"], name: "index_solid_cable_messages_on_channel_hash"
+ t.index ["created_at"], name: "index_solid_cable_messages_on_created_at"
+ end
+end
diff --git a/db/cache_schema.rb b/db/cache_schema.rb
new file mode 100644
index 000000000..6005a2972
--- /dev/null
+++ b/db/cache_schema.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+ActiveRecord::Schema[7.2].define(version: 1) do
+ create_table "solid_cache_entries", force: :cascade do |t|
+ t.binary "key", limit: 1024, null: false
+ t.binary "value", limit: 536870912, null: false
+ t.datetime "created_at", null: false
+ t.integer "key_hash", limit: 8, null: false
+ t.integer "byte_size", limit: 4, null: false
+ t.index ["byte_size"], name: "index_solid_cache_entries_on_byte_size"
+ t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
+ t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
+ end
+end
diff --git a/db/migrate/20251106182316_devise_create_users.rb b/db/migrate/20251106182316_devise_create_users.rb
new file mode 100644
index 000000000..5d9d0c06f
--- /dev/null
+++ b/db/migrate/20251106182316_devise_create_users.rb
@@ -0,0 +1,48 @@
+# 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
+
+ ## Custom fields
+ t.string :full_name, null: false
+ t.string :role, null: false, default: "user"
+ t.string :avatar_url
+
+ 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/migrate/20251106183627_create_active_storage_tables.active_storage.rb b/db/migrate/20251106183627_create_active_storage_tables.active_storage.rb
new file mode 100644
index 000000000..6bd8bd082
--- /dev/null
+++ b/db/migrate/20251106183627_create_active_storage_tables.active_storage.rb
@@ -0,0 +1,57 @@
+# This migration comes from active_storage (originally 20170806125915)
+class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
+ def change
+ # Use Active Record's configured type for primary and foreign keys
+ primary_key_type, foreign_key_type = primary_and_foreign_key_types
+
+ create_table :active_storage_blobs, id: primary_key_type do |t|
+ t.string :key, null: false
+ t.string :filename, null: false
+ t.string :content_type
+ t.text :metadata
+ t.string :service_name, null: false
+ t.bigint :byte_size, null: false
+ t.string :checksum
+
+ if connection.supports_datetime_with_precision?
+ t.datetime :created_at, precision: 6, null: false
+ else
+ t.datetime :created_at, null: false
+ end
+
+ t.index [ :key ], unique: true
+ end
+
+ create_table :active_storage_attachments, id: primary_key_type do |t|
+ t.string :name, null: false
+ t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
+ t.references :blob, null: false, type: foreign_key_type
+
+ if connection.supports_datetime_with_precision?
+ t.datetime :created_at, precision: 6, null: false
+ else
+ t.datetime :created_at, null: false
+ end
+
+ t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+
+ create_table :active_storage_variant_records, id: primary_key_type do |t|
+ t.belongs_to :blob, null: false, index: false, type: foreign_key_type
+ t.string :variation_digest, null: false
+
+ t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+ end
+
+ private
+ def primary_and_foreign_key_types
+ config = Rails.configuration.generators
+ setting = config.options[config.orm][:primary_key_type]
+ primary_key_type = setting || :primary_key
+ foreign_key_type = setting || :bigint
+ [ primary_key_type, foreign_key_type ]
+ end
+end
diff --git a/db/migrate/20251106184110_create_imports.rb b/db/migrate/20251106184110_create_imports.rb
new file mode 100644
index 000000000..5af7d0855
--- /dev/null
+++ b/db/migrate/20251106184110_create_imports.rb
@@ -0,0 +1,15 @@
+class CreateImports < ActiveRecord::Migration[8.0]
+ def change
+ create_table :imports do |t|
+ t.string :file_name
+ t.string :status
+ t.integer :progress
+ t.integer :total_rows
+ t.integer :processed_rows
+ t.text :error_details
+ t.references :user, null: false, foreign_key: true
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20251106192110_add_trackable_to_users.rb b/db/migrate/20251106192110_add_trackable_to_users.rb
new file mode 100644
index 000000000..3ee2ca547
--- /dev/null
+++ b/db/migrate/20251106192110_add_trackable_to_users.rb
@@ -0,0 +1,9 @@
+class AddTrackableToUsers < ActiveRecord::Migration[8.0]
+ def change
+ add_column :users, :sign_in_count, :integer, default: 0, null: false
+ add_column :users, :current_sign_in_at, :datetime
+ add_column :users, :last_sign_in_at, :datetime
+ add_column :users, :current_sign_in_ip, :string
+ add_column :users, :last_sign_in_ip, :string
+ end
+end
diff --git a/db/migrate/20251110195347_add_counters_to_imports.rb b/db/migrate/20251110195347_add_counters_to_imports.rb
new file mode 100644
index 000000000..9a8867f1f
--- /dev/null
+++ b/db/migrate/20251110195347_add_counters_to_imports.rb
@@ -0,0 +1,6 @@
+class AddCountersToImports < ActiveRecord::Migration[8.0]
+ def change
+ add_column :imports, :successful_rows, :integer, default: 0, null: false
+ add_column :imports, :failed_rows, :integer, default: 0, null: false
+ end
+end
diff --git a/db/migrate/20251110195421_change_progress_type_in_imports.rb b/db/migrate/20251110195421_change_progress_type_in_imports.rb
new file mode 100644
index 000000000..69e85f580
--- /dev/null
+++ b/db/migrate/20251110195421_change_progress_type_in_imports.rb
@@ -0,0 +1,7 @@
+class ChangeProgressTypeInImports < ActiveRecord::Migration[8.0]
+ def change
+ change_column :imports, :progress, :float, default: 0.0, null: false
+ change_column :imports, :total_rows, :integer, default: 0, null: false
+ change_column :imports, :processed_rows, :integer, default: 0, null: false
+ end
+end
diff --git a/db/queue_schema.rb b/db/queue_schema.rb
new file mode 100644
index 000000000..85194b6a8
--- /dev/null
+++ b/db/queue_schema.rb
@@ -0,0 +1,129 @@
+ActiveRecord::Schema[7.1].define(version: 1) do
+ 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
+
+ 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
diff --git a/db/schema.rb b/db/schema.rb
new file mode 100644
index 000000000..b964c159a
--- /dev/null
+++ b/db/schema.rb
@@ -0,0 +1,83 @@
+# 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.
+#
+# This file is the source Rails uses to define your schema when running `bin/rails
+# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
+# be faster and is potentially less error prone than running all of your
+# migrations from scratch. Old migrations may fail to apply correctly if those
+# migrations use external dependencies or application code.
+#
+# It's strongly recommended that you check this file into your version control system.
+
+ActiveRecord::Schema[8.0].define(version: 2025_11_10_195421) do
+ # These are extensions that must be enabled in order to support this database
+ enable_extension "pg_catalog.plpgsql"
+
+ create_table "active_storage_attachments", force: :cascade do |t|
+ t.string "name", null: false
+ t.string "record_type", null: false
+ t.bigint "record_id", null: false
+ t.bigint "blob_id", null: false
+ t.datetime "created_at", null: false
+ t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
+ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
+ end
+
+ create_table "active_storage_blobs", force: :cascade do |t|
+ t.string "key", null: false
+ t.string "filename", null: false
+ t.string "content_type"
+ t.text "metadata"
+ t.string "service_name", null: false
+ t.bigint "byte_size", null: false
+ t.string "checksum"
+ t.datetime "created_at", null: false
+ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
+ end
+
+ create_table "active_storage_variant_records", force: :cascade do |t|
+ t.bigint "blob_id", null: false
+ t.string "variation_digest", null: false
+ t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
+ end
+
+ create_table "imports", force: :cascade do |t|
+ t.string "file_name"
+ t.string "status"
+ t.float "progress", default: 0.0, null: false
+ t.integer "total_rows", default: 0, null: false
+ t.integer "processed_rows", default: 0, null: false
+ t.text "error_details"
+ t.integer "user_id", null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.integer "successful_rows", default: 0, null: false
+ t.integer "failed_rows", default: 0, null: false
+ t.index ["user_id"], name: "index_imports_on_user_id"
+ 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.string "full_name", null: false
+ t.string "role", default: "user", null: false
+ t.string "avatar_url"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ 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"
+ 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 "active_storage_attachments", "active_storage_blobs", column: "blob_id"
+ add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
+ add_foreign_key "imports", "users"
+end
diff --git a/db/seeds.rb b/db/seeds.rb
new file mode 100644
index 000000000..468447a0b
--- /dev/null
+++ b/db/seeds.rb
@@ -0,0 +1,90 @@
+# This file should ensure the existence of records required to run the application in every environment (production,
+# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
+# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
+#
+# Example:
+#
+# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
+# MovieGenre.find_or_create_by!(name: genre_name)
+# end
+
+puts "š± Seeding database..."
+
+# Create admin user
+admin_email = "admin@example.com"
+admin_user = User.find_or_initialize_by(email: admin_email)
+
+if admin_user.new_record?
+ admin_user.assign_attributes(
+ full_name: "Administrator",
+ role: "admin",
+ password: "password123",
+ password_confirmation: "password123"
+ )
+
+ if admin_user.save
+ puts "ā Admin user created successfully!"
+ puts " Email: #{admin_user.email}"
+ puts " Password: password123"
+ puts " Role: #{admin_user.role}"
+ else
+ puts "ā Failed to create admin user:"
+ admin_user.errors.full_messages.each do |error|
+ puts " - #{error}"
+ end
+ end
+else
+ puts "ā¹ļø Admin user already exists (#{admin_email})"
+end
+
+# Create some sample regular users for testing
+sample_users = [
+ {
+ full_name: "João Silva",
+ email: "joao@example.com",
+ role: "user"
+ },
+ {
+ full_name: "Maria Santos",
+ email: "maria@example.com",
+ role: "user"
+ },
+ {
+ full_name: "Pedro Oliveira",
+ email: "pedro@example.com",
+ role: "user"
+ }
+]
+
+puts "\nš„ Creating sample users..."
+
+sample_users.each do |user_data|
+ user = User.find_or_initialize_by(email: user_data[:email])
+
+ if user.new_record?
+ user.assign_attributes(
+ full_name: user_data[:full_name],
+ role: user_data[:role],
+ password: "password123",
+ password_confirmation: "password123"
+ )
+
+ if user.save
+ puts "ā Created user: #{user.full_name} (#{user.email})"
+ else
+ puts "ā Failed to create user #{user_data[:email]}:"
+ user.errors.full_messages.each do |error|
+ puts " - #{error}"
+ end
+ end
+ else
+ puts "ā¹ļø User already exists: #{user_data[:email]}"
+ end
+end
+
+puts "\nš Database summary:"
+puts " Total users: #{User.count}"
+puts " Admin users: #{User.admin.count}"
+puts " Regular users: #{User.user.count}"
+
+puts "\nš Seeding completed!"
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 000000000..2117c17c1
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,79 @@
+services:
+ # PostgreSQL Database
+ postgres:
+ image: postgres:15-alpine
+ environment:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: password
+ POSTGRES_DB: user_management_development
+ volumes:
+ - postgres_data:/var/lib/postgresql/data
+ ports:
+ - "5432:5432"
+ healthcheck:
+ test: ["CMD-SHELL", "pg_isready -U postgres"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ # Redis for Sidekiq
+ redis:
+ image: redis:7-alpine
+ ports:
+ - "6379:6379"
+ healthcheck:
+ test: ["CMD", "redis-cli", "ping"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ # Rails Application
+ web:
+ build:
+ context: .
+ dockerfile: Dockerfile.dev
+ ports:
+ - "3000:3000"
+ environment:
+ - RAILS_ENV=development
+ - DATABASE_URL=postgresql://postgres:password@postgres:5432/user_management_development
+ - REDIS_URL=redis://redis:6379/0
+ - RAILS_MASTER_KEY=${RAILS_MASTER_KEY}
+ volumes:
+ - .:/rails
+ - bundle_cache:/usr/local/bundle
+ - /rails/tmp
+ - /rails/log
+ depends_on:
+ postgres:
+ condition: service_healthy
+ redis:
+ condition: service_healthy
+ stdin_open: true
+ tty: true
+
+ # Sidekiq Background Jobs
+ sidekiq:
+ build:
+ context: .
+ dockerfile: Dockerfile.dev
+ environment:
+ - RAILS_ENV=development
+ - DATABASE_URL=postgresql://postgres:password@postgres:5432/user_management_development
+ - REDIS_URL=redis://redis:6379/0
+ - RAILS_MASTER_KEY=${RAILS_MASTER_KEY}
+ volumes:
+ - .:/rails
+ - bundle_cache:/usr/local/bundle
+ depends_on:
+ postgres:
+ condition: service_healthy
+ redis:
+ condition: service_healthy
+ web:
+ condition: service_started
+ command: ["bundle", "exec", "sidekiq"]
+
+volumes:
+ postgres_data:
+ bundle_cache:
\ No newline at end of file
diff --git a/docker-entrypoint.dev.sh b/docker-entrypoint.dev.sh
new file mode 100755
index 000000000..c2a5f11a1
--- /dev/null
+++ b/docker-entrypoint.dev.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+set -e
+
+# Function to wait for PostgreSQL
+wait_for_postgres() {
+ echo "Waiting for PostgreSQL..."
+ while ! pg_isready -h postgres -p 5432 -U postgres; do
+ echo "PostgreSQL is unavailable - sleeping"
+ sleep 1
+ done
+ echo "PostgreSQL is up - executing command"
+}
+
+# Function to setup database
+setup_database() {
+ echo "Setting up database..."
+ bundle exec rails db:create 2>/dev/null || echo "Database already exists"
+ bundle exec rails db:migrate
+ bundle exec rails db:seed 2>/dev/null || echo "Seeds already run or failed"
+}
+
+# Install dependencies
+echo "Installing dependencies..."
+bundle check || bundle install
+
+# Wait for services
+wait_for_postgres
+
+# Setup database if this is the web service
+if [ "$1" = "rails" ] && [ "$2" = "server" ]; then
+ setup_database
+fi
+
+# Execute the main command
+exec "$@"
\ No newline at end of file
diff --git a/lib/tasks/.keep b/lib/tasks/.keep
new file mode 100644
index 000000000..e69de29bb
diff --git a/lib/templates/erb/scaffold/_form.html.erb b/lib/templates/erb/scaffold/_form.html.erb
new file mode 100644
index 000000000..106b71eef
--- /dev/null
+++ b/lib/templates/erb/scaffold/_form.html.erb
@@ -0,0 +1,15 @@
+<%# frozen_string_literal: true %>
+<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
+ <%%= f.error_notification %>
+ <%%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
+
+
+<%% end %>
diff --git a/log/.keep b/log/.keep
new file mode 100644
index 000000000..e69de29bb
diff --git a/public/400.html b/public/400.html
new file mode 100644
index 000000000..282dbc8cc
--- /dev/null
+++ b/public/400.html
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+ The server cannot process the request due to a client error (400 Bad Request)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The server cannot process the request due to a client error. Please check the request and try again. If youāre the application owner check the logs for more information.
+
+
+
+
+
+
diff --git a/public/404.html b/public/404.html
new file mode 100644
index 000000000..c0670bc87
--- /dev/null
+++ b/public/404.html
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+ The page you were looking for doesnāt exist (404 Not found)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The page you were looking for doesnāt exist. You may have mistyped the address or the page may have moved. If youāre the application owner check the logs for more information.
+
+
+
+
+
+
diff --git a/public/406-unsupported-browser.html b/public/406-unsupported-browser.html
new file mode 100644
index 000000000..9532a9ccd
--- /dev/null
+++ b/public/406-unsupported-browser.html
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+ Your browser is not supported (406 Not Acceptable)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Your browser is not supported. Please upgrade your browser to continue.
The change you wanted was rejected. Maybe you tried to change something you didnāt have access to. If youāre the application owner check the logs for more information.