commit 3c84e475d50015b15762958c4645baf13e8adbe0 Author: smarcet Date: Wed Oct 14 23:10:15 2020 -0300 Add filter by primary email GET /api/v1/users primary_email Change-Id: I5934fe139e28d6bdcd1bef986e0ec4ed70b5b363 Signed-off-by: smarcet diff --git a/app/Http/Controllers/Api/OAuth2/OAuth2UserApiController.php b/app/Http/Controllers/Api/OAuth2/OAuth2UserApiController.php index b6a1f8d..074b602 100644 --- a/app/Http/Controllers/Api/OAuth2/OAuth2UserApiController.php +++ b/app/Http/Controllers/Api/OAuth2/OAuth2UserApiController.php @@ -54,6 +54,7 @@ final class OAuth2UserApiController extends OAuth2ProtectedController 'first_name' => ['=@', '=='], 'last_name' => ['=@', '=='], 'email' => ['=@', '=='], + 'primary_email' => ['=@', '=='], ]; } @@ -71,6 +72,7 @@ final class OAuth2UserApiController extends OAuth2ProtectedController 'first_name' => 'sometimes|required|string', 'last_name' => 'sometimes|required|string', 'email' => 'sometimes|required|string', + 'primary_email' => 'sometimes|required|string', ]; } diff --git a/app/Repositories/DoctrineUserRepository.php b/app/Repositories/DoctrineUserRepository.php index 9a3d3c4..1aff109 100644 --- a/app/Repositories/DoctrineUserRepository.php +++ b/app/Repositories/DoctrineUserRepository.php @@ -35,6 +35,7 @@ final class DoctrineUserRepository extends ModelDoctrineRepository implements IU 'full_name' => new DoctrineFilterMapping("concat(e.first_name, ' ', e.last_name) :operator :value"), 'github_user' => 'e.github_user:json_string', 'email' => ['e.email:json_string', 'e.second_email:json_string', 'e.third_email:json_string'], + 'primary_email' => 'e.email:json_string', 'active' => 'e.active:json_boolean', 'group_id' => new DoctrineJoinFilterMapping('e.groups', "g", "g.id :operator :value") ];