diff options
| author | mo khan <mo.khan@gmail.com> | 2020-03-15 15:38:46 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-03-15 15:38:46 -0600 |
| commit | 290afe2896d96fee632197386ded6dab82918d47 (patch) | |
| tree | a6f89a31a319ef6ff99064b1b88a5e173724b6db | |
| parent | fac25fd9d8220c3aaee2534831e3843a2dd5a706 (diff) | |
Rename employees to staff
| -rw-r--r-- | rvh/app/models/care_centre.rb | 2 | ||||
| -rw-r--r-- | rvh/app/models/consumption.rb | 2 | ||||
| -rw-r--r-- | rvh/app/models/nurse.rb | 2 | ||||
| -rw-r--r-- | rvh/app/models/physician.rb | 2 | ||||
| -rw-r--r-- | rvh/app/models/staff.rb (renamed from rvh/app/models/employee.rb) | 2 | ||||
| -rw-r--r-- | rvh/app/models/technician.rb | 2 | ||||
| -rw-r--r-- | rvh/app/models/volunteer.rb | 3 | ||||
| -rw-r--r-- | rvh/config/initializers/inflections.rb | 1 | ||||
| -rw-r--r-- | rvh/db/migrate/20200315180939_create_care_centres.rb | 2 | ||||
| -rw-r--r-- | rvh/db/migrate/20200315181211_create_staff.rb (renamed from rvh/db/migrate/20200315181211_create_employees.rb) | 8 | ||||
| -rw-r--r-- | rvh/db/migrate/20200315183903_create_consumptions.rb | 2 | ||||
| -rw-r--r-- | rvh/db/schema.rb | 42 |
12 files changed, 35 insertions, 35 deletions
diff --git a/rvh/app/models/care_centre.rb b/rvh/app/models/care_centre.rb index 90bd3cc..d014559 100644 --- a/rvh/app/models/care_centre.rb +++ b/rvh/app/models/care_centre.rb @@ -1,4 +1,4 @@ class CareCentre < ApplicationRecord - belongs_to :nurse_in_charge, class_name: Nurse.name, foreign_key: :employee_id + belongs_to :nurse_in_charge, class_name: Nurse.name, foreign_key: :nurse_id has_many :beds end diff --git a/rvh/app/models/consumption.rb b/rvh/app/models/consumption.rb index 61a91dc..47a2e71 100644 --- a/rvh/app/models/consumption.rb +++ b/rvh/app/models/consumption.rb @@ -1,5 +1,5 @@ class Consumption < ApplicationRecord belongs_to :patient belongs_to :item - belongs_to :physician, class_name: Physician.name, foreign_key: :employee_id + belongs_to :physician, class_name: Physician.name, foreign_key: :physician_id end diff --git a/rvh/app/models/nurse.rb b/rvh/app/models/nurse.rb index 0c06dc1..230d82d 100644 --- a/rvh/app/models/nurse.rb +++ b/rvh/app/models/nurse.rb @@ -1,2 +1,2 @@ -class Nurse < Employee +class Nurse < Staff end diff --git a/rvh/app/models/physician.rb b/rvh/app/models/physician.rb index abec287..58c7fdb 100644 --- a/rvh/app/models/physician.rb +++ b/rvh/app/models/physician.rb @@ -1,2 +1,2 @@ -class Physician < Employee +class Physician < Staff end diff --git a/rvh/app/models/employee.rb b/rvh/app/models/staff.rb index 89cba4c..1333cce 100644 --- a/rvh/app/models/employee.rb +++ b/rvh/app/models/staff.rb @@ -1,4 +1,4 @@ -class Employee < ApplicationRecord +class Staff < ApplicationRecord belongs_to :account has_many :treatments serialize :qualifications, Array diff --git a/rvh/app/models/technician.rb b/rvh/app/models/technician.rb index b537f79..8bca1a2 100644 --- a/rvh/app/models/technician.rb +++ b/rvh/app/models/technician.rb @@ -1,2 +1,2 @@ -class Technician < Employee +class Technician < Staff end diff --git a/rvh/app/models/volunteer.rb b/rvh/app/models/volunteer.rb index 3105137..82dd925 100644 --- a/rvh/app/models/volunteer.rb +++ b/rvh/app/models/volunteer.rb @@ -1,3 +1,2 @@ -class Volunteer < ApplicationRecord - belongs_to :account +class Volunteer < Staff end diff --git a/rvh/config/initializers/inflections.rb b/rvh/config/initializers/inflections.rb index 220d228..917bbb0 100644 --- a/rvh/config/initializers/inflections.rb +++ b/rvh/config/initializers/inflections.rb @@ -1,3 +1,4 @@ ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.irregular 'person', 'people' + inflect.irregular 'employee', 'staff' end diff --git a/rvh/db/migrate/20200315180939_create_care_centres.rb b/rvh/db/migrate/20200315180939_create_care_centres.rb index c02846c..c53a86f 100644 --- a/rvh/db/migrate/20200315180939_create_care_centres.rb +++ b/rvh/db/migrate/20200315180939_create_care_centres.rb @@ -1,7 +1,7 @@ class CreateCareCentres < ActiveRecord::Migration[6.0] def change create_table :care_centres do |t| - t.references :employee, null: false + t.references :nurse, null: false t.string :name t.string :location diff --git a/rvh/db/migrate/20200315181211_create_employees.rb b/rvh/db/migrate/20200315181211_create_staff.rb index 4dd6878..63d8bfd 100644 --- a/rvh/db/migrate/20200315181211_create_employees.rb +++ b/rvh/db/migrate/20200315181211_create_staff.rb @@ -1,14 +1,14 @@ -class CreateEmployees < ActiveRecord::Migration[6.0] +class CreateStaff < ActiveRecord::Migration[6.0] def change - create_table :employees do |t| + create_table :staff do |t| t.references :account, null: false, foreign_key: true, index: { unique: true } t.references :laboratory, null: true, foreign_key: true t.string :type t.datetime :hired_at - # physician.specialty, technician.skill, nurse.certification + # physician.specialty, technician.skill, nurse.certification, volunteer.skill t.text :qualifications, array: true t.timestamps end - add_index :employees, :type + add_index :staff, :type end end diff --git a/rvh/db/migrate/20200315183903_create_consumptions.rb b/rvh/db/migrate/20200315183903_create_consumptions.rb index f158275..cdb0997 100644 --- a/rvh/db/migrate/20200315183903_create_consumptions.rb +++ b/rvh/db/migrate/20200315183903_create_consumptions.rb @@ -2,7 +2,7 @@ class CreateConsumptions < ActiveRecord::Migration[6.0] def change create_table :consumptions do |t| t.references :patient, null: false, foreign_key: true - t.references :employee, null: false, foreign_key: true + t.references :physician, null: false, foreign_key: true t.references :item, null: false, foreign_key: true t.datetime :consumed_at, null: false t.integer :quantity, null: false diff --git a/rvh/db/schema.rb b/rvh/db/schema.rb index 319f057..bda5cef 100644 --- a/rvh/db/schema.rb +++ b/rvh/db/schema.rb @@ -34,39 +34,26 @@ ActiveRecord::Schema.define(version: 2020_03_15_204511) do end create_table "care_centres", force: :cascade do |t| - t.integer "employee_id", null: false + t.integer "nurse_id", null: false t.string "name" t.string "location" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.index ["employee_id"], name: "index_care_centres_on_employee_id" + t.index ["nurse_id"], name: "index_care_centres_on_nurse_id" end create_table "consumptions", force: :cascade do |t| t.integer "patient_id", null: false - t.integer "employee_id", null: false + t.integer "physician_id", null: false t.integer "item_id", null: false t.datetime "consumed_at", null: false t.integer "quantity", null: false t.decimal "total_cost", null: false t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.index ["employee_id"], name: "index_consumptions_on_employee_id" t.index ["item_id"], name: "index_consumptions_on_item_id" t.index ["patient_id"], name: "index_consumptions_on_patient_id" - end - - create_table "employees", force: :cascade do |t| - t.integer "account_id", null: false - t.integer "laboratory_id" - t.string "type" - t.datetime "hired_at" - t.text "qualifications" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.index ["account_id"], name: "index_employees_on_account_id", unique: true - t.index ["laboratory_id"], name: "index_employees_on_laboratory_id" - t.index ["type"], name: "index_employees_on_type" + t.index ["physician_id"], name: "index_consumptions_on_physician_id" end create_table "items", force: :cascade do |t| @@ -107,6 +94,19 @@ ActiveRecord::Schema.define(version: 2020_03_15_204511) do t.index ["employee_id"], name: "index_shifts_on_employee_id" end + create_table "staff", force: :cascade do |t| + t.integer "account_id", null: false + t.integer "laboratory_id" + t.string "type" + t.datetime "hired_at" + t.text "qualifications" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["account_id"], name: "index_staff_on_account_id", unique: true + t.index ["laboratory_id"], name: "index_staff_on_laboratory_id" + t.index ["type"], name: "index_staff_on_type" + end + create_table "treatments", force: :cascade do |t| t.integer "physician_id", null: false t.integer "patient_id", null: false @@ -139,16 +139,16 @@ ActiveRecord::Schema.define(version: 2020_03_15_204511) do add_foreign_key "beds", "care_centres" add_foreign_key "beds", "patients" - add_foreign_key "consumptions", "employees" add_foreign_key "consumptions", "items" add_foreign_key "consumptions", "patients" - add_foreign_key "employees", "accounts" - add_foreign_key "employees", "laboratories" + add_foreign_key "consumptions", "physicians" add_foreign_key "patients", "accounts" add_foreign_key "patients", "physicians" add_foreign_key "patients", "referring_physicians" add_foreign_key "shifts", "care_centres" - add_foreign_key "shifts", "employees" + add_foreign_key "shifts", "staff" + add_foreign_key "staff", "accounts" + add_foreign_key "staff", "laboratories" add_foreign_key "treatments", "patients" add_foreign_key "treatments", "physicians" add_foreign_key "visits", "patients" |
