New booking schema#4967
Draft
kristiankunc wants to merge 10 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
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
bookingstable/model with polymorphicbookablelinkage 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
positionswithukcp_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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New bookings table in core