mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-18 04:50:30 +00:00
🎨 Add logo field to meetups API responses and fetch media relations for meetups
- ✏️ Updated `MeetupController` to include `with('media')` for meetups query. - 🖼️ Added `logo` to `MeetupResource` via `getFirstMediaUrl`. - 🧪 Extended feature tests to validate `logo` presence and type in API responses.
This commit is contained in:
@@ -115,6 +115,7 @@ class MeetupController extends Controller
|
|||||||
|
|
||||||
$meetups = $request->user()
|
$meetups = $request->user()
|
||||||
->meetups()
|
->meetups()
|
||||||
|
->with('media')
|
||||||
->orderBy('name')
|
->orderBy('name')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class MeetupResource extends JsonResource
|
|||||||
'community' => $this->community,
|
'community' => $this->community,
|
||||||
'visible_on_map' => $this->visible_on_map,
|
'visible_on_map' => $this->visible_on_map,
|
||||||
'is_active' => $this->is_active,
|
'is_active' => $this->is_active,
|
||||||
|
'logo' => $this->getFirstMediaUrl('logo', 'thumb'),
|
||||||
'last_event_at' => $this->last_event_at,
|
'last_event_at' => $this->last_event_at,
|
||||||
'created_by' => $this->created_by,
|
'created_by' => $this->created_by,
|
||||||
'created_at' => $this->created_at,
|
'created_at' => $this->created_at,
|
||||||
|
|||||||
@@ -87,6 +87,11 @@ it('returns the dashboard-selected meetups in mine index', function () {
|
|||||||
expect($ids)
|
expect($ids)
|
||||||
->toContain(...$selected->pluck('id')->all())
|
->toContain(...$selected->pluck('id')->all())
|
||||||
->not->toContain($unselected->id);
|
->not->toContain($unselected->id);
|
||||||
|
|
||||||
|
collect($response->json('data'))->each(
|
||||||
|
fn ($meetup) => expect($meetup)->toHaveKey('logo')
|
||||||
|
->and($meetup['logo'])->toBeString()
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('lets a pivot member view in mine show', function () {
|
it('lets a pivot member view in mine show', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user