neeto-jwt-engine 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +89 -0
  3. data/Rakefile +20 -0
  4. data/app/controllers/concerns/neeto_jwt_engine/api_exceptions.rb +77 -0
  5. data/app/controllers/concerns/neeto_jwt_engine/authenticatable.rb +20 -0
  6. data/app/controllers/neeto_jwt_engine/application_controller.rb +7 -0
  7. data/app/controllers/neeto_jwt_engine/configurations_controller.rb +54 -0
  8. data/app/models/concerns/neeto_jwt_engine/incinerable_concern.rb +26 -0
  9. data/app/models/neeto_jwt_engine/application_record.rb +7 -0
  10. data/app/models/neeto_jwt_engine/configuration.rb +24 -0
  11. data/app/models/neeto_jwt_engine/onetime_link.rb +19 -0
  12. data/app/services/neeto_jwt_engine/elliptic_key_generator_service.rb +44 -0
  13. data/app/views/layouts/neeto_jwt_engine/application.html.erb +15 -0
  14. data/config/brakeman.ignore +5 -0
  15. data/config/locales/en.yml +1 -0
  16. data/config/routes.rb +7 -0
  17. data/db/migrate/20250329064017_create_neeto_jwt_engine_configurations.rb +14 -0
  18. data/db/migrate/20250716075611_create_neeto_jwt_engine_onetime_links.rb +13 -0
  19. data/lib/neeto-jwt-engine.rb +5 -0
  20. data/lib/neeto_jwt_engine/engine.rb +7 -0
  21. data/lib/neeto_jwt_engine/exceptions.rb +5 -0
  22. data/lib/neeto_jwt_engine/version.rb +5 -0
  23. data/lib/omniauth/strategies/jwt.rb +93 -0
  24. data/test/controllers/neeto_jwt_engine/configurations_controller_test.rb +58 -0
  25. data/test/dummy/Rakefile +8 -0
  26. data/test/dummy/app/assets/config/manifest.js +3 -0
  27. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  28. data/test/dummy/app/channels/application_cable/channel.rb +6 -0
  29. data/test/dummy/app/channels/application_cable/connection.rb +6 -0
  30. data/test/dummy/app/controllers/application_controller.rb +5 -0
  31. data/test/dummy/app/controllers/concerns/sso_helpers.rb +20 -0
  32. data/test/dummy/app/helpers/application_helper.rb +4 -0
  33. data/test/dummy/app/javascript/packs/application.js +19 -0
  34. data/test/dummy/app/jobs/application_job.rb +9 -0
  35. data/test/dummy/app/mailers/application_mailer.rb +6 -0
  36. data/test/dummy/app/models/application_record.rb +5 -0
  37. data/test/dummy/app/models/organization.rb +10 -0
  38. data/test/dummy/app/models/user.rb +11 -0
  39. data/test/dummy/app/services/sample_data/common/admin_service.rb +26 -0
  40. data/test/dummy/app/services/sample_data/common/base.rb +43 -0
  41. data/test/dummy/app/services/sample_data/common/database_cleanup_service.rb +11 -0
  42. data/test/dummy/app/services/sample_data/common/loader_service.rb +34 -0
  43. data/test/dummy/app/services/sample_data/common/organization_service.rb +27 -0
  44. data/test/dummy/app/services/sample_data/loaders_list.rb +14 -0
  45. data/test/dummy/app/services/sample_data/user_service.rb +26 -0
  46. data/test/dummy/app/views/home/index.html.erb +1 -0
  47. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  48. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  49. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  50. data/test/dummy/app/views/users/index.json.jbuilder +19 -0
  51. data/test/dummy/bin/rails +6 -0
  52. data/test/dummy/bin/rake +6 -0
  53. data/test/dummy/bin/setup +37 -0
  54. data/test/dummy/bin/webpacker +16 -0
  55. data/test/dummy/bin/webpacker-dev-server +19 -0
  56. data/test/dummy/config/application.rb +29 -0
  57. data/test/dummy/config/boot.rb +7 -0
  58. data/test/dummy/config/cable.yml +10 -0
  59. data/test/dummy/config/database.yml +17 -0
  60. data/test/dummy/config/database.yml.ci +17 -0
  61. data/test/dummy/config/database.yml.postgresql +17 -0
  62. data/test/dummy/config/environment.rb +7 -0
  63. data/test/dummy/config/environments/development.rb +70 -0
  64. data/test/dummy/config/environments/production.rb +116 -0
  65. data/test/dummy/config/environments/test.rb +63 -0
  66. data/test/dummy/config/initializers/application_controller_renderer.rb +9 -0
  67. data/test/dummy/config/initializers/backtrace_silencers.rb +10 -0
  68. data/test/dummy/config/initializers/content_security_policy.rb +29 -0
  69. data/test/dummy/config/initializers/cookies_serializer.rb +7 -0
  70. data/test/dummy/config/initializers/inflections.rb +17 -0
  71. data/test/dummy/config/initializers/mime_types.rb +5 -0
  72. data/test/dummy/config/initializers/permissions_policy.rb +12 -0
  73. data/test/dummy/config/initializers/strong_migrations.rb +4 -0
  74. data/test/dummy/config/initializers/wrap_parameters.rb +16 -0
  75. data/test/dummy/config/locales/en.yml +33 -0
  76. data/test/dummy/config/puma.rb +45 -0
  77. data/test/dummy/config/routes.rb +13 -0
  78. data/test/dummy/config/storage.yml +34 -0
  79. data/test/dummy/config/webpack/development.js +5 -0
  80. data/test/dummy/config/webpack/environment.js +13 -0
  81. data/test/dummy/config/webpack/production.js +5 -0
  82. data/test/dummy/config/webpack/resolve.js +11 -0
  83. data/test/dummy/config/webpack/test.js +5 -0
  84. data/test/dummy/config/webpack/webpack.config.js +20 -0
  85. data/test/dummy/config/webpacker.yml +73 -0
  86. data/test/dummy/config.ru +8 -0
  87. data/test/dummy/db/migrate/20220419104218_create_organizations.rb +15 -0
  88. data/test/dummy/db/migrate/20220419114209_create_users.rb +20 -0
  89. data/test/dummy/db/migrate/20240607032904_add_deactivated_at_to_organizations.rb +7 -0
  90. data/test/dummy/db/schema.rb +68 -0
  91. data/test/dummy/lib/tasks/setup.rake +48 -0
  92. data/test/dummy/log/development.log +71 -0
  93. data/test/dummy/log/test.log +5189 -0
  94. data/test/dummy/public/404.html +67 -0
  95. data/test/dummy/public/422.html +67 -0
  96. data/test/dummy/public/500.html +66 -0
  97. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  98. data/test/dummy/public/apple-touch-icon.png +0 -0
  99. data/test/dummy/public/favicon.ico +0 -0
  100. data/test/dummy/tmp/local_secret.txt +1 -0
  101. data/test/dummy/tmp/restart.txt +0 -0
  102. data/test/factories/neeto_jwt_engine/configuration.rb +7 -0
  103. data/test/factories/neeto_jwt_engine/onetime_link.rb +7 -0
  104. data/test/factories/organization.rb +8 -0
  105. data/test/factories/user.rb +13 -0
  106. data/test/models/neeto_jwt_engine/configuration_test.rb +23 -0
  107. data/test/models/neeto_jwt_engine/onetime_link_test.rb +27 -0
  108. data/test/neeto_jwt_engine_test.rb +12 -0
  109. data/test/services/neeto_jwt_engine/elliptic_key_generator_service_test.rb +30 -0
  110. data/test/support/assertion_support.rb +9 -0
  111. data/test/test_helper.rb +30 -0
  112. metadata +168 -0
@@ -0,0 +1,116 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/integer/time"
4
+
5
+ Rails.application.configure do
6
+ # Settings specified here will take precedence over those in config/application.rb.
7
+
8
+ # Code is not reloaded between requests.
9
+ config.cache_classes = true
10
+
11
+ # Eager load code on boot. This eager loads most of Rails and
12
+ # your application in memory, allowing both threaded web servers
13
+ # and those relying on copy on write to perform better.
14
+ # Rake tasks automatically ignore this option for performance.
15
+ config.eager_load = true
16
+
17
+ # Full error reports are disabled and caching is turned on.
18
+ config.consider_all_requests_local = false
19
+ config.action_controller.perform_caching = true
20
+
21
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
22
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
23
+ # config.require_master_key = true
24
+
25
+ # Disable serving static files from the `/public` folder by default since
26
+ # Apache or NGINX already handles this.
27
+ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
28
+
29
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
30
+ # config.asset_host = 'http://assets.example.com'
31
+
32
+ # Specifies the header that your server uses for sending files.
33
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
34
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
35
+
36
+ # Store uploaded files on the local file system (see config/storage.yml for options).
37
+ config.active_storage.service = :local
38
+
39
+ # Mount Action Cable outside main process or domain.
40
+ # config.action_cable.mount_path = nil
41
+ # config.action_cable.url = 'wss://example.com/cable'
42
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
43
+
44
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45
+ # config.force_ssl = true
46
+
47
+ # Include generic and useful information about system operation, but avoid logging too much
48
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
49
+ config.log_level = :info
50
+
51
+ # Prepend all log lines with the following tags.
52
+ config.log_tags = [ :request_id ]
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Use a real queuing backend for Active Job (and separate queues per environment).
58
+ # config.active_job.queue_adapter = :resque
59
+ # config.active_job.queue_name_prefix = "dummy_production"
60
+
61
+ config.action_mailer.perform_caching = false
62
+
63
+ # Ignore bad email addresses and do not raise email delivery errors.
64
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65
+ # config.action_mailer.raise_delivery_errors = false
66
+
67
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68
+ # the I18n.default_locale when a translation cannot be found).
69
+ config.i18n.fallbacks = true
70
+
71
+ # Send deprecation notices to registered listeners.
72
+ config.active_support.deprecation = :notify
73
+
74
+ # Log disallowed deprecations.
75
+ config.active_support.disallowed_deprecation = :log
76
+
77
+ # Tell Active Support which deprecation messages to disallow.
78
+ config.active_support.disallowed_deprecation_warnings = []
79
+
80
+ # Use default logging formatter so that PID and timestamp are not suppressed.
81
+ config.log_formatter = ::Logger::Formatter.new
82
+
83
+ # Use a different logger for distributed setups.
84
+ # require "syslog/logger"
85
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
86
+
87
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
88
+ logger = ActiveSupport::Logger.new(STDOUT)
89
+ logger.formatter = config.log_formatter
90
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
91
+ end
92
+
93
+ # Do not dump schema after migrations.
94
+ config.active_record.dump_schema_after_migration = false
95
+
96
+ # Inserts middleware to perform automatic connection switching.
97
+ # The `database_selector` hash is used to pass options to the DatabaseSelector
98
+ # middleware. The `delay` is used to determine how long to wait after a write
99
+ # to send a subsequent read to the primary.
100
+ #
101
+ # The `database_resolver` class is used by the middleware to determine which
102
+ # database is appropriate to use based on the time delay.
103
+ #
104
+ # The `database_resolver_context` class is used by the middleware to set
105
+ # timestamps for the last write to the primary. The resolver uses the context
106
+ # class timestamps to determine how long to wait before reading from the
107
+ # replica.
108
+ #
109
+ # By default Rails will store a last write timestamp in the session. The
110
+ # DatabaseSelector middleware is designed as such you can define your own
111
+ # strategy for connection switching and pass that into the middleware through
112
+ # these configuration options.
113
+ # config.active_record.database_selector = { delay: 2.seconds }
114
+ # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
115
+ # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
116
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "factory_bot_rails"
4
+ require "active_support/core_ext/integer/time"
5
+
6
+ # The test environment is used exclusively to run your application's
7
+ # test suite. You never need to work with it otherwise. Remember that
8
+ # your test database is "scratch space" for the test suite and is wiped
9
+ # and recreated between test runs. Don't rely on the data there!
10
+
11
+ Rails.application.configure do
12
+ # Settings specified here will take precedence over those in config/application.rb.
13
+
14
+ config.cache_classes = true
15
+
16
+ # Do not eager load code on boot. This avoids loading your whole application
17
+ # just for the purpose of running a single test. If you are using a tool that
18
+ # preloads Rails for running tests, you may have to set it to true.
19
+ config.eager_load = false
20
+
21
+ # Configure public file server for tests with Cache-Control for performance.
22
+ config.public_file_server.enabled = true
23
+ config.public_file_server.headers = {
24
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
25
+ }
26
+
27
+ # Show full error reports and disable caching.
28
+ config.consider_all_requests_local = true
29
+ config.action_controller.perform_caching = false
30
+ config.cache_store = :null_store
31
+
32
+ # Raise exceptions instead of rendering exception templates.
33
+ config.action_dispatch.show_exceptions = false
34
+
35
+ # Disable request forgery protection in test environment.
36
+ config.action_controller.allow_forgery_protection = false
37
+
38
+ # Store uploaded files on the local file system in a temporary directory.
39
+ config.active_storage.service = :test
40
+
41
+ config.action_mailer.perform_caching = false
42
+
43
+ # Tell Action Mailer not to deliver emails to the real world.
44
+ # The :test delivery method accumulates sent emails in the
45
+ # ActionMailer::Base.deliveries array.
46
+ config.action_mailer.delivery_method = :test
47
+
48
+ # Print deprecation notices to the stderr.
49
+ config.active_support.deprecation = :stderr
50
+
51
+ # Raise exceptions for disallowed deprecations.
52
+ config.active_support.disallowed_deprecation = :raise
53
+
54
+ # Tell Active Support which deprecation messages to disallow.
55
+ config.active_support.disallowed_deprecation_warnings = []
56
+
57
+ # Raises error for missing translations.
58
+ # config.i18n.raise_on_missing_translations = true
59
+
60
+ # Annotate rendered view with file names.
61
+ # config.action_view.annotate_rendered_view_with_filenames = true
62
+ config.factory_bot.definition_file_paths = ["../../test/factories"]
63
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # ActiveSupport::Reloader.to_prepare do
5
+ # ApplicationController.renderer.defaults.merge!(
6
+ # http_host: 'example.org',
7
+ # https: false
8
+ # )
9
+ # end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
6
+ # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
7
+
8
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
9
+ # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
10
+ Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # Define an application-wide content security policy
5
+ # For further information see the following documentation
6
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
7
+
8
+ # Rails.application.config.content_security_policy do |policy|
9
+ # policy.default_src :self, :https
10
+ # policy.font_src :self, :https, :data
11
+ # policy.img_src :self, :https, :data
12
+ # policy.object_src :none
13
+ # policy.script_src :self, :https
14
+ # policy.style_src :self, :https
15
+
16
+ # # Specify URI for violation reports
17
+ # # policy.report_uri "/csp-violation-report-endpoint"
18
+ # end
19
+
20
+ # If you are using UJS then enable automatic nonce generation
21
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
22
+
23
+ # Set the nonce only to specific directives
24
+ # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
25
+
26
+ # Report CSP violations to a specified URI
27
+ # For further information see the following documentation:
28
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
29
+ # Rails.application.config.content_security_policy_report_only = true
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Specify a serializer for the signed and encrypted cookie jars.
6
+ # Valid options are :json, :marshal, and :hybrid.
7
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # Add new inflection rules using the following format. Inflections
5
+ # are locale specific, and you may define rules for as many different
6
+ # locales as you wish. All of these examples are active by default:
7
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
8
+ # inflect.plural /^(ox)$/i, '\1en'
9
+ # inflect.singular /^(ox)en/i, '\1'
10
+ # inflect.irregular 'person', 'people'
11
+ # inflect.uncountable %w( fish sheep )
12
+ # end
13
+
14
+ # These inflection rules are supported but not enabled by default:
15
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
16
+ # inflect.acronym 'RESTful'
17
+ # end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # Add new mime types for use in respond_to blocks:
5
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ # Define an application-wide HTTP permissions policy. For further
3
+ # information see https://developers.google.com/web/updates/2018/06/feature-policy
4
+ #
5
+ # Rails.application.config.permissions_policy do |f|
6
+ # f.camera :none
7
+ # f.gyroscope :none
8
+ # f.microphone :none
9
+ # f.usb :none
10
+ # f.fullscreen :self
11
+ # f.payment :self, "https://secure.example.com"
12
+ # end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Mark existing migrations as safe
4
+ ENV["SAFETY_ASSURED"] = "true"
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # This file contains settings for ActionController::ParamsWrapper which
6
+ # is enabled by default.
7
+
8
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
9
+ ActiveSupport.on_load(:action_controller) do
10
+ wrap_parameters format: [:json]
11
+ end
12
+
13
+ # To enable root element in JSON for ActiveRecord objects.
14
+ # ActiveSupport.on_load(:active_record) do
15
+ # self.include_root_in_json = true
16
+ # end
@@ -0,0 +1,33 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
29
+ # To learn more, please read the Rails Internationalization guide
30
+ # available at https://guides.rubyonrails.org/i18n.html.
31
+
32
+ en:
33
+ hello: "Hello world"
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Puma can serve each request in a thread from an internal thread pool.
4
+ # The `threads` method setting takes two numbers: a minimum and maximum.
5
+ # Any libraries that use thread pools should be configured to match
6
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
7
+ # and maximum; this matches the default thread size of Active Record.
8
+ #
9
+ max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
10
+ min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
11
+ threads min_threads_count, max_threads_count
12
+
13
+ # Specifies the `worker_timeout` threshold that Puma will use to wait before
14
+ # terminating a worker in development environments.
15
+ #
16
+ worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
17
+
18
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
19
+ #
20
+ port ENV.fetch("PORT") { 3000 }
21
+
22
+ # Specifies the `environment` that Puma will run in.
23
+ #
24
+ environment ENV.fetch("RAILS_ENV") { "development" }
25
+
26
+ # Specifies the `pidfile` that Puma will use.
27
+ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
28
+
29
+ # Specifies the number of `workers` to boot in clustered mode.
30
+ # Workers are forked web server processes. If using threads and workers together
31
+ # the concurrency of the application would be max `threads` * `workers`.
32
+ # Workers do not work on JRuby or Windows (both of which do not support
33
+ # processes).
34
+ #
35
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
36
+
37
+ # Use the `preload_app!` method when specifying a `workers` number.
38
+ # This directive tells Puma to first boot the application and load code
39
+ # before forking the application. This takes advantage of Copy On Write
40
+ # process behavior so workers use less memory.
41
+ #
42
+ # preload_app!
43
+
44
+ # Allow puma to be restarted by `rails restart` command.
45
+ plugin :tmp_restart
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.routes.draw do
4
+ defaults format: :json do
5
+ resources :users, only: %i[index]
6
+ end
7
+
8
+ mount NeetoJwtEngine::Engine => "/neeto_jwt"
9
+
10
+ get "home/index"
11
+ root "home#index"
12
+ get "*path", to: "home#index", via: :all
13
+ end
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket
23
+
24
+ # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
@@ -0,0 +1,5 @@
1
+ process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2
+
3
+ const environment = require('./environment')
4
+
5
+ module.exports = environment;
@@ -0,0 +1,13 @@
1
+ const { webpackConfig, merge } = require("shakapacker");
2
+
3
+ const resolve = require("./resolve");
4
+
5
+ const commonOptions = {
6
+ infrastructureLogging: {
7
+ level: "warn",
8
+ },
9
+ resolve,
10
+ };
11
+
12
+ const commonWebpackConfig = () => merge({}, webpackConfig, commonOptions);
13
+ module.exports = commonWebpackConfig
@@ -0,0 +1,5 @@
1
+ process.env.NODE_ENV = process.env.NODE_ENV || 'production'
2
+
3
+ const environment = require('./environment')
4
+
5
+ module.exports = environment;
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ alias: {
3
+ apis: "src/apis",
4
+ common: "src/common",
5
+ components: "src/components",
6
+ constants: "src/constants",
7
+ contexts: "src/contexts",
8
+ reducers: "src/reducers",
9
+ hooks: "src/hooks",
10
+ },
11
+ };
@@ -0,0 +1,5 @@
1
+ process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2
+
3
+ const environment = require('./environment')
4
+
5
+ module.exports = environment;
@@ -0,0 +1,20 @@
1
+ const { existsSync } = require("fs");
2
+ const { resolve } = require("path");
3
+
4
+ const { env } = require("shakapacker");
5
+
6
+ const envSpecificConfig = () => {
7
+ const path = resolve(__dirname, `${env.nodeEnv}.js`);
8
+ if (existsSync(path)) {
9
+ // console.log(`Loading ENV specific webpack configuration file ${path}`)
10
+ return require(path);
11
+ }
12
+
13
+ // Probably an error if the file for the NODE_ENV does not exist
14
+ throw new Error(`Got Error with NODE_ENV = ${env.nodeEnv}`);
15
+ };
16
+
17
+ // See the shakacode/shakapacker README and docs directory for advice on customizing your webpackConfig.
18
+ const webpackConfiguration = envSpecificConfig();
19
+
20
+ module.exports = webpackConfiguration;
@@ -0,0 +1,73 @@
1
+ # Note: You must restart bin/webpacker-dev-server for changes to take effect
2
+
3
+ default: &default
4
+ source_path: app/javascript
5
+ source_entry_path: packs
6
+ public_root_path: public
7
+ public_output_path: packs
8
+ cache_path: tmp/cache/webpacker
9
+ check_yarn_integrity: false
10
+ webpack_compile_output: false
11
+
12
+ # Additional paths webpack should look up modules
13
+ # ['app/assets', 'engine/foo/app/assets']
14
+ additional_paths: ['app/assets']
15
+
16
+ # Reload manifest.json on all requests so we reload latest compiled packs
17
+ cache_manifest: false
18
+
19
+ development:
20
+ <<: *default
21
+ compile: false
22
+
23
+ # Reference: https://webpack.js.org/configuration/dev-server/
24
+ dev_server:
25
+ https: false
26
+ host: localhost
27
+ port: 3035
28
+ public: localhost:3035
29
+ hmr: false
30
+ # Defaults to the inverse of hmr. Uncomment to manually set this.
31
+ # live_reload: true
32
+ client:
33
+ # Should we show a full-screen overlay in the browser when there are compiler errors or warnings?
34
+ overlay: true
35
+ # May also be a string
36
+ # webSocketURL:
37
+ # hostname: "0.0.0.0"
38
+ # pathname: "/ws"
39
+ # port: 8080
40
+ # Should we use gzip compression?
41
+ compress: true
42
+ # Note that apps that do not check the host are vulnerable to DNS rebinding attacks
43
+ disable_host_check: true
44
+ use_local_ip: false
45
+ quiet: false
46
+ # Newly added to webpacker.yml by shakapacker
47
+ # allowed_hosts: "all"
48
+ # pretty: true
49
+ headers:
50
+ 'Access-Control-Allow-Origin': '*'
51
+ static:
52
+ watch:
53
+ ignored: "**/node_modules/**"
54
+
55
+
56
+ test:
57
+ <<: *default
58
+ compile: true
59
+
60
+ # Compile test packs to a separate directory
61
+ public_output_path: packs-test
62
+
63
+ production:
64
+ <<: *default
65
+
66
+ # Production depends on precompilation of packs prior to booting for performance.
67
+ compile: false
68
+
69
+ # Extract and emit a css file
70
+ extract_css: true
71
+
72
+ # Cache manifest.json for performance
73
+ cache_manifest: true
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is used by Rack-based servers to start the application.
4
+
5
+ require_relative "config/environment"
6
+
7
+ run Rails.application
8
+ Rails.application.load_server
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateOrganizations < ActiveRecord::Migration[6.1]
4
+ def change
5
+ enable_extension "pgcrypto"
6
+
7
+ create_table :organizations, id: :uuid do |t|
8
+ t.string :name, null: false
9
+ t.string :subdomain, null: false
10
+
11
+ t.timestamps
12
+ end
13
+ add_index :organizations, :subdomain, unique: true
14
+ end
15
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateUsers < ActiveRecord::Migration[6.1]
4
+ def change
5
+ create_table :users, id: :uuid do |t|
6
+ t.string :first_name, null: false
7
+ t.string :last_name
8
+ t.string :email, null: false
9
+ t.integer :experience
10
+ t.string :timezone, null: false
11
+ t.text :permissions, array: true
12
+ t.jsonb :dates
13
+ t.jsonb :duration
14
+ t.references :organization, null: false, foreign_key: { on_delete: :cascade }, type: :uuid
15
+
16
+ t.timestamps
17
+ end
18
+ add_index :users, :email, unique: true
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddDeactivatedAtToOrganizations < ActiveRecord::Migration[7.1]
4
+ def change
5
+ add_column :organizations, :deactivated_at, :datetime
6
+ end
7
+ end