refactor(meetup): re-add RsvpResponse

This commit is contained in:
Oliver Davies 2022-01-14 00:04:35 +00:00
parent 3350085e85
commit ae0e0c2437
2 changed files with 12 additions and 1 deletions

View file

@ -23,7 +23,7 @@ final class MeetupEventRepository implements EventRepository
$rsvps = json_decode($response->getContent()); $rsvps = json_decode($response->getContent());
return Collection::make($rsvps) return Collection::make($rsvps)
->filter(fn (\stdClass $rsvp): bool => $rsvp->response == 'yes') ->filter(fn (\stdClass $rsvp): bool => $rsvp->response == RsvpResponse::RESPONSE_YES)
->filter(fn (\stdClass $attendee): bool => !$attendee->member->event_context->host) ->filter(fn (\stdClass $attendee): bool => !$attendee->member->event_context->host)
->map(function (\stdClass $attendee): \stdClass { ->map(function (\stdClass $attendee): \stdClass {
$attendee->is_attending = true; $attendee->is_attending = true;

View file

@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace App\Meetup;
final class RsvpResponse
{
public const RESPONSE_NO = 'no';
public const RESPONSE_YES = 'yes';
}