From 40b5b6668b67b9eb1a6ac6059dd5608933b9cf0b Mon Sep 17 00:00:00 2001 From: Leonardo Custodio Date: Thu, 14 Mar 2024 20:08:54 -0300 Subject: [PATCH] changes --- .../Primary/Substrate/Queries/GetWalletsQuery.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/GraphQL/Schemas/Primary/Substrate/Queries/GetWalletsQuery.php b/src/GraphQL/Schemas/Primary/Substrate/Queries/GetWalletsQuery.php index 4e65fcaf..4d4b0ac2 100644 --- a/src/GraphQL/Schemas/Primary/Substrate/Queries/GetWalletsQuery.php +++ b/src/GraphQL/Schemas/Primary/Substrate/Queries/GetWalletsQuery.php @@ -66,6 +66,11 @@ public function args(): array 'type' => GraphQL::type('[String!]'), 'description' => __('enjin-platform::query.get_wallet.args.account'), ], + 'managed' => [ + 'type' => GraphQL::type('Boolean'), + 'description' => __('enjin-platform::query.get_wallet.args.managed'), + 'defaultValue' => false, + ], ]); } @@ -79,6 +84,7 @@ public function resolve($root, array $args, $context, ResolveInfo $resolveInfo, ->when($externalIds = Arr::get($args, 'externalIds'), fn (Builder $query) => $query->whereIn('external_id', $externalIds)) ->when($verificationIds = Arr::get($args, 'verificationIds'), fn (Builder $query) => $query->whereIn('verification_id', $verificationIds)) ->when($accounts = Arr::get($args, 'accounts'), fn (Builder $query) => $query->whereIn('public_key', collect($accounts)->map(fn ($val) => SS58Address::getPublicKey($val))->toArray())) + ->when($managed = Arr::get($args, 'managed'), fn (Builder $query) => $query->where('managed', $managed)) ->cursorPaginateWithTotalDesc('id', $args['first']); $fields = Arr::get($resolveInfo->lookAhead()->queryPlan(), 'edges.fields.node.fields', []); @@ -90,7 +96,7 @@ public function resolve($root, array $args, $context, ResolveInfo $resolveInfo, } /** - * Get the validatio rules. + * Get the validate rules. */ protected function rules(array $args = []): array { @@ -115,8 +121,7 @@ protected function rules(array $args = []): array 'min:1', 'max:100', ], - 'verificationIds.*' => ['bail', 'filled', new ValidVerificationId()], - 'verificationIds.*' => ['bail', 'filled', 'max:1000'], + 'verificationIds.*' => ['bail', 'filled', 'max:1000', new ValidVerificationId()], 'accounts' => [ Rule::prohibitedIf(!empty($args['verificationIds']) || !empty($args['externalIds']) || !empty($args['ids'])), 'array', @@ -124,6 +129,7 @@ protected function rules(array $args = []): array 'max:100', ], 'accounts.*' => ['bail', 'filled', 'max:255', new ValidSubstrateAccount()], + 'managed' => ['boolean'], ]; } }