Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/user model #39

Merged
merged 7 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ gem 'bootsnap', require: false
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin Ajax possible
gem 'rack-cors'

# User authentication
gem 'devise'
gem 'devise-jwt'
gem 'jsonapi-serializer'

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem 'debug', platforms: %i[mri windows]
Expand Down
36 changes: 36 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ GEM
tzinfo (~> 2.0)
ast (2.4.2)
base64 (0.1.1)
bcrypt (3.1.19)
bigdecimal (3.1.4)
bootsnap (1.16.0)
msgpack (~> 1.2)
Expand All @@ -87,8 +88,26 @@ GEM
debug (1.8.0)
irb (>= 1.5.0)
reline (>= 0.3.1)
devise (4.9.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-jwt (0.11.0)
devise (~> 4.0)
warden-jwt_auth (~> 0.8)
drb (2.1.1)
ruby2_keywords
dry-auto_inject (1.0.1)
dry-core (~> 1.0)
zeitwerk (~> 2.6)
dry-configurable (1.1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
erubi (1.12.0)
globalid (1.2.1)
activesupport (>= 6.1)
Expand All @@ -99,6 +118,9 @@ GEM
rdoc
reline (>= 0.3.8)
json (2.6.3)
jsonapi-serializer (2.2.0)
activesupport (>= 4.2)
jwt (2.7.1)
language_server-protocol (3.17.0.3)
loofah (2.21.4)
crass (~> 1.0.2)
Expand All @@ -125,6 +147,7 @@ GEM
nio4r (2.5.9)
nokogiri (1.15.4-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1)
Expand Down Expand Up @@ -181,6 +204,9 @@ GEM
regexp_parser (2.8.2)
reline (0.3.9)
io-console (~> 0.5)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.2.6)
rubocop (1.57.2)
json (~> 2.3)
Expand All @@ -203,6 +229,13 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
warden (1.2.9)
rack (>= 2.0.9)
warden-jwt_auth (0.8.0)
dry-auto_inject (>= 0.8, < 2)
dry-configurable (>= 0.13, < 2)
jwt (~> 2.1)
warden (~> 1.2)
webrick (1.8.1)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
Expand All @@ -215,6 +248,9 @@ PLATFORMS
DEPENDENCIES
bootsnap
debug
devise
devise-jwt
jsonapi-serializer
pg (~> 1.1)
puma (>= 5.0)
rack-cors
Expand Down
9 changes: 9 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_many :reservations

validates :username, presence: true, length: { maximum: 150 }
end
2 changes: 2 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# Enable server timing
config.server_timing = true

config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }

# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join("tmp/caching-dev.txt").exist?
Expand Down
Loading
Loading