Commit c4b3eb6e by Đường Sỹ Hoàng

Removed unuse files

parent e207c8a1
Pipeline #245 failed with stages
in 0 seconds
class CityJob < ApplicationRecord
belongs_to :jobs
belongs_to :cities
belongs_to :job
belongs_to :city
end
class IndustryJob < ApplicationRecord
belongs_to :jobs
belongs_to :industries
belongs_to :job
belongs_to :industry
end
......@@ -3,9 +3,24 @@ class User < ApplicationRecord
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_many :user_jobs
validates :email, presence: true, uniqueness: true
validates :username, presence: true, format: { with: /\A[A-Za-z][A-Za-z0-9._-]{2,19}\z/ }
validates :first_name, presence: true, format: { with: /\A[A-Za-z][A-Za-z0-9._-]{2,19}\z/ }
validates :last_name, presence: true, format: { with: /\A[A-Za-z][A-Za-z0-9._-]{2,19}\z/ }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
VALID_USERNAME_REGEX = /\A[a-zA-Z0-9]+\z/
validates :email, presence: true,
length: { maximum: 255 },
format: { with: VALID_EMAIL_REGEX },
uniqueness: { case_sensitive: false }
validates :username, presence: true,
length: { minimum: 6, maximum: 50 },
format: { with: VALID_USERNAME_REGEX },
uniqueness: { case_sensitive: false }
validates :first_name, presence: true,
length: { maximum: 50 },
format: { with: VALID_USERNAME_REGEX }
validates :last_name, presence: true,
length: { maximum: 50 },
format: { with: VALID_USERNAME_REGEX }
end
class UserJob < ApplicationRecord
belongs_to :user
belongs_to :jobs
belongs_to :job
end
......@@ -4,8 +4,8 @@ class DeviseCreateUsers < ActiveRecord::Migration[6.0]
def change
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :username, null:false, default: ""
t.string :email, null: false, default: "", unique: true
t.string :username, null: false, default: "", unique: true
t.string :password, null: false, default: ""
## Recoverable
......@@ -42,6 +42,7 @@ class DeviseCreateUsers < ActiveRecord::Migration[6.0]
end
add_index :users, :email, unique: true
add_index :users, :username, unique: true
add_index :users, :reset_digest, unique: true
# add_index :users, :confirmation_token, unique: true
# add_index :users, :unlock_token, unique: true
......
......@@ -7,7 +7,12 @@ class CreateUserJobs < ActiveRecord::Migration[6.0]
t.datetime :favorited_at
t.datetime :viewed_at
t.datetime :applied_at
t.timestamps null: false
end
add_index :user_jobs, :user_id
add_index :user_jobs, :job_id
add_index :user_jobs, [:user_id, :job_id]
end
end
class CreateCompanies < ActiveRecord::Migration[6.0]
def change
create_table :companies do |t|
t.string :username, null: false, default: ""
t.string :email, null: false, default: ""
t.text :description
t.string :address
t.string :url
t.string :name
t.timestamps null: false
end
......
......@@ -6,5 +6,8 @@ class CreateIndustryJobs < ActiveRecord::Migration[6.0]
t.timestamps null: false
end
add_index :industry_jobs, :job_id
add_index :industry_jobs, :industry_id
end
end
......@@ -27,11 +27,11 @@ ActiveRecord::Schema.define(version: 2019_11_27_075301) do
end
create_table "companies", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "username", default: "", null: false
t.string "email", default: "", null: false
t.text "description"
t.string "address"
t.string "url"
t.string "name"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
......@@ -47,6 +47,8 @@ ActiveRecord::Schema.define(version: 2019_11_27_075301) do
t.integer "industry_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["industry_id"], name: "index_industry_jobs_on_industry_id"
t.index ["job_id"], name: "index_industry_jobs_on_job_id"
end
create_table "jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
......@@ -73,6 +75,9 @@ ActiveRecord::Schema.define(version: 2019_11_27_075301) do
t.datetime "applied_at"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["job_id"], name: "index_user_jobs_on_job_id"
t.index ["user_id", "job_id"], name: "index_user_jobs_on_user_id_and_job_id"
t.index ["user_id"], name: "index_user_jobs_on_user_id"
end
create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
......@@ -93,6 +98,7 @@ ActiveRecord::Schema.define(version: 2019_11_27_075301) do
t.datetime "updated_at", precision: 6, null: false
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_digest"], name: "index_users_on_reset_digest", unique: true
t.index ["username"], name: "index_users_on_username", unique: true
end
end
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
require 'test_helper'
class CityJobTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class CityTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class IndustryJobTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class IndustryTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class JobTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
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