Commit 201393d4 by Xuan Trung Le

Create database

parent aa4aff23
...@@ -17,3 +17,6 @@ ...@@ -17,3 +17,6 @@
/yarn-error.log /yarn-error.log
.byebug_history .byebug_history
# Ignore application configuration
/config/application.yml
...@@ -16,29 +16,15 @@ gem 'puma', '~> 3.7' ...@@ -16,29 +16,15 @@ gem 'puma', '~> 3.7'
gem 'sass-rails', '~> 5.0' gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets # Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0' gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5' gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'figaro'
gem 'jbuilder', '~> 2.5' gem 'devise'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console # Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
end end
group :development do group :development do
......
...@@ -38,39 +38,27 @@ GEM ...@@ -38,39 +38,27 @@ GEM
i18n (~> 0.7) i18n (~> 0.7)
minitest (~> 5.1) minitest (~> 5.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
arel (8.0.0) arel (8.0.0)
bcrypt (3.1.11)
bindex (0.5.0) bindex (0.5.0)
builder (3.2.3) builder (3.2.3)
byebug (9.1.0) byebug (9.1.0)
capybara (2.15.1)
addressable
mini_mime (>= 0.1.3)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
childprocess (0.8.0)
ffi (~> 1.0, >= 1.0.11)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5) concurrent-ruby (1.0.5)
crass (1.0.2) crass (1.0.2)
devise (4.3.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.2)
responders
warden (~> 1.2.3)
erubi (1.6.1) erubi (1.6.1)
execjs (2.7.0) execjs (2.7.0)
ffi (1.9.18) ffi (1.9.18)
figaro (1.1.1)
thor (~> 0.14)
globalid (0.4.0) globalid (0.4.0)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
i18n (0.8.6) i18n (0.8.6)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
listen (3.1.5) listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
...@@ -84,15 +72,13 @@ GEM ...@@ -84,15 +72,13 @@ GEM
mime-types (3.1) mime-types (3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521) mime-types-data (3.2016.0521)
mini_mime (0.1.4)
mini_portile2 (2.3.0) mini_portile2 (2.3.0)
minitest (5.10.3) minitest (5.10.3)
multi_json (1.12.2)
mysql2 (0.4.9) mysql2 (0.4.9)
nio4r (2.1.0) nio4r (2.1.0)
nokogiri (1.8.1) nokogiri (1.8.1)
mini_portile2 (~> 2.3.0) mini_portile2 (~> 2.3.0)
public_suffix (3.0.0) orm_adapter (0.5.0)
puma (3.10.0) puma (3.10.0)
rack (2.0.3) rack (2.0.3)
rack-test (0.7.0) rack-test (0.7.0)
...@@ -124,8 +110,10 @@ GEM ...@@ -124,8 +110,10 @@ GEM
rb-fsevent (0.10.2) rb-fsevent (0.10.2)
rb-inotify (0.9.10) rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2) ffi (>= 0.5.0, < 2)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
ruby_dep (1.5.0) ruby_dep (1.5.0)
rubyzip (1.2.1)
sass (3.5.1) sass (3.5.1)
sass-listen (~> 4.0.0) sass-listen (~> 4.0.0)
sass-listen (4.0.0) sass-listen (4.0.0)
...@@ -137,9 +125,6 @@ GEM ...@@ -137,9 +125,6 @@ GEM
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3) tilt (>= 1.1, < 3)
selenium-webdriver (3.6.0)
childprocess (~> 0.5)
rubyzip (~> 1.0)
spring (2.0.2) spring (2.0.2)
activesupport (>= 4.2) activesupport (>= 4.2)
spring-watcher-listen (2.0.1) spring-watcher-listen (2.0.1)
...@@ -162,6 +147,8 @@ GEM ...@@ -162,6 +147,8 @@ GEM
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (3.2.0) uglifier (3.2.0)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
warden (1.2.7)
rack (>= 1.0)
web-console (3.5.1) web-console (3.5.1)
actionview (>= 5.0) actionview (>= 5.0)
activemodel (>= 5.0) activemodel (>= 5.0)
...@@ -170,23 +157,19 @@ GEM ...@@ -170,23 +157,19 @@ GEM
websocket-driver (0.6.5) websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2) websocket-extensions (0.1.2)
xpath (2.1.0)
nokogiri (~> 1.3)
PLATFORMS PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
byebug byebug
capybara (~> 2.13) devise
coffee-rails (~> 4.2) figaro
jbuilder (~> 2.5)
listen (>= 3.0.5, < 3.2) listen (>= 3.0.5, < 3.2)
mysql2 (>= 0.3.18, < 0.5) mysql2 (>= 0.3.18, < 0.5)
puma (~> 3.7) puma (~> 3.7)
rails (~> 5.1.4) rails (~> 5.1.4)
sass-rails (~> 5.0) sass-rails (~> 5.0)
selenium-webdriver
spring spring
spring-watcher-listen (~> 2.0.0) spring-watcher-listen (~> 2.0.0)
turbolinks (~> 5) turbolinks (~> 5)
......
class ApplyJob < ApplicationRecord
belongs_to :job
belongs_to :user
end
class City < ApplicationRecord
belongs_to :country
has_many :companies
has_many :jobs
end
class Company < ApplicationRecord
belongs_to :city
has_many :jobs
end
class Country < ApplicationRecord
has_many :cities
end
class FavoriteJob < ApplicationRecord
belongs_to :job
belongs_to :user
end
class Industry < ApplicationRecord
has_many :industry_jobs
has_many :jobs, through: :industry_jobs
end
class IndustryJob < ApplicationRecord
belongs_to :industry
belongs_to :job
end
class Job < ApplicationRecord
belongs_to :city
belongs_to :company
has_many :apply_jobs
has_many :users, through: :favorite_jobs
has_many :favorite_jobs
has_many :users, through: :favorite_jobs
has_many :industry_jobs
has_many :industries, through: :industry_jobs
end
class User < ApplicationRecord
has_many :apply_jobs
has_many :jobs, through: :favorite_jobs
has_many :favorite_jobs
has_many :jobs, through: :favorite_jobs
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end
...@@ -14,7 +14,7 @@ default: &default ...@@ -14,7 +14,7 @@ default: &default
encoding: utf8 encoding: utf8
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root username: root
password: password: <%= ENV["password_mysql"] %>
socket: /var/run/mysqld/mysqld.sock socket: /var/run/mysqld/mysqld.sock
development: development:
......
# Additional translations at https://github.com/plataformatec/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 confirm link to confirm your new email address."
updated: "Your account has been updated successfully."
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:"
Rails.application.routes.draw do Rails.application.routes.draw do
devise_for :users
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end end
class DeviseCreateUsers < ActiveRecord::Migration[5.1]
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
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
class CreateCountries < ActiveRecord::Migration[5.1]
def change
create_table :countries do |t|
t.string :name
t.timestamps
end
end
end
class CreateCities < ActiveRecord::Migration[5.1]
def change
create_table :cities do |t|
t.string :name
t.references :country
t.timestamps
end
end
end
class CreateCompanies < ActiveRecord::Migration[5.1]
def change
create_table :companies do |t|
t.string :name
t.string :location
t.text :description
t.references :city
t.timestamps
end
end
end
class CreateIndustries < ActiveRecord::Migration[5.1]
def change
create_table :industries do |t|
t.string :name
t.timestamps
end
end
end
class CreateJobs < ActiveRecord::Migration[5.1]
def change
create_table :jobs do |t|
t.string :name
t.string :salary
t.text :description
t.string :level
t.string :experience
t.references :city
t.references :company
t.datetime :expiry_date
t.datetime :updated_date
t.datetime :updated_at
t.timestamps
end
end
end
class CreateIndustryJobs < ActiveRecord::Migration[5.1]
def change
create_table :industry_jobs do |t|
t.references :industry
t.references :job
t.timestamps
end
end
end
class CreateFavoriteJobs < ActiveRecord::Migration[5.1]
def change
create_table :favorite_jobs do |t|
t.references :job
t.references :user
t.timestamps
end
end
end
class CreateApplyJobs < ActiveRecord::Migration[5.1]
def change
create_table :apply_jobs do |t|
t.references :job
t.references :user
t.string :cv
t.timestamps
end
end
end
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
end
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment