mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
REST API v1: tokens, read endpoints, squawks, webhooks
- Personal tokens (Profile → API tokens) act as their owner; integration tokens (Admin → Integrations) reach chosen aircraft and scopes, and their writes name the person they're for (SAM-On-Behalf-Of). Tokens are stored hashed, shown once, revocable, with last use recorded. - GET aircraft, components, due list, inspections, ADs, logbook entries and squawks; POST/PATCH squawks with external_ref links to the other system. - Idempotency-Key for safe retries, paging, JSON errors, rate limits. - Record history keeps the token with each change (in the hashed payload). - Webhooks (squawk created/updated/resolved, entry signed), HMAC-signed, retried, never sent to the server itself; deliveries listed for admins. - The outbound address check is shared by AirTrail and webhooks; reporting a squawk is announced the same way from the form and the API. - docs/guide/api.md: the API reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ec0f43019f
commit
bffdea937c
45 files changed
+1577
-51
No files matched your search
@@ -27,6 +27,7 @@ Rails.application.routes.draw do
|
||||
# Home-screen shortcuts: the form for your aircraft, or a choice of aircraft.
|
||||
get "go/log-flight", to: "shortcuts#log_flight", as: :log_flight_shortcut
|
||||
get "go/report-squawk", to: "shortcuts#report_squawk", as: :report_squawk_shortcut
|
||||
resources :api_tokens, path: "profile/api_tokens", only: %i[create destroy]
|
||||
resources :certificates, path: "profile/certificates", controller: "user_certificates", only: %i[create update destroy]
|
||||
resource :air_trail_connection, path: "profile/airtrail", only: %i[show create update destroy] do
|
||||
post :test
|
||||
@@ -171,12 +172,34 @@ Rails.application.routes.draw do
|
||||
post "about/test_reminder", to: "about#test_reminder", as: :test_reminder
|
||||
post "about/check_records", to: "about#check_records", as: :check_records
|
||||
resources :users, except: :show
|
||||
resources :integrations do
|
||||
post :new_secret, on: :member
|
||||
end
|
||||
resources :component_types, except: :show
|
||||
resources :airports, except: :show do
|
||||
collection { post :refresh }
|
||||
end
|
||||
end
|
||||
|
||||
# REST API (docs/api.md): bearer tokens, JSON.
|
||||
namespace :api, defaults: { format: :json } do
|
||||
namespace :v1 do
|
||||
get "me", to: "me#show"
|
||||
resources :aircraft, only: %i[index show] do
|
||||
member do
|
||||
get :components
|
||||
get :due
|
||||
get :inspections
|
||||
get :ads
|
||||
get :logbook_entries
|
||||
end
|
||||
resources :squawks, only: %i[index create]
|
||||
end
|
||||
get "squawks", to: "squawks#lookup"
|
||||
resources :squawks, only: %i[show update]
|
||||
end
|
||||
end
|
||||
|
||||
get "up" => "rails/health#show", as: :rails_health_check
|
||||
get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
|
||||
get "offline" => "offline#show", as: :offline
|
||||
|
||||
Reference in new issue
Block a user