Browse Source

Add data sharing agreement

CLDC-2322-read-and-sign-data-sharing-agreement
Jack S 2 years ago
parent
commit
00a6a10e0f
  1. 4
      app/models/data_sharing_agreement.rb
  2. 1
      app/models/organisation.rb
  3. 17
      db/migrate/20230530094653_add_data_sharing_agreement.rb
  4. 13
      db/schema.rb

4
app/models/data_sharing_agreement.rb

@ -0,0 +1,4 @@
class DataSharingAgreement < ApplicationRecord
belongs_to :organisation
belongs_to :data_protection_officer, class_name: "User"
end

1
app/models/organisation.rb

@ -4,6 +4,7 @@ class Organisation < ApplicationRecord
has_many :managed_lettings_logs, class_name: "LettingsLog", foreign_key: "managing_organisation_id"
has_many :owned_sales_logs, class_name: "SalesLog", foreign_key: "owning_organisation_id", dependent: :delete_all
has_many :data_protection_confirmations
has_one :data_sharing_agreement
has_many :organisation_rent_periods
has_many :owned_schemes, class_name: "Scheme", foreign_key: "owning_organisation_id", dependent: :delete_all
has_many :parent_organisation_relationships, foreign_key: :child_organisation_id, class_name: "OrganisationRelationship"

17
db/migrate/20230530094653_add_data_sharing_agreement.rb

@ -0,0 +1,17 @@
class AddDataSharingAgreement < ActiveRecord::Migration[7.0]
def change
create_table :data_sharing_agreements do |t|
t.belongs_to :organisation
t.belongs_to :data_protection_officer, class_name: "User"
t.datetime :signed_at, null: false
t.timestamps
end
add_index :data_sharing_agreements,
%i[organisation_id data_protection_officer_id],
unique: true,
name: "data_sharing_agreements_unique"
end
end

13
db/schema.rb

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_05_15_114101) do
ActiveRecord::Schema[7.0].define(version: 2023_05_30_094653) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -56,6 +56,17 @@ ActiveRecord::Schema[7.0].define(version: 2023_05_15_114101) do
t.index ["organisation_id"], name: "index_data_protection_confirmations_on_organisation_id"
end
create_table "data_sharing_agreements", force: :cascade do |t|
t.bigint "organisation_id"
t.bigint "data_protection_officer_id"
t.datetime "signed_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["data_protection_officer_id"], name: "index_data_sharing_agreements_on_data_protection_officer_id"
t.index ["organisation_id", "data_protection_officer_id"], name: "data_sharing_agreements_unique", unique: true
t.index ["organisation_id"], name: "index_data_sharing_agreements_on_organisation_id"
end
create_table "la_rent_ranges", force: :cascade do |t|
t.integer "ranges_rent_id"
t.integer "lettype"

Loading…
Cancel
Save