Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio committed Mar 14, 2024
1 parent 75c1940 commit 40b5b66
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
]);
}

Expand All @@ -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', []);
Expand All @@ -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
{
Expand All @@ -115,15 +121,15 @@ 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',
'min:1',
'max:100',
],
'accounts.*' => ['bail', 'filled', 'max:255', new ValidSubstrateAccount()],
'managed' => ['boolean'],
];
}
}

0 comments on commit 40b5b66

Please sign in to comment.