Initial commit: Rails port of Simple Aircraft Manager

Rails 8.1 + SQLite rewrite of marbindrakon/simple-aircraft-manager,
designed to self-host as a single container (Solid Queue/Cache/Cable,
Active Storage on disk, Hotwire + importmap, Tailwind).

- Airworthiness engine ported from health/services.py (ADs, grounding
  squawks, inspection recurrency, component replacement)
- Hours updates and flight logs cascading to in-service components,
  optional airworthiness enforcement
- Components, squawks, ADs, inspections, logbook, documents, major
  records, oil/fuel consumption stats and charts, activity log
- Admin/owner/pilot RBAC and public share links (status/maintenance)
- Docker Compose and Kamal deployment, env-driven production config
- Service and integration tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-04 17:59:08 -05:00
commit 38df19c331
264 files changed
+8365

No files matched your search

+62
View File
@@ -0,0 +1,62 @@
class SquawksController < ApplicationController
include AircraftScoped
# Pilots may create squawks; editing/resolving needs an owner.
before_action :require_owner!, except: %i[index new create]
before_action :set_squawk, only: %i[edit update destroy resolve reopen]
def index
@active = @aircraft.squawks.active.by_priority.includes(:component, :reported_by)
@resolved = @aircraft.squawks.resolved.order(resolved_at: :desc).includes(:component).limit(100)
end
def new
@squawk = @aircraft.squawks.new(priority: 1)
end
def create
@squawk = @aircraft.squawks.new(squawk_params.merge(reported_by: current_user))
if @squawk.save
log_event("squawk", "Squawk reported: #{@squawk.priority_label}", notes: @squawk.issue_reported.truncate(200))
redirect_to aircraft_squawks_path(@aircraft), notice: "Squawk reported."
else
render :new, status: :unprocessable_entity
end
end
def edit; end
def update
if @squawk.update(squawk_params)
log_event("squawk", "Squawk updated")
redirect_to aircraft_squawks_path(@aircraft), notice: "Squawk updated."
else
render :edit, status: :unprocessable_entity
end
end
def resolve
@squawk.resolve!(notes: params[:resolution_notes])
log_event("squawk", "Squawk resolved", notes: @squawk.issue_reported.truncate(200))
redirect_back fallback_location: aircraft_squawks_path(@aircraft), notice: "Squawk resolved."
end
def reopen
@squawk.update!(resolved: false, resolved_at: nil)
log_event("squawk", "Squawk reopened")
redirect_to aircraft_squawks_path(@aircraft), notice: "Squawk reopened."
end
def destroy
@squawk.destroy!
log_event("squawk", "Squawk deleted")
redirect_to aircraft_squawks_path(@aircraft), notice: "Squawk deleted."
end
private
def set_squawk = @squawk = @aircraft.squawks.find(params[:id])
def squawk_params
params.require(:squawk).permit(:priority, :issue_reported, :component_id, :notes, :attachment)
end
end