mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
AC 120-78B chapter 3:
- Every change to logbook entries, sub-components, signatures, inspection
records, AD compliance, major records, W&B, components, squawks and
documents is kept as a RecordVersion (who, IP, when, field changes),
hash-chained per aircraft; versions can't be edited or deleted. Shown on
each logbook entry and in Activity -> Record history
- Nightly job: SQLite online-backup copy to storage/backups, verified
(integrity_check + record counts), pruned to the configured number; then
an integrity check of the history chains and every signature's seal and
fingerprint. Results on Admin -> About ("Back up and check now"); admins
are emailed on failure
- Software versions recorded (first/last seen) on Admin -> About
- Records package (Access & Sharing): logbook entries PDF with signatures,
signatures.csv, record-history.csv, self-contained status report HTML,
the .sam.zip, and a README, for the FAA/NTSB or a buyer
- Legacy (paper) records: documents can be marked as legacy records;
aircraft have an "electronic records since" date (status report, package)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
863 B
Ruby
21 lines
863 B
Ruby
class MajorRecord < ApplicationRecord
|
|
include Versioned
|
|
RECORD_TYPES = { "repair" => "Major Repair", "alteration" => "Major Alteration" }.freeze
|
|
|
|
belongs_to :aircraft
|
|
belongs_to :component, optional: true
|
|
belongs_to :form_337_document, class_name: "Document", optional: true
|
|
belongs_to :stc_document, class_name: "Document", optional: true
|
|
belongs_to :logbook_entry, optional: true
|
|
# The recurring inspection this STC's Instructions for Continued
|
|
# Airworthiness call for (owners must follow ICAs: 91.403(c), 43.13(a)).
|
|
belongs_to :ica_inspection_type, class_name: "InspectionType", optional: true
|
|
|
|
validates :title, :date_performed, presence: true
|
|
validates :record_type, inclusion: { in: RECORD_TYPES.keys }
|
|
|
|
scope :recent_first, -> { order(date_performed: :desc, created_at: :desc) }
|
|
|
|
def type_label = RECORD_TYPES[record_type]
|
|
end
|