Skip to content

List only the signed-in pilot's flights, and name the cities in the SimBrief preview - #349

Merged
oskarbarcz merged 1 commit into
mainfrom
pilot-own-flights
Nov 18, 2026
Merged

oskarbarcz merged 1 commit into
mainfrom
pilot-own-flights

Conversation

@oskarbarcz

@oskarbarcz oskarbarcz commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Two small additions the pilot dashboard needs once pilots import their own plans.

What changes

  • GET /api/v1/flight?captain=me lists only the flights the signed-in user captained, combinable with phase, sort and order. The app uses it for a pilot's Recent flights and Flight history, which listed every pilot's flights until now. Without signing in it answers 401 ("Sign in to list your own flights."). Any other value is a 400 validation error.
  • The SimBrief preview (GET /api/v1/user/simbrief/:id) now returns each airport's city, and for an airport MyPreflight already knows, MyPreflight's IATA code. It looks the airport up through GetAirportByIcaoCodeQuery. Unknown airports keep SimBrief's IATA code, with city: null. The import window shows "FRA" over "Frankfurt" from this.

Tests

  • Functional:
    • flight.list.feature: Rick lists his 3 finished flights, newest first; Alan has none; anonymous gets 401; captain=someone gets 400.
    • simbrief.verify.feature: carries the cities.
  • Unit: a known airport's IATA code and city win over SimBrief's.
  • Full run: On the top of this stack (Remove a flight that was checked in but not boarded for 24 hours #350, which contains this commit): format (whole repo; its only warning is a git-excluded local .impeccable cache CI never sees), lint, test (1449) and test:functional (1624 scenarios) all exit 0.

Version 3.90.0. Stacked on #348.

Knowledge base: mypreflight/product#78. Web app: mypreflight/app#366.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

OpenTofu plan for infra

Commit b3a4dfe · Plan: 1 to add, 1 to change, 1 to destroy.

Show plan
 OpenTofu used the selected providers to generate the following execution
 plan. Resource actions are indicated with the following symbols:
!  ~ update in-place (current -> planned)
!-/+ destroy and then create replacement
 
 OpenTofu will perform the following actions:
 
   # aws_ecs_service.app will be updated in-place
!  ~ resource "aws_ecs_service" "app" {
         id                                 = "arn:aws:ecs:eu-central-1:805830022748:service/mypreflight/flight-tracker-api"
         name                               = "flight-tracker-api"
         tags                               = {}
!      ~ task_definition                    = "arn:aws:ecs:eu-central-1:805830022748:task-definition/flight-tracker-api:22" -> (known after apply)
         # (19 unchanged attributes hidden)
 
         # (4 unchanged blocks hidden)
     }
 
   # aws_ecs_task_definition.app must be replaced
!-/+ resource "aws_ecs_task_definition" "app" {
!      ~ arn                      = "arn:aws:ecs:eu-central-1:805830022748:task-definition/flight-tracker-api:22" -> (known after apply)
!      ~ arn_without_revision     = "arn:aws:ecs:eu-central-1:805830022748:task-definition/flight-tracker-api" -> (known after apply)
!      ~ container_definitions    = jsonencode(
!          ~ [
                 {
                     command                = [
                         "tunnel",
                         "--no-autoupdate",
                         "--metrics",
                         "localhost:20241",
                         "--grace-period",
                         "20s",
                         "run",
                     ]
                     dependsOn              = [
                         {
                             condition     = "HEALTHY"
                             containerName = "flight-tracker-api"
                         },
                     ]
                     environment            = []
                     essential              = true
                     healthCheck            = {
                         command     = [
                             "CMD",
                             "cloudflared",
                             "tunnel",
                             "--metrics",
                             "localhost:20241",
                             "ready",
                         ]
                         interval    = 5
                         retries     = 6
                         startPeriod = 10
                         timeout     = 2
                     }
                     image                  = "cloudflare/cloudflared@sha256:4955524aeaa379e154023d5a027c250f7b35041a2e7e950cf13f144bc9b9c5ba"
                     linuxParameters        = {
                         capabilities = {
                             add  = []
                             drop = [
                                 "ALL",
                             ]
                         }
                     }
                     logConfiguration       = {
                         logDriver = "awslogs"
                         options   = {
                             awslogs-group         = "/ecs/flight-tracker-api"
                             awslogs-region        = "eu-central-1"
                             awslogs-stream-prefix = "cloudflared"
                         }
                     }
                     mountPoints            = []
                     name                   = "cloudflared"
                     portMappings           = []
                     readonlyRootFilesystem = true
                     secrets                = [
                         {
                             name      = "TUNNEL_TOKEN"
                             valueFrom = "arn:aws:ssm:eu-central-1:805830022748:parameter/mypreflight/api/cloudflare-tunnel-token"
                         },
                     ]
                     systemControls         = []
                     volumesFrom            = []
                 },
!              ~ {
!                  ~ image                  = "ghcr.io/mypreflight/flight-tracker-api:3.88.0" -> "ghcr.io/mypreflight/flight-tracker-api:3.90.0"
                     name                   = "flight-tracker-api"
                     # (11 unchanged attributes hidden)
                 },
             ] # forces replacement
         )
!      ~ enable_fault_injection   = false -> (known after apply)
!      ~ id                       = "flight-tracker-api" -> (known after apply)
!      ~ revision                 = 22 -> (known after apply)
-      - tags                     = {} -> null
         # (11 unchanged attributes hidden)
 
-      - volume {
-          - configure_at_launch = false -> null
-          - name                = "tmp" -> null
         }
+      + volume {
+          + configure_at_launch = (known after apply)
+          + name                = "tmp"
         }
 
         # (1 unchanged block hidden)
     }
 
 Plan: 1 to add, 1 to change, 1 to destroy.
 
 Changes to Outputs:
!  ~ app_image        = "ghcr.io/mypreflight/flight-tracker-api:3.88.0" -> "ghcr.io/mypreflight/flight-tracker-api:3.90.0"

Workflow run

Base automatically changed from pilot-simbrief-import to main November 18, 2026 10:53
…imBrief preview

GET /api/v1/flight takes captain=me, so a pilot's recent flights and
flight history list only the flights they captained. Without signing in
it answers 401.

The SimBrief preview returns MyPreflight's IATA code and city for an
airport it already knows, so the import window can show FRA over
Frankfurt instead of SimBrief's raw fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oskarbarcz oskarbarcz self-assigned this Nov 18, 2026
@oskarbarcz
oskarbarcz merged commit 3d6429c into main Nov 18, 2026
4 checks passed
@oskarbarcz
oskarbarcz deleted the pilot-own-flights branch November 18, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant