Skip to content

New booking schema#4967

Draft
kristiankunc wants to merge 10 commits into
mainfrom
tech-675-new-booking-schema
Draft

New booking schema#4967
kristiankunc wants to merge 10 commits into
mainfrom
tech-675-new-booking-schema

Conversation

@kristiankunc

@kristiankunc kristiankunc commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

New bookings table in core

  • Optionally links to additional sources (exams, sessions, ...)
  • Optionally links to now legacy cts booking for later migrations
  • Core logic has been migrated to use this table

@linear

linear Bot commented Jul 1, 2026

Copy link
Copy Markdown

TECH-675

@kristiankunc kristiankunc marked this pull request as draft July 1, 2026 22:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces a new core bookings schema (model + table) and migrates existing CTS bookings into it, updating exam-related flows and adding UKCP-driven position syncing to support the new structure.

Changes:

  • Add core bookings table/model with polymorphic bookable linkage and migrate CTS bookings into core.
  • Update exam acceptance booking creation + repository formatting/tests to use the new core bookings schema.
  • Add UKCP controller-position sync (API method, job, artisan command, scheduler) and extend positions with ukcp_position_id + soft deletes.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
tests/Unit/Training/Exams/CreateCtsBookingEntryTest.php Updates unit tests for exam booking creation to assert against core bookings schema and bookable linkage.
tests/Unit/Services/BookingServiceTest.php Adds unit coverage for BookingService create/update/delete and overlap validation.
tests/Unit/Models/BookingTest.php Adds unit coverage for the new Booking model relationships/scopes/casts.
tests/Unit/Jobs/SyncUkcpPositionsTest.php Adds unit coverage for the UKCP→core positions sync job behavior (create/update/delete/dry-run).
tests/Unit/CTS/BookingsRepositoryTest.php Updates repository tests to reflect core bookings schema fields and formatting output.
tests/Feature/Training/Exams/ExamAcceptedEventIntegrationTest.php Updates integration test to assert event listeners now create core bookings (not CTS bookings).
tests/Feature/Admin/Positions/PositionResourceTest.php Updates admin resource test expectations after removing sub_station.
database/migrations/2026_07_03_000002_migrate_cts_bookings_to_core.php Adds data migration from CTS bookings into core bookings.
database/migrations/2026_07_03_000001_create_bookings_table.php Creates new bookings table with FK/morph columns and overlap-related indexes.
database/migrations/2026_07_01_000001_add_ukcp_position_id_and_drop_sub_station_from_positions_table.php Adds ukcp_position_id + soft deletes to positions, and removes sub_station.
database/factories/BookingFactory.php Adds factory for the new Booking model + helper states.
database/factories/Atc/PositionFactory.php Removes sub_station from position factory defaults.
app/Support/PositionHelper.php Adds helper to extract ICAO from a callsign.
app/Services/BookingService.php Adds service layer for booking creation/updating with overlap validation.
app/Repositories/Cts/BookingRepository.php Reworks repository queries/formatting to use new booking schema and type mapping.
app/Models/Booking.php Introduces new core Booking model with relationships and query scopes.
app/Models/Atc/Position.php Adds bookings relationship, UKCP sync fields, soft deletes, and callsign-type inference.
app/Listeners/Training/Exams/CreateCtsBookingEntry.php Updates listener to create a core Booking entry on exam acceptance using BookingService.
app/Libraries/UKCP.php Adds UKCP API method to fetch controller positions.
app/Jobs/SyncUkcpPositions.php Adds queued job to sync UKCP controller positions into core positions.
app/Filament/Admin/Resources/Positions/PositionResource.php Updates Filament admin UI to reflect UKCP-synced fields and remove sub_station.
app/Console/Kernel.php Schedules daily UKCP position sync command execution.
app/Console/Commands/SyncUkcpPositions.php Adds artisan command wrapper to run the UKCP sync job (with --dry-run).
.gitignore Adds docs/superpowers to ignored paths.

Comment thread app/Models/Atc/Position.php
Comment thread app/Models/Atc/Position.php
Comment thread app/Services/BookingService.php
Comment thread app/Console/Commands/SyncUkcpPositions.php
Comment thread app/Jobs/SyncUkcpPositions.php
Comment thread app/Jobs/SyncUkcpPositions.php
Comment thread app/Repositories/Cts/BookingRepository.php
Comment thread app/Repositories/Cts/BookingRepository.php
Comment thread app/Repositories/Cts/BookingRepository.php
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.

2 participants