Skip to content
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
2 changes: 1 addition & 1 deletion back/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ gem "puma", ">= 5.0"
# gem "jbuilder"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"
gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ windows jruby ]
Expand Down
2 changes: 2 additions & 0 deletions back/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ GEM
uri (>= 0.13.1)
ast (2.4.3)
base64 (0.3.0)
bcrypt (3.1.21)
bcrypt_pbkdf (1.1.2)
bcrypt_pbkdf (1.1.2-arm64-darwin)
bcrypt_pbkdf (1.1.2-x86_64-darwin)
Expand Down Expand Up @@ -328,6 +329,7 @@ PLATFORMS
x86_64-linux-musl

DEPENDENCIES
bcrypt (~> 3.1.7)
bootsnap
brakeman
debug
Expand Down
3 changes: 3 additions & 0 deletions back/app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
class User < ApplicationRecord
enum :personality, { energetic: 0, neutral: 1, calm: 2 }
enum :preference, { outdoor: 0, both: 1, indoor: 2 }
enum :role, { user: 0, admin: 1 }

has_secure_password

before_validation :set_defaults, on: :create

Expand Down
9 changes: 9 additions & 0 deletions back/db/migrate/20260221163506_add_auth_columns_to_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddAuthColumnsToUsers < ActiveRecord::Migration[8.0]
def change
add_column :users, :email, :string, null: false
add_column :users, :password_digest, :string, null: false
add_column :users, :role, :integer, null: false, default: 0

add_index :users, :email, unique: true
end
end
6 changes: 5 additions & 1 deletion back/db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.