Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ end
group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
gem "rails-erd"
end

group :test do
Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
choice (0.2.0)
concurrent-ruby (1.3.5)
connection_pool (2.5.4)
crass (1.0.6)
Expand Down Expand Up @@ -235,6 +236,11 @@ GEM
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-erd (1.7.2)
activerecord (>= 4.2)
activesupport (>= 4.2)
choice (~> 0.2.0)
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
Expand Down Expand Up @@ -284,6 +290,8 @@ GEM
rubocop (>= 1.72)
rubocop-performance (>= 1.24)
rubocop-rails (>= 2.30)
ruby-graphviz (1.2.5)
rexml
ruby-progressbar (1.13.0)
rubyzip (3.1.1)
securerandom (0.4.1)
Expand Down Expand Up @@ -384,6 +392,7 @@ DEPENDENCIES
propshaft
puma (>= 5.0)
rails (~> 8.0.3)
rails-erd
rubocop-rails-omakase
selenium-webdriver
solid_cable
Expand Down
3 changes: 3 additions & 0 deletions app/models/access_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class AccessController < ApplicationRecord
belongs_to :sector
end
2 changes: 2 additions & 0 deletions app/models/access_path.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class AccessPath < ApplicationRecord
end
2 changes: 2 additions & 0 deletions app/models/access_rule_set.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class AccessRuleSet < ApplicationRecord
end
2 changes: 2 additions & 0 deletions app/models/building.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Building < ApplicationRecord
end
4 changes: 4 additions & 0 deletions app/models/credential.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Credential < ApplicationRecord
belongs_to :person
belongs_to :credential_type
end
2 changes: 2 additions & 0 deletions app/models/credential_format.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class CredentialFormat < ApplicationRecord
end
2 changes: 2 additions & 0 deletions app/models/credential_format_field.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class CredentialFormatField < ApplicationRecord
end
3 changes: 3 additions & 0 deletions app/models/credential_format_field_bit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class CredentialFormatFieldBit < ApplicationRecord
belongs_to :credential_format_field
end
2 changes: 2 additions & 0 deletions app/models/credential_format_parity_bit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class CredentialFormatParityBit < ApplicationRecord
end
3 changes: 3 additions & 0 deletions app/models/credential_format_parity_bit_range.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class CredentialFormatParityBitRange < ApplicationRecord
belongs_to :credential_format_parity
end
2 changes: 2 additions & 0 deletions app/models/credential_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class CredentialType < ApplicationRecord
end
4 changes: 4 additions & 0 deletions app/models/entry_way.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class EntryWay < ApplicationRecord
belongs_to :sector
belongs_to :access_controller
end
2 changes: 2 additions & 0 deletions app/models/group.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Group < ApplicationRecord
end
3 changes: 3 additions & 0 deletions app/models/person.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Person < ApplicationRecord
belongs_to :group
end
4 changes: 4 additions & 0 deletions app/models/reader.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Reader < ApplicationRecord
belongs_to :access_controller
belongs_to :entry_way
end
4 changes: 4 additions & 0 deletions app/models/sector.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Sector < ApplicationRecord
belongs_to :building
belongs_to :parent
end
4 changes: 4 additions & 0 deletions app/models/sensor.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Sensor < ApplicationRecord
belongs_to :access_controller
belongs_to :entry_way
end
15 changes: 15 additions & 0 deletions db/migrate/20251002155507_create_buildings.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class CreateBuildings < ActiveRecord::Migration[8.0]
def change
create_table :buildings do |t|
t.string :name
t.string :address
t.string :address_2
t.string :city
t.string :region
t.string :country
t.string :postal_code

t.timestamps
end
end
end
11 changes: 11 additions & 0 deletions db/migrate/20251002155745_create_sectors.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreateSectors < ActiveRecord::Migration[8.0]
def change
create_table :sectors do |t|
t.string :name
t.references :building, null: false, foreign_key: true
t.references :parent, null: true, foreign_key: { to_table: :sectors }

t.timestamps
end
end
end
9 changes: 9 additions & 0 deletions db/migrate/20251002160131_create_access_paths.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateAccessPaths < ActiveRecord::Migration[8.0]
def change
create_table :access_paths do |t|
t.string :name

t.timestamps
end
end
end
15 changes: 15 additions & 0 deletions db/migrate/20251002160746_create_access_controllers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class CreateAccessControllers < ActiveRecord::Migration[8.0]
def change
create_table :access_controllers do |t|
t.string :name
t.string :model
t.string :brand
t.json :metadata
t.json :public_metadata
t.references :sector, null: false, foreign_key: true
t.boolean :is_virtual

t.timestamps
end
end
end
11 changes: 11 additions & 0 deletions db/migrate/20251002160910_create_entry_ways.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreateEntryWays < ActiveRecord::Migration[8.0]
def change
create_table :entry_ways do |t|
t.string :name
t.references :sector, null: false, foreign_key: true
t.references :access_controller, null: false, foreign_key: true

t.timestamps
end
end
end
16 changes: 16 additions & 0 deletions db/migrate/20251002161415_create_readers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class CreateReaders < ActiveRecord::Migration[8.0]
def change
create_table :readers do |t|
t.string :name
t.string :brand
t.string :model
t.string :serial_number
t.references :access_controller, null: false, foreign_key: true
t.string :last_known_state
t.datetime :last_state_update
t.references :entry_way, null: false, foreign_key: true

t.timestamps
end
end
end
9 changes: 9 additions & 0 deletions db/migrate/20251002161515_create_groups.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateGroups < ActiveRecord::Migration[8.0]
def change
create_table :groups do |t|
t.string :name

t.timestamps
end
end
end
15 changes: 15 additions & 0 deletions db/migrate/20251002161628_create_people.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class CreatePeople < ActiveRecord::Migration[8.0]
def change
create_table :people do |t|
t.string :first_name
t.string :last_name
t.string :title
t.string :phone_number
t.string :email
t.references :group, null: false, foreign_key: true
t.json :metadata

t.timestamps
end
end
end
16 changes: 16 additions & 0 deletions db/migrate/20251002161732_create_sensors.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class CreateSensors < ActiveRecord::Migration[8.0]
def change
create_table :sensors do |t|
t.string :name
t.string :brand
t.string :model
t.string :serial_number
t.references :access_controller, null: false, foreign_key: true
t.references :entry_way, null: false, foreign_key: true
t.string :last_known_state
t.datetime :last_state_update

t.timestamps
end
end
end
10 changes: 10 additions & 0 deletions db/migrate/20251002162628_create_credential_formats.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateCredentialFormats < ActiveRecord::Migration[8.0]
def change
create_table :credential_formats do |t|
t.string :name
t.integer :length

t.timestamps
end
end
end
9 changes: 9 additions & 0 deletions db/migrate/20251002162752_create_credential_format_fields.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateCredentialFormatFields < ActiveRecord::Migration[8.0]
def change
create_table :credential_format_fields do |t|
t.string :name

t.timestamps
end
end
end
11 changes: 11 additions & 0 deletions db/migrate/20251002163403_create_credential_format_field_bits.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreateCredentialFormatFieldBits < ActiveRecord::Migration[8.0]
def change
create_table :credential_format_field_bits do |t|
t.integer :index
t.references :credential_format_field, null: false, foreign_key: true
t.integer :position

t.timestamps
end
end
end
10 changes: 10 additions & 0 deletions db/migrate/20251002163501_create_credential_format_parity_bits.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateCredentialFormatParityBits < ActiveRecord::Migration[8.0]
def change
create_table :credential_format_parity_bits do |t|
t.string :kind
t.string :index

t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreateCredentialFormatParityBitRanges < ActiveRecord::Migration[8.0]
def change
create_table :credential_format_parity_bit_ranges do |t|
t.references :credential_format_parity, null: false, foreign_key: true
t.integer :index
t.integer :position

t.timestamps
end
end
end
11 changes: 11 additions & 0 deletions db/migrate/20251002164322_create_credential_types.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreateCredentialTypes < ActiveRecord::Migration[8.0]
def change
create_table :credential_types do |t|
t.string :kind
t.string :frequency
t.string :protocol

t.timestamps
end
end
end
10 changes: 10 additions & 0 deletions db/migrate/20251002165720_create_credentials.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateCredentials < ActiveRecord::Migration[8.0]
def change
create_table :credentials do |t|
t.references :person, null: false, foreign_key: true
t.references :credential_type, null: false, foreign_key: true

t.timestamps
end
end
end
9 changes: 9 additions & 0 deletions db/migrate/20251003152945_create_access_rule_sets.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateAccessRuleSets < ActiveRecord::Migration[8.0]
def change
create_table :access_rule_sets do |t|
t.string :name

t.timestamps
end
end
end
Loading
Loading