Initial commit (history cleared)
CI / test (3.4.1) (push) Has been cancelled

This commit is contained in:
2026-04-29 11:21:39 +01:00
commit 298610b5f6
277 changed files with 30877 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
# frozen_string_literal: true
class CreateUsers < ActiveRecord::Migration[4.2]
def change
create_table :users do |t|
t.string :email
t.string :password
t.boolean :admin
t.string :first_name
t.string :last_name
t.integer :user_id
t.timestamps
end
end
end
@@ -0,0 +1,13 @@
# frozen_string_literal: true
class CreateRetirements < ActiveRecord::Migration[4.2]
def change
create_table :retirements do |t|
t.string :total
t.string :employee_contrib
t.string :employer_contrib
t.integer :user_id
t.timestamps
end
end
end
@@ -0,0 +1,14 @@
# frozen_string_literal: true
class CreatePaidTimeOffs < ActiveRecord::Migration[4.2]
def change
create_table :paid_time_offs do |t|
t.integer :user_id
t.integer :sick_days_taken
t.integer :sick_days_earned
t.integer :pto_taken
t.integer :pto_earned
t.timestamps
end
end
end
@@ -0,0 +1,15 @@
# frozen_string_literal: true
class CreateSchedules < ActiveRecord::Migration[4.2]
def change
create_table :schedules do |t|
t.string :event_type
t.date :date_begin
t.date :date_end
t.string :event_name
t.string :event_desc
t.integer :user_id
t.timestamps
end
end
end
@@ -0,0 +1,15 @@
# frozen_string_literal: true
class CreateWorkInfos < ActiveRecord::Migration[4.2]
def change
create_table :work_infos do |t|
t.integer :user_id
t.string :income
t.string :bonuses
t.integer :years_worked
t.string :SSN
t.date :DoB
t.timestamps
end
end
end
@@ -0,0 +1,14 @@
# frozen_string_literal: true
class CreatePerformances < ActiveRecord::Migration[4.2]
def change
create_table :performances do |t|
t.integer :user_id
t.date :date_submitted
t.integer :score
t.string :comments
t.integer :reviewer
t.timestamps
end
end
end
@@ -0,0 +1,9 @@
# frozen_string_literal: true
class CreateBenefits < ActiveRecord::Migration[4.2]
def change
create_table :benefits do |t|
t.timestamps
end
end
end
@@ -0,0 +1,13 @@
# frozen_string_literal: true
class CreateMessages < ActiveRecord::Migration[4.2]
def change
create_table :messages do |t|
t.integer :creator_id
t.integer :receiver_id
t.text :message
t.boolean :read
t.timestamps
end
end
end
@@ -0,0 +1,6 @@
# frozen_string_literal: true
class AddEncryptedSsnToWorkInfos < ActiveRecord::Migration[4.2]
def change
add_column :work_infos, :encrypted_ssn, :binary
end
end
@@ -0,0 +1,11 @@
# frozen_string_literal: true
class CreateKeyManagements < ActiveRecord::Migration[4.2]
def change
create_table :key_managements do |t|
t.string :iv
t.integer :user_id
t.timestamps
end
end
end
@@ -0,0 +1,6 @@
# frozen_string_literal: true
class AddAuthTokenToUsers < ActiveRecord::Migration[4.2]
def change
add_column :users, :auth_token, :string
end
end
+13
View File
@@ -0,0 +1,13 @@
# frozen_string_literal: true
class CreatePays < ActiveRecord::Migration[4.2]
def change
create_table :pays do |t|
t.integer :user_id
t.string :bank_account_num
t.string :bank_routing_num
t.integer :percent_of_deposit
t.timestamps
end
end
end
@@ -0,0 +1,11 @@
# frozen_string_literal: true
class CreateAnalytics < ActiveRecord::Migration[4.2]
def change
create_table :analytics do |t|
t.string :ip_address
t.string :referrer
t.string :user_agent
t.timestamps
end
end
end
@@ -0,0 +1,6 @@
# frozen_string_literal: true
class RemoveUsersUserId < ActiveRecord::Migration[5.1]
def change
remove_column :users, :user_id, :integer
end
end
Executable
+114
View File
@@ -0,0 +1,114 @@
# 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.
#
# This file is the source Rails uses to define your schema when running `bin/rails
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2017_10_07_010129) do
create_table "analytics", force: :cascade do |t|
t.string "ip_address"
t.string "referrer"
t.string "user_agent"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "benefits", force: :cascade do |t|
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "key_managements", force: :cascade do |t|
t.string "iv"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "messages", force: :cascade do |t|
t.integer "creator_id"
t.integer "receiver_id"
t.text "message"
t.boolean "read"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "paid_time_offs", force: :cascade do |t|
t.integer "user_id"
t.integer "sick_days_taken"
t.integer "sick_days_earned"
t.integer "pto_taken"
t.integer "pto_earned"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "pays", force: :cascade do |t|
t.integer "user_id"
t.string "bank_account_num"
t.string "bank_routing_num"
t.integer "percent_of_deposit"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "performances", force: :cascade do |t|
t.integer "user_id"
t.date "date_submitted"
t.integer "score"
t.string "comments"
t.integer "reviewer"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "retirements", force: :cascade do |t|
t.string "total"
t.string "employee_contrib"
t.string "employer_contrib"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "schedules", force: :cascade do |t|
t.string "event_type"
t.date "date_begin"
t.date "date_end"
t.string "event_name"
t.string "event_desc"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", force: :cascade do |t|
t.string "email"
t.string "password"
t.boolean "admin"
t.string "first_name"
t.string "last_name"
t.datetime "created_at"
t.datetime "updated_at"
t.string "auth_token"
end
create_table "work_infos", force: :cascade do |t|
t.integer "user_id"
t.string "income"
t.string "bonuses"
t.integer "years_worked"
t.string "SSN"
t.date "DoB"
t.datetime "created_at"
t.datetime "updated_at"
t.binary "encrypted_ssn"
end
end
Executable
+311
View File
@@ -0,0 +1,311 @@
# frozen_string_literal: true
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed (or created alongside the db with db:setup).
#
users = [
{
email: "admin@metacorp.com",
admin: true,
password: "admin1234",
password_confirmation: "admin1234",
first_name: "Admin",
last_name: "",
},
{
email: "jmmastey@metacorp.com",
admin: false,
password: "railsgoat!",
password_confirmation: "railsgoat!",
first_name: "Joseph",
last_name: "Mastey",
},
{
email: "john@metacorp.com",
admin: false,
password: "yankeessuck",
password_confirmation: "yankeessuck",
first_name: "John",
last_name: "Smith",
},
{
email: "james@metacorp.com",
admin: false,
password: "alohaowasp",
password_confirmation: "alohaowasp",
first_name: "James",
last_name: "Anderson",
},
{
email: "mike@metacorp.com",
admin: false,
password: "motocross1445",
password_confirmation: "motocross1445",
first_name: "Mike",
last_name: "McCabe",
},
{
email: "ken@metacorp.com",
admin: false,
password: "citrusblend",
password_confirmation: "citrusblend",
first_name: "Ken",
last_name: "Johnson",
},
{
email: "admin2@metacorp.com",
admin: false,
password: "adminadmin",
password_confirmation: "adminadmin",
first_name: "Admin2",
last_name: "",
}
]
retirements = [
{
user: "john@metacorp.com",
employee_contrib: "1000",
employer_contrib: "2000",
total: "4500"
},
{
user: "james@metacorp.com",
employee_contrib: "8000",
employer_contrib: "16000",
total: "30000"
},
{
user: "mike@metacorp.com",
employee_contrib: "10000",
employer_contrib: "20000",
total: "40000"
},
{
user: "ken@metacorp.com",
employee_contrib: "3000",
employer_contrib: "6000",
total: "12500"
}
]
paid_time_off = [
{
user: "john@metacorp.com",
sick_days_taken: 2,
sick_days_earned: 5,
pto_taken: 5,
pto_earned: 30
},
{
user: "james@metacorp.com",
sick_days_taken: 3,
sick_days_earned: 6,
pto_taken: 3,
pto_earned: 20
},
{
user: "mike@metacorp.com",
sick_days_taken: 2,
sick_days_earned: 5,
pto_taken: 5,
pto_earned: 30
},
{
user: "ken@metacorp.com",
sick_days_taken: 1,
sick_days_earned: 5,
pto_taken: 10,
pto_earned: 30
}
]
schedule = [
{
user: "john@metacorp.com",
date_begin: Date.new(2014, 7, 30),
date_end: Date.new(2014, 8, 2),
event_type: "pto",
event_desc: "vacation to france",
event_name: "My 2014 Vacation"
},
{
user: "james@metacorp.com",
date_begin: Date.new(2013, 9, 1),
date_end: Date.new(2013, 9, 12),
event_type: "pto",
event_desc: "Going Home to see folks",
event_name: "Visit Parents"
},
{
user: "mike@metacorp.com",
date_begin: Date.new(2013, 9, 13),
date_end: Date.new(2013, 9, 20),
event_type: "pto",
event_desc: "Taking kids to Grand Canyon",
event_name: "AZ Trip"
},
{
user: "ken@metacorp.com",
date_begin: Date.new(2013, 12, 20),
date_end: Date.new(2013, 12, 30),
event_type: "pto",
event_desc: "Xmas Staycation",
event_name: "Christmas Leave"
}
]
work_info = [
{
user: "john@metacorp.com",
income: "$50,000",
bonuses: "$10,000",
years_worked: 2,
SSN: "555-55-5555",
DoB: "01-01-1980"
},
{
user: "james@metacorp.com",
income: "$40,000",
bonuses: "$10,000",
years_worked: 1,
SSN: "333-33-3333",
DoB: "01-01-1979"
},
{
user: "mike@metacorp.com",
income: "$60,000",
bonuses: "$12,000",
years_worked: 3,
SSN: "444-44-4444",
DoB: "01-01-1981"
},
{
user: "ken@metacorp.com",
income: "$30,000",
bonuses: "7,000",
years_worked: 1,
SSN: "222-22-2222",
DoB: "01-01-1982"
}
]
performance = [
{
user: "john@metacorp.com",
reviewer: 1,
comments: "Great job! You are my hero",
date_submitted: Date.new(2012, 01, 01),
score: 5
},
{
user: "john@metacorp.com",
reviewer: 1,
comments: "Once again, you've done a great job this year. We greatly appreciate your hard work.",
date_submitted: Date.new(2013, 01, 01),
score: 5
},
{
user: "james@metacorp.com",
reviewer: 1,
comments: "Great worker, great attitude for this newcomer!",
date_submitted: Date.new(2013, 01, 01),
score: 5
},
{
user: "mike@metacorp.com",
reviewer: 1,
comments: "Wow, right out of the gate we've been very impressed but unfortunately, our system doesn't allow us to give you a full 5.0 because other ppl have gotten 5.0 ratings.",
date_submitted: Date.new(2011, 01, 01),
score: 4
},
{
user: "mike@metacorp.com",
reviewer: 1,
comments: "We highly recommend promotion for this employee! Consistent performer with proven leadership qualities.",
date_submitted: Date.new(2012, 01, 01),
score: 5
},
{
user: "mike@metacorp.com",
reviewer: 1,
comments: "Right out of the gate, Mike has made incredible moves as a newly appointed leader. His only improvement would be more cowbell. Not enough of it.",
date_submitted: Date.new(2013, 01, 01),
score: 4
},
{
user: "ken@metacorp.com",
reviewer: 1,
comments: "Ehh, you are okay, we will let you stay..... barely",
date_submitted: Date.new(2013, 01, 01),
score: 2
}
]
messages = [
{
creator: "ken@metacorp.com",
receiver: "john@metacorp.com",
message: "Your benefits have been updated.",
read: false
},
{
creator: "mike@metacorp.com",
receiver: "james@metacorp.com",
message: "Please update your profile.",
read: false
},
{
creator: "james@metacorp.com",
receiver: "mike@metacorp.com",
message: "Welcome to Railsgoat.",
read: false
},
{
creator: "john@metacorp.com",
receiver: "ken@metacorp.com",
message: "Hello friend.",
read: false
}
]
user_map = users.each_with_object({}) do |user_info, h|
h[user_info[:email]] = User.create!(user_info).id
end
retirements.each do |r|
r[:user_id] = user_map.fetch(r.delete(:user))
Retirement.create!(r)
end
paid_time_off.each do |pto|
pto[:user_id] = user_map.fetch(pto.delete(:user))
PaidTimeOff.create!(pto)
end
schedule.each do |event|
event[:user_id] = user_map.fetch(event.delete(:user))
Schedule.create!(event)
end
performance.each do |perf|
perf[:user_id] = user_map.fetch(perf.delete(:user))
Performance.create!(perf)
end
messages.each do |message|
message[:creator_id] = user_map.fetch(message.delete(:creator))
message[:receiver_id] = user_map.fetch(message.delete(:receiver))
Message.create!(message)
end
work_info.each do |wi|
wi[:user_id] = user_map.fetch(wi.delete(:user))
WorkInfo.create!(wi)
end