mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-17 16:40:31 +00:00
✨ Add attendee count helpers and enhance Meetup API responses
- ➕ Introduce `attendeesCount` and `mightAttendeesCount` methods in `MeetupEvent` model for cleaner attendee calculations. - 🛠️ Refactor API responses to use attendee count helpers in `Meetup` and `MeetupEventController`. - 🧪 Update tests to validate JSON structure with attendee-related fields (`id`, `attendees`, `might_attendees`).
This commit is contained in:
@@ -59,10 +59,13 @@ class MeetupEventController extends Controller
|
||||
->get();
|
||||
|
||||
return $events->map(fn ($event) => [
|
||||
'id' => $event->id,
|
||||
'start' => $event->start->format('Y-m-d H:i'),
|
||||
'location' => $event->location,
|
||||
'description' => $event->description,
|
||||
'link' => $event->link,
|
||||
'attendees' => $event->attendeesCount(),
|
||||
'might_attendees' => $event->mightAttendeesCount(),
|
||||
'meetup.name' => $event->meetup->name,
|
||||
'meetup.portalLink' => url()->route(
|
||||
'meetups.landingpage',
|
||||
@@ -202,8 +205,8 @@ class MeetupEventController extends Controller
|
||||
{
|
||||
return [
|
||||
'status' => $meetupEvent->rsvpStatusFor($user)->value,
|
||||
'attendees' => count($meetupEvent->attendees ?? []),
|
||||
'might_attendees' => count($meetupEvent->might_attendees ?? []),
|
||||
'attendees' => $meetupEvent->attendeesCount(),
|
||||
'might_attendees' => $meetupEvent->mightAttendeesCount(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user