diff --git a/Gemfile b/Gemfile index 55007d8..07aea48 100644 --- a/Gemfile +++ b/Gemfile @@ -38,7 +38,7 @@ group :development, :test do gem 'rspec-rails' gem 'rails-controller-testing' gem "factory_bot_rails", "~> 4.0" - gem 'faker' + gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 46f7ee1..0873308 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,11 @@ +GIT + remote: https://github.com/stympy/faker.git + revision: c972b0d791dd99d45058ba4fe625dbd27bb3fbe0 + branch: master + specs: + faker (1.8.4) + i18n (~> 0.5) + GEM remote: https://rubygems.org/ specs: @@ -52,8 +60,6 @@ GEM factory_bot_rails (4.8.2) factory_bot (~> 4.8.2) railties (>= 3.0.0) - faker (1.8.4) - i18n (~> 0.5) ffi (1.9.18) globalid (0.4.1) activesupport (>= 4.2.0) @@ -178,7 +184,7 @@ PLATFORMS DEPENDENCIES byebug factory_bot_rails (~> 4.0) - faker + faker! jbuilder (~> 2.5) listen (>= 3.0.5, < 3.2) pg (~> 0.18) diff --git a/app/models/company.rb b/app/models/company.rb new file mode 100644 index 0000000..65f96a6 --- /dev/null +++ b/app/models/company.rb @@ -0,0 +1,5 @@ +class Company < ApplicationRecord + has_many :interviews + has_many :interviewees, through: :interviews, source: :user + has_and_belongs_to_many :skills +end diff --git a/app/models/interview.rb b/app/models/interview.rb new file mode 100644 index 0000000..8169667 --- /dev/null +++ b/app/models/interview.rb @@ -0,0 +1,5 @@ +class Interview < ApplicationRecord + has_and_belongs_to_many :skills + belongs_to :company + belongs_to :interviewee, foreign_key: 'user_id', class_name: 'User' +end diff --git a/app/models/skill.rb b/app/models/skill.rb new file mode 100644 index 0000000..4355dec --- /dev/null +++ b/app/models/skill.rb @@ -0,0 +1,5 @@ +class Skill < ApplicationRecord + has_and_belongs_to_many :companies + has_and_belongs_to_many :users + has_and_belongs_to_many :interviews +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..a84c445 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,4 @@ +class User < ApplicationRecord + has_and_belongs_to_many :skills + has_many :interviews +end diff --git a/config/routes.rb b/config/routes.rb index 787824f..1d14ed0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ Rails.application.routes.draw do - # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html + scope :api do + + end end diff --git a/db/migrate/20171204005855_create_users.rb b/db/migrate/20171204005855_create_users.rb new file mode 100644 index 0000000..b988837 --- /dev/null +++ b/db/migrate/20171204005855_create_users.rb @@ -0,0 +1,19 @@ +class CreateUsers < ActiveRecord::Migration[5.1] + def change + create_table :users do |t| + t.string :name + t.integer :year + t.string :cohort + t.string :location + t.string :email + t.string :linkedin_url + t.string :github_url + t.string :facebook_url + t.string :current_company + t.string :current_position + t.string :photo_url + + t.timestamps + end + end +end diff --git a/db/migrate/20171204005931_create_skills.rb b/db/migrate/20171204005931_create_skills.rb new file mode 100644 index 0000000..a2f0b00 --- /dev/null +++ b/db/migrate/20171204005931_create_skills.rb @@ -0,0 +1,9 @@ +class CreateSkills < ActiveRecord::Migration[5.1] + def change + create_table :skills do |t| + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20171204010108_create_skills_users.rb b/db/migrate/20171204010108_create_skills_users.rb new file mode 100644 index 0000000..7afc20a --- /dev/null +++ b/db/migrate/20171204010108_create_skills_users.rb @@ -0,0 +1,8 @@ +class CreateSkillsUsers < ActiveRecord::Migration[5.1] + def change + create_table :skills_users do |t| + t.references :user + t.references :skill + end + end +end diff --git a/db/migrate/20171204010457_create_companies.rb b/db/migrate/20171204010457_create_companies.rb new file mode 100644 index 0000000..f2f5dc6 --- /dev/null +++ b/db/migrate/20171204010457_create_companies.rb @@ -0,0 +1,13 @@ +class CreateCompanies < ActiveRecord::Migration[5.1] + def change + create_table :companies do |t| + t.string :name + t.string :location + t.string :website + t.string :tech_field + t.boolean :has_apprenticeship? + + t.timestamps + end + end +end diff --git a/db/migrate/20171204010615_create_companies_skills.rb b/db/migrate/20171204010615_create_companies_skills.rb new file mode 100644 index 0000000..917dd6a --- /dev/null +++ b/db/migrate/20171204010615_create_companies_skills.rb @@ -0,0 +1,8 @@ +class CreateCompaniesSkills < ActiveRecord::Migration[5.1] + def change + create_table :companies_skills do |t| + t.references :company + t.references :skill + end + end +end diff --git a/db/migrate/20171204013338_create_interviews.rb b/db/migrate/20171204013338_create_interviews.rb new file mode 100644 index 0000000..04aa556 --- /dev/null +++ b/db/migrate/20171204013338_create_interviews.rb @@ -0,0 +1,28 @@ +class CreateInterviews < ActiveRecord::Migration[5.1] + def change + create_table :interviews do |t| + t.string :job_title + t.boolean :referred? + t.boolean :received_offer? + t.text :notes + t.integer :difficulty_rating + t.integer :experience_rating + t.boolean :accepted_offer? + t.boolean :phone_screen? + t.text :phone_screen_details + t.boolean :tech_screen? + t.text :tech_screen_details + t.boolean :take_home_challenge? + t.text :take_home_challenge_details + t.boolean :onsite? + t.text :onsite_details + t.boolean :whiteboarding? + t.text :whiteboarding_details + t.text :negotiation_details + t.references :user + t.references :company + + t.timestamps + end + end +end diff --git a/db/migrate/20171204013541_create_interviews_skills.rb b/db/migrate/20171204013541_create_interviews_skills.rb new file mode 100644 index 0000000..c18636e --- /dev/null +++ b/db/migrate/20171204013541_create_interviews_skills.rb @@ -0,0 +1,8 @@ +class CreateInterviewsSkills < ActiveRecord::Migration[5.1] + def change + create_table :interviews_skills do |t| + t.references :skill + t.references :interview + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..9196141 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,98 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20171204013541) do + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "companies", force: :cascade do |t| + t.string "name" + t.string "location" + t.string "website" + t.string "tech_field" + t.boolean "has_apprenticeship?" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "companies_skills", force: :cascade do |t| + t.bigint "company_id" + t.bigint "skill_id" + t.index ["company_id"], name: "index_companies_skills_on_company_id" + t.index ["skill_id"], name: "index_companies_skills_on_skill_id" + end + + create_table "interviews", force: :cascade do |t| + t.string "job_title" + t.boolean "referred?" + t.boolean "received_offer?" + t.text "notes" + t.integer "difficulty_rating" + t.integer "experience_rating" + t.boolean "accepted_offer?" + t.boolean "phone_screen?" + t.text "phone_screen_details" + t.boolean "tech_screen?" + t.text "tech_screen_details" + t.boolean "take_home_challenge?" + t.text "take_home_challenge_details" + t.boolean "onsite?" + t.text "onsite_details" + t.boolean "whiteboarding?" + t.text "whiteboarding_details" + t.text "negotiation_details" + t.bigint "user_id" + t.bigint "company_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["company_id"], name: "index_interviews_on_company_id" + t.index ["user_id"], name: "index_interviews_on_user_id" + end + + create_table "interviews_skills", force: :cascade do |t| + t.bigint "skill_id" + t.bigint "interview_id" + t.index ["interview_id"], name: "index_interviews_skills_on_interview_id" + t.index ["skill_id"], name: "index_interviews_skills_on_skill_id" + end + + create_table "skills", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "skills_users", force: :cascade do |t| + t.bigint "user_id" + t.bigint "skill_id" + t.index ["skill_id"], name: "index_skills_users_on_skill_id" + t.index ["user_id"], name: "index_skills_users_on_user_id" + end + + create_table "users", force: :cascade do |t| + t.string "name" + t.integer "year" + t.string "cohort" + t.string "location" + t.string "email" + t.string "linkedin_url" + t.string "github_url" + t.string "facebook_url" + t.string "current_company" + t.string "current_position" + t.string "photo_url" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/public/default_profile.png b/public/default_profile.png new file mode 100644 index 0000000..8a595fe Binary files /dev/null and b/public/default_profile.png differ diff --git a/spec/factories/companies.rb b/spec/factories/companies.rb new file mode 100644 index 0000000..efcfd75 --- /dev/null +++ b/spec/factories/companies.rb @@ -0,0 +1,11 @@ +FactoryBot.define do + factory :company do + name { Faker::Company.name } + location { "#{Faker::Address.city}, #{Faker::Address.state}" } + website { Faker::Internet.url } + tech_field { Faker::Company.catch_phrase } + has_apprenticeship? { [true, false].sample } + association :interview + association :interviewees, factory: :user + end +end diff --git a/spec/factories/interviews.rb b/spec/factories/interviews.rb new file mode 100644 index 0000000..aa64580 --- /dev/null +++ b/spec/factories/interviews.rb @@ -0,0 +1,22 @@ +FactoryBot.define do + factory :interview do + job_title "MyString" + referred? { [true, false].sample } + received_offer? false + notes "MyText" + difficulty_rating { (1..3).to_a.sample } + experience_rating { (1..3).to_a.sample } + accepted_offer? { [true, false].sample } + phone_screen? { [true, false].sample } + phone_screen_details { Faker::Hacker.say_something_smart } + tech_screen? { [true, false].sample } + tech_screen_details { Faker::Hacker.say_something_smart } + take_home_challenge? { [true, false].sample } + take_home_challenge_details { Faker::Hacker.say_something_smart } + onsite? { [true, false].sample } + onsite_details { Faker::Hacker.say_something_smart } + whiteboarding? { [true, false].sample } + whiteboarding_details { Faker::Hacker.say_something_smart } + negotiation_details { Faker::Hacker.say_something_smart } + end +end diff --git a/spec/factories/skills.rb b/spec/factories/skills.rb new file mode 100644 index 0000000..c83ff44 --- /dev/null +++ b/spec/factories/skills.rb @@ -0,0 +1,5 @@ +FactoryBot.define do + factory :skill do + name { Faker::Company.catch_phrase } + end +end diff --git a/spec/factories/users.rb b/spec/factories/users.rb new file mode 100644 index 0000000..f97444e --- /dev/null +++ b/spec/factories/users.rb @@ -0,0 +1,19 @@ +require 'faker' + +COHORTS = ['Bumblebees', 'Fiddler Crabs', 'Rock Doves', 'Fiery Skippers', 'Golden Bears', 'Red Pandas', 'Nighthawks', 'Pocket Gophers', 'Sea Lions', 'Fireflies', 'Foxes', 'Wild Pigs', 'Chorus Frogs', 'Squirrels', 'Otters', 'Jackrabbits', 'Bobolinks', 'Coyotes', 'Chipmunks', 'Salamanders', 'Wolves', 'Copperheads', 'Dragonflies', 'Purple Martins', 'Mud Turtles', 'Cicadas', 'Grasshoppers', 'Island Foxes', 'Grey Racoons', 'Desert Rabbits', 'Brown Bats', 'Largemouth Basses', 'Pocket Mice', 'Mule Deer', 'Tiger Swallowtails', 'Gopher Snakes', 'Fence Lizards', 'Red Admirals', 'Banana Slugs', 'Fox Squirrels'] + +FactoryBot.define do + factory :user do + name { Faker::Name.name } + year { (2012..2017).to_a.sample } + cohort { COHORTS.sample } + location { "#{Faker::Address.city}, #{Faker::Address.state}" } + email { Faker::Internet.email } + linkedin_url { Faker::Internet.url('linkedin.com') } + github_url { Faker::Internet.url('github.com') } + facebook_url { Faker::Internet.url('facebook.com') } + current_company { Faker::Company.name } + current_position { Faker::Company.profession } + photo_url { Faker::Fillmurray.image } + end +end diff --git a/spec/models/company_spec.rb b/spec/models/company_spec.rb new file mode 100644 index 0000000..23c199c --- /dev/null +++ b/spec/models/company_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Company, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/interview_spec.rb b/spec/models/interview_spec.rb new file mode 100644 index 0000000..36bebff --- /dev/null +++ b/spec/models/interview_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Interview, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/skill_spec.rb b/spec/models/skill_spec.rb new file mode 100644 index 0000000..8034011 --- /dev/null +++ b/spec/models/skill_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Skill, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb new file mode 100644 index 0000000..47a31bb --- /dev/null +++ b/spec/models/user_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe User, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end