added has_tickets filter
Change-Id: Ibb58de03e73033828bec1cb57ccd9742be209bf1 Signed-off-by: smarcet <smarcet@gmail.com>
This commit is contained in:
parent
7eee98f9af
commit
fcabc3114d
@ -364,6 +364,7 @@ final class OAuth2SummitAttendeesApiController extends OAuth2ProtectedController
|
||||
'badge_type' => ['=@', '=='],
|
||||
'status' => ['=@', '=='],
|
||||
'has_member' => ['=='],
|
||||
'has_tickets' => ['=='],
|
||||
'tickets_count' => ['==', '>=', '<=', '>', '<'],
|
||||
];
|
||||
},
|
||||
@ -381,6 +382,7 @@ final class OAuth2SummitAttendeesApiController extends OAuth2ProtectedController
|
||||
'badge_type' => 'sometimes|string',
|
||||
'status' => 'sometimes|string',
|
||||
'has_member' => 'sometimes|required|string|in:true,false',
|
||||
'has_tickets'=> 'sometimes|required|string|in:true,false',
|
||||
'tickets_count' => 'sometimes|integer',
|
||||
];
|
||||
},
|
||||
@ -435,6 +437,7 @@ final class OAuth2SummitAttendeesApiController extends OAuth2ProtectedController
|
||||
'badge_type' => ['=@', '=='],
|
||||
'status' => ['=@', '=='],
|
||||
'has_member' => ['=='],
|
||||
'has_tickets' => ['=='],
|
||||
'tickets_count' => ['==', '>=', '<=', '>', '<'],
|
||||
];
|
||||
},
|
||||
@ -452,6 +455,7 @@ final class OAuth2SummitAttendeesApiController extends OAuth2ProtectedController
|
||||
'badge_type' => 'sometimes|string',
|
||||
'status' => 'sometimes|string',
|
||||
'has_member' => 'sometimes|required|string|in:true,false',
|
||||
'has_tickets'=> 'sometimes|required|string|in:true,false',
|
||||
'tickets_count' => 'sometimes|integer',
|
||||
];
|
||||
},
|
||||
@ -866,6 +870,7 @@ final class OAuth2SummitAttendeesApiController extends OAuth2ProtectedController
|
||||
'status' => ['=@', '=='],
|
||||
'has_member' => ['=='],
|
||||
'tickets_count' => ['==', '>=', '<=', '>', '<'],
|
||||
'has_tickets' => ['=='],
|
||||
]);
|
||||
}
|
||||
|
||||
@ -886,6 +891,7 @@ final class OAuth2SummitAttendeesApiController extends OAuth2ProtectedController
|
||||
'status' => 'sometimes|string',
|
||||
'has_member' => 'sometimes|required|string|in:true,false',
|
||||
'tickets_count' => 'sometimes|integer',
|
||||
'has_tickets'=> 'sometimes|required|string|in:true,false',
|
||||
]);
|
||||
|
||||
$this->attendee_service->triggerSend($summit, $payload, Input::get('filter'));
|
||||
|
@ -17,6 +17,7 @@ use models\summit\ISummitAttendeeRepository;
|
||||
use models\summit\Summit;
|
||||
use models\summit\SummitAttendee;
|
||||
use App\Repositories\SilverStripeDoctrineRepository;
|
||||
use models\summit\SummitAttendeeTicket;
|
||||
use utils\DoctrineCaseFilterMapping;
|
||||
use utils\DoctrineFilterMapping;
|
||||
use utils\DoctrineHavingFilterMapping;
|
||||
@ -70,6 +71,17 @@ final class DoctrineSummitAttendeeRepository
|
||||
),
|
||||
]
|
||||
),
|
||||
'has_tickets' => new DoctrineSwitchFilterMapping([
|
||||
'true' => new DoctrineCaseFilterMapping(
|
||||
'true',
|
||||
sprintf("EXISTS (select t1 from %s t1 where t1.owner = e)", SummitAttendeeTicket::class)
|
||||
),
|
||||
'false' => new DoctrineCaseFilterMapping(
|
||||
'false',
|
||||
sprintf("not EXISTS (select t1 from %s t1 where t1.owner = e)", SummitAttendeeTicket::class)
|
||||
),
|
||||
]
|
||||
),
|
||||
'tickets_count' => new DoctrineHavingFilterMapping("", "t.owner", "count(t.id) :operator :value"),
|
||||
'ticket_type' => new DoctrineFilterMapping("tt.name :operator :value"),
|
||||
'badge_type' => new DoctrineFilterMapping("bt.name :operator :value"),
|
||||
|
@ -22,7 +22,7 @@ class OAuth2AttendeesApiTest extends ProtectedApiTest
|
||||
'page' => 1,
|
||||
'per_page' => 10,
|
||||
'order' => '+id',
|
||||
'filter' => 'tickets_count>0',
|
||||
'filter' => 'has_tickets==true',
|
||||
'expand' => 'member,schedule,rsvp,tickets, tickets.ticket_type'
|
||||
];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user