Files
simple-aircraft-manager-rails/config/routes.rb
T
rickyandClaude Opus 5.5 5bf682502b AirTrail sync and export, GPS tracks, airport database with autocomplete
AirTrail (https://github.com/johanohly/AirTrail):
- File export (Flights → Export for AirTrail) in AirTrail's import
  format, validated against its schema; same-day repeat legs get leg
  numbers so AirTrail's de-duplication doesn't merge them.
- Automatic sync through AirTrail's REST API (Profile → AirTrail sync):
  per-user connection with an encrypted API key and scope check; flights
  are created/updated/deleted in background jobs; a full sync first
  links flights already in AirTrail (e.g. from a file import) instead of
  duplicating them; airports are resolved and cached, with manual
  mapping for unknown codes.
- GPS tracks: GPX, KML and CSV track logs are converted to AirTrail's
  track format for both sync and export; the flight page shows a summary.
- Aircraft ICAO type (e.g. C150) for AirTrail's aircraft type.

Airport database (OurAirports, the source AirTrail uses):
- Managed like AirTrail: downloaded in the background on first start,
  updated in place from Admin → Airports (adds, changes, removes; ids
  stable), with admin-managed custom airports that updates never touch.
- Each airport carries AirTrail's code, so logged codes translate to
  AirTrail's exactly (1B9 → K1B9, 4MB → K5M3).
- From/To autocomplete on new flights (airports this aircraft has used
  rank first); From is pre-filled with the last flight's destination;
  codes are normalized to uppercase.
- Flights → Standardize airport codes: rewrite logged codes to the
  standard code, and fix codes not in the database (typos such as 0R8 →
  08R are suggested).

Also: admin pages grouped under an Admin dropdown menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 19:40:20 -05:00

69 lines
2.2 KiB
Ruby

Rails.application.routes.draw do
resource :session
resources :passwords, param: :token
resource :setup, only: %i[new create], controller: "setup"
resource :profile, only: %i[edit update]
resource :air_trail_connection, path: "profile/airtrail", only: %i[show create update destroy] do
post :test
post :sync
post :map_airport
end
resources :aircraft do
member do
patch :hours, action: :update_hours
end
resources :components do
member { post :reset_service }
end
resources :squawks, except: :show do
member do
patch :resolve
patch :reopen
end
end
resources :notes, except: :show
resources :flight_logs, only: %i[index new create show destroy]
resource :air_trail_export, path: "airtrail_export", only: %i[new create]
resource :airport_codes, only: %i[show update]
resource :flight_import, only: %i[new create show] do
post :confirm
end
resources :consumable_records, path: "consumables", except: :show
resources :logbook_entries
resources :documents
resources :document_collections, except: %i[index show]
resources :inspections, only: :index
resources :inspection_types, except: %i[index show]
resources :inspection_records, except: %i[index show]
resources :airworthiness_directives, path: "ads", except: :show do
collection { post :attach }
end
resources :ad_compliances, except: %i[index show]
resource :ad_import, only: %i[new create show] do
post :confirm
end
resources :major_records
resources :aircraft_roles, path: "access", only: %i[index create update destroy]
resources :share_tokens, only: %i[create destroy]
resources :events, only: :index
end
get "airports/search", to: "airports#search", as: :airport_search
# Public read-only share links (no login).
get "shared/:token", to: "shared#show", as: :shared
namespace :admin do
resources :users, except: :show
resources :component_types, except: :show
resources :airports, except: :show do
collection { post :refresh }
end
end
get "up" => "rails/health#show", as: :rails_health_check
root "aircraft#index"
end