mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-19 21:03:09 +12:00
chore: fix CI failures (#118)
* chore: regenerate formatter and cheatsheets for paginate_with * chore: fix credo errors Use pattern matching to remove an if level and invert the logic on the if Credo was complaining about
This commit is contained in:
parent
51004afa8d
commit
1c47c79081
3 changed files with 29 additions and 27 deletions
|
@ -36,6 +36,7 @@ spark_locals_without_parens = [
|
|||
metadata_names: 1,
|
||||
metadata_types: 1,
|
||||
modify_resolution: 1,
|
||||
paginate_with: 1,
|
||||
primary_key_delimiter: 1,
|
||||
read_action: 1,
|
||||
read_one: 2,
|
||||
|
|
|
@ -214,6 +214,7 @@ list :list_posts_paginated, :read, relay?: true
|
|||
| Name | Type | Default | Docs |
|
||||
|------|------|---------|------|
|
||||
| [`relay?`](#graphql-queries-list-relay?){: #graphql-queries-list-relay? } | `boolean` | `false` | If true, the graphql queries/resolvers for this resource will be built to honor the relay specification. See [the relay guide](/documentation/topics/relay.html) for more. |
|
||||
| [`paginate_with`](#graphql-queries-list-paginate_with){: #graphql-queries-list-paginate_with } | `:keyset \| :offset \| nil` | `:keyset` | Determine the pagination strategy to use, if multiple are available. If `nil`, no pagination is applied, otherwise the given strategy is used. |
|
||||
| [`type_name`](#graphql-queries-list-type_name){: #graphql-queries-list-type_name } | `atom` | | Override the type name returned by this query. Must be set if the read action has `metadata` that is not hidden via the `show_metadata` key. |
|
||||
| [`metadata_names`](#graphql-queries-list-metadata_names){: #graphql-queries-list-metadata_names } | `keyword` | `[]` | Name overrides for metadata fields on the read action. |
|
||||
| [`metadata_types`](#graphql-queries-list-metadata_types){: #graphql-queries-list-metadata_types } | `keyword` | `[]` | Type overrides for metadata fields on the read action. |
|
||||
|
|
|
@ -1277,36 +1277,36 @@ defmodule AshGraphql.Resource do
|
|||
nil
|
||||
end
|
||||
|
||||
defp pagination_strategy(_query, %{pagination: pagination}) when pagination in [nil, false] do
|
||||
nil
|
||||
end
|
||||
|
||||
defp pagination_strategy(%{paginate_with: strategy}, action) do
|
||||
if !action.pagination do
|
||||
nil
|
||||
else
|
||||
strategies =
|
||||
if !action.pagination.required? do
|
||||
[nil]
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
||||
strategies =
|
||||
if action.pagination.keyset? do
|
||||
[:keyset | strategies]
|
||||
else
|
||||
strategies
|
||||
end
|
||||
|
||||
strategies =
|
||||
if action.pagination.offset? do
|
||||
[:offset | strategies]
|
||||
else
|
||||
strategies
|
||||
end
|
||||
|
||||
if strategy in strategies do
|
||||
strategy
|
||||
strategies =
|
||||
if action.pagination.required? do
|
||||
[]
|
||||
else
|
||||
Enum.at(strategies, 0)
|
||||
[nil]
|
||||
end
|
||||
|
||||
strategies =
|
||||
if action.pagination.keyset? do
|
||||
[:keyset | strategies]
|
||||
else
|
||||
strategies
|
||||
end
|
||||
|
||||
strategies =
|
||||
if action.pagination.offset? do
|
||||
[:offset | strategies]
|
||||
else
|
||||
strategies
|
||||
end
|
||||
|
||||
if strategy in strategies do
|
||||
strategy
|
||||
else
|
||||
Enum.at(strategies, 0)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue