Skip to content

Commit e783cd6

Browse files
authored
Merge pull request #964 from daveroverts/refactoring
Refactor routes and controllers
2 parents 9fc2a18 + 9d5adca commit e783cd6

150 files changed

Lines changed: 5072 additions & 1082 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 142 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,44 @@ on:
55
branches: [main, beta, alpha]
66
pull_request:
77
jobs:
8+
build-assets:
9+
name: Build assets (Node ${{ matrix.node }})
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
node: [20, 22, 24]
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node }}
23+
cache: "npm"
24+
25+
- name: Build assets
26+
run: |
27+
npm ci
28+
npm run build --no-progress
29+
830
test-php-mysql:
9-
name: Test PHP ${{ matrix.php-versions }} (${{ matrix.stability }}) + Node ${{ matrix.node }} with MySQL
31+
name: Test PHP ${{ matrix.php-versions }} (${{ matrix.stability }}) with MySQL
1032
runs-on: ubuntu-latest
1133
env:
1234
DB_CONNECTION: mysql
1335
DB_DATABASE: laravel
1436
DB_USERNAME: root
1537
DB_PASSWORD: password
16-
BROADCAST_DRIVER: log
38+
BROADCAST_CONNECTION: log
1739
MAIL_MAILER: log
1840
# CACHE_DRIVER: redis
1941
# QUEUE_CONNECTION: redis
2042
# SESSION_DRIVER: redis
2143
services:
2244
mysql:
23-
image: mysql:8.0
45+
image: mysql:8.4
2446
env:
2547
MYSQL_ALLOW_EMPTY_PASSWORD: false
2648
MYSQL_ROOT_PASSWORD: password
@@ -37,8 +59,12 @@ jobs:
3759
fail-fast: false
3860
matrix:
3961
php-versions: ["8.3", "8.4"]
40-
node: [20, 22]
4162
stability: [prefer-lowest, prefer-stable]
63+
coverage: [false]
64+
include:
65+
- php-versions: "8.4"
66+
stability: prefer-stable
67+
coverage: true
4268
steps:
4369
- name: Checkout
4470
uses: actions/checkout@v4
@@ -48,29 +74,29 @@ jobs:
4874
with:
4975
php-version: ${{ matrix.php-versions }}
5076
extensions: mbstring, dom, fileinfo, mysql
51-
coverage: xdebug
77+
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
5278

5379
- name: Setup problem matchers
5480
run: |
5581
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
5682
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
5783
58-
- name: Start mysql service
59-
run: sudo systemctl start mysql.service
60-
6184
- uses: ramsey/composer-install@v3
85+
with:
86+
dependency-versions: ${{ matrix.stability }}
6287

6388
- name: Prepare the application
6489
run: |
6590
php -r "file_exists('.env') || copy('.env.example', '.env');"
6691
php artisan key:generate
92+
6793
- name: Clear Config
6894
run: php artisan config:clear
6995

7096
- name: Setup NPM
7197
uses: actions/setup-node@v4
7298
with:
73-
node-version: ${{ matrix.node }}
99+
node-version: 22
74100
cache: "npm"
75101

76102
- name: Build assets
@@ -85,16 +111,105 @@ jobs:
85111
# REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
86112

87113
- name: Run tests
88-
run: php artisan test --coverage
114+
run: php artisan test --compact ${{ matrix.coverage && '--coverage' || '' }}
89115
env:
90116
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
91117
# REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
92118

119+
test-php-mariadb:
120+
name: Test PHP ${{ matrix.php-versions }} (${{ matrix.stability }}) with MariaDB
121+
runs-on: ubuntu-latest
122+
env:
123+
DB_CONNECTION: mariadb
124+
DB_DATABASE: laravel
125+
DB_USERNAME: root
126+
DB_PASSWORD: password
127+
BROADCAST_CONNECTION: log
128+
MAIL_MAILER: log
129+
# CACHE_DRIVER: redis
130+
# QUEUE_CONNECTION: redis
131+
# SESSION_DRIVER: redis
132+
services:
133+
mariadb:
134+
image: mariadb:11
135+
env:
136+
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: false
137+
MARIADB_ROOT_PASSWORD: password
138+
MARIADB_DATABASE: laravel
139+
ports:
140+
- 3306/tcp
141+
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
142+
# redis:
143+
# image: redis
144+
# ports:
145+
# - 6379/tcp
146+
# options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
147+
strategy:
148+
fail-fast: false
149+
matrix:
150+
php-versions: ["8.3", "8.4"]
151+
stability: [prefer-lowest, prefer-stable]
152+
coverage: [false]
153+
include:
154+
- php-versions: "8.4"
155+
stability: prefer-stable
156+
coverage: true
157+
steps:
158+
- name: Checkout
159+
uses: actions/checkout@v4
160+
161+
- name: Setup PHP, with composer and extensions
162+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
163+
with:
164+
php-version: ${{ matrix.php-versions }}
165+
extensions: mbstring, dom, fileinfo, mysql
166+
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
167+
168+
- name: Setup problem matchers
169+
run: |
170+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
171+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
172+
173+
- uses: ramsey/composer-install@v3
174+
with:
175+
dependency-versions: ${{ matrix.stability }}
176+
177+
- name: Prepare the application
178+
run: |
179+
php -r "file_exists('.env') || copy('.env.example', '.env');"
180+
php artisan key:generate
181+
182+
- name: Clear Config
183+
run: php artisan config:clear
184+
185+
- name: Setup NPM
186+
uses: actions/setup-node@v4
187+
with:
188+
node-version: 22
189+
cache: "npm"
190+
191+
- name: Build assets
192+
run: |
193+
npm ci
194+
npm run build --no-progress
195+
196+
- name: Run Migration
197+
run: php artisan migrate -v
198+
env:
199+
DB_PORT: ${{ job.services.mariadb.ports['3306'] }}
200+
# REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
201+
202+
- name: Run tests
203+
run: php artisan test --compact ${{ matrix.coverage && '--coverage' || '' }}
204+
env:
205+
DB_PORT: ${{ job.services.mariadb.ports['3306'] }}
206+
# REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
207+
93208
test-php-postgresql:
94-
name: Test PHP ${{ matrix.php-versions }} (${{ matrix.stability }}) + Node ${{ matrix.node }} with PostgreSQL
209+
name: Test PHP ${{ matrix.php-versions }} (${{ matrix.stability }}) with PostgreSQL
95210
runs-on: ubuntu-latest
96211
env:
97-
BROADCAST_DRIVER: log
212+
BROADCAST_CONNECTION: log
98213
MAIL_MAILER: log
99214
# CACHE_DRIVER: redis
100215
# QUEUE_CONNECTION: redis
@@ -106,7 +221,7 @@ jobs:
106221
DB_DATABASE: postgres
107222
services:
108223
postgres:
109-
image: postgres:14.1
224+
image: postgres:17
110225
env:
111226
POSTGRES_USER: postgres
112227
POSTGRES_PASSWORD: postgres
@@ -122,9 +237,13 @@ jobs:
122237
strategy:
123238
fail-fast: false
124239
matrix:
125-
php-versions: [8.3", "8.4"]
126-
node: [20, 22]
240+
php-versions: ["8.3", "8.4"]
127241
stability: [prefer-lowest, prefer-stable]
242+
coverage: [false]
243+
include:
244+
- php-versions: "8.4"
245+
stability: prefer-stable
246+
coverage: true
128247
steps:
129248
- name: Checkout
130249
uses: actions/checkout@v4
@@ -134,42 +253,44 @@ jobs:
134253
with:
135254
php-version: ${{ matrix.php-versions }}
136255
extensions: mbstring, dom, fileinfo, pgsql
137-
coverage: xdebug
256+
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
138257

139258
- name: Setup problem matchers
140259
run: |
141260
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
142261
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
143262
144263
- uses: ramsey/composer-install@v3
264+
with:
265+
dependency-versions: ${{ matrix.stability }}
145266

146267
- name: Prepare the application
147268
run: |
148269
php -r "file_exists('.env') || copy('.env.example', '.env');"
149270
php artisan key:generate
150271
272+
- name: Clear Config
273+
run: php artisan config:clear
274+
151275
- name: Setup NPM
152276
uses: actions/setup-node@v4
153277
with:
154-
node-version: ${{ matrix.node }}
278+
node-version: 22
155279
cache: "npm"
156280

157281
- name: Build assets
158282
run: |
159283
npm ci
160284
npm run build --no-progress
161285
162-
- name: Clear Config
163-
run: php artisan config:clear
164-
165286
- name: Run Migration
166287
run: php artisan migrate -v
167288
env:
168289
DB_PORT: ${{ job.services.postgres.ports[5432] }}
169290
# REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
170291

171292
- name: Run tests
172-
run: php artisan test --coverage
293+
run: php artisan test --compact ${{ matrix.coverage && '--coverage' || '' }}
173294
env:
174295
DB_PORT: ${{ job.services.postgres.ports[5432] }}
175296
# REDIS_PORT: ${{ job.services.redis.ports['6379'] }}

.junie/guidelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The Laravel Boost guidelines are specifically curated by Laravel maintainers for
99

1010
This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.
1111

12-
- php - 8.4.17
12+
- php - 8.4.18
1313
- laravel/framework (LARAVEL) - v12
1414
- laravel/horizon (HORIZON) - v5
1515
- laravel/prompts (PROMPTS) - v0

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The Laravel Boost guidelines are specifically curated by Laravel maintainers for
99

1010
This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.
1111

12-
- php - 8.4.17
12+
- php - 8.4.18
1313
- laravel/framework (LARAVEL) - v12
1414
- laravel/horizon (HORIZON) - v5
1515
- laravel/prompts (PROMPTS) - v0

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The Laravel Boost guidelines are specifically curated by Laravel maintainers for
99

1010
This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.
1111

12-
- php - 8.4.17
12+
- php - 8.4.18
1313
- laravel/framework (LARAVEL) - v12
1414
- laravel/horizon (HORIZON) - v5
1515
- laravel/prompts (PROMPTS) - v0

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
<p align="center">
2+
<img src="public/images/bmac-logo.png" alt="BMAC Logo" width="200">
3+
</p>
14

25
# Book me a Cookie [BMAC]
36

47
![CI](https://github.com/daveroverts/bmac/workflows/CI/badge.svg)
58

9+
> **Notice:** The unversioned API routes (`/api/events`, `/api/bookings`, etc.) are deprecated and will be removed on **2026-12-31**. Please migrate to `/api/v1/`. See [API](#api) for details.
610
711
Book me a Cookie [BMAC] is a Vatsim booking system created in Laravel.
812
It's initial purpose was to be used for one event (The Holland - America Line),
@@ -196,6 +200,44 @@ run the following command:
196200
If you're planning on importing flights later on,
197201
add the airports in first before starting a import.
198202

203+
## API
204+
205+
BMAC exposes a read-only JSON API. All endpoints are public and require no authentication.
206+
207+
### v1 (stable)
208+
209+
Base URL: `/api/v1`
210+
211+
| Method | Endpoint | Description |
212+
|--------|----------|-------------|
213+
| GET | `/api/v1/events` | Paginated list of all events |
214+
| GET | `/api/v1/events/upcoming/{limit?}` | Upcoming online events (default: 3) |
215+
| GET | `/api/v1/events/{event}` | Single event |
216+
| GET | `/api/v1/events/{event}/bookings` | Confirmed bookings for an event |
217+
| GET | `/api/v1/bookings/{booking}` | Single booking |
218+
| GET | `/api/v1/airports` | Paginated list of all airports |
219+
| GET | `/api/v1/airports/{airport}` | Single airport |
220+
221+
Interactive documentation is available at `/docs/api`.
222+
223+
> **Note:** The `full_name` field has been removed from v1 booking responses
224+
> (`/api/v1/bookings/{booking}` and `/api/v1/events/{event}/bookings`) as it felt unnecessary to expose.
225+
> The legacy unversioned routes still include `full_name` until their removal.
226+
227+
### Legacy unversioned routes (deprecated)
228+
229+
The unversioned routes (`/api/events`, `/api/bookings`, `/api/airports`, etc.) are **deprecated**
230+
and will be removed on **2026-12-31**. They remain fully functional in the meantime, but all
231+
responses include the following deprecation headers per [RFC 8594](https://httpwg.org/specs/rfc8594.html):
232+
233+
```
234+
Deprecation: true
235+
Sunset: Wed, 31 Dec 2026 23:59:59 GMT
236+
Link: <https://your-domain/api/v1>; rel="successor-version"
237+
```
238+
239+
Please migrate to the `/api/v1/` equivalents listed above.
240+
199241
## Queue worker / Laravel Horizon
200242

201243
If you're not using `sync` as `QUEUE_CONNECTION`, you need to run a queue worker,

0 commit comments

Comments
 (0)