Skip to main content

talawa-api / Exports / utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithSortedByAndWhere

Module: utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithSortedByAndWhere

Table of contents

Type Aliases

Functions

Type Aliases

ParseGraphQLConnectionArgumentsWithSortedByAndWhereResult

Ƭ ParseGraphQLConnectionArgumentsWithSortedByAndWhereResult<T0, T1, T2>: Promise<{ errors: DefaultGraphQLArgumentError[] ; isSuccessful: false } | { isSuccessful: true ; parsedArgs: ParsedGraphQLConnectionArgumentsWithSortedByAndWhere<T0, T1, T2> }>

This is typescript type of the object returned from parseGraphQLConnectionArgumentsWithSortedByAndWhere function.

Type parameters

Name
T0
T1
T2

Defined in

src/utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithSortedByAndWhere.ts:25


ParsedGraphQLConnectionArgumentsWithSortedByAndWhere

Ƭ ParsedGraphQLConnectionArgumentsWithSortedByAndWhere<T0, T1, T2>: { filter: T1 ; sort: T2 } & ParsedGraphQLConnectionArguments<T0>

This is typescript type of the object containing validated and transformed connection arguments passed to parseGraphQLConnectionArgumentsWithSortedByAndWhere function.

Type parameters

Name
T0
T1
T2

Defined in

src/utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithSortedByAndWhere.ts:17

Functions

parseGraphQLConnectionArgumentsWithSortedByAndWhere

parseGraphQLConnectionArgumentsWithSortedByAndWhere<T0, T1, T2>(«destructured»): ParseGraphQLConnectionArgumentsWithSortedByAndWhereResult<T0, T1, T2>

This function is used for validating and transforming arguments for a custom graphQL connection that also provides filtering and sorting capabilities.

Type parameters

Name
T0
T1
T2

Parameters

NameTypeDefault value
«destructured»Objectundefined
› argsDefaultGraphQLConnectionArgumentsundefined
› maximumLimit?numberMAXIMUM_FETCH_LIMIT
› parseCursorParseGraphQLConnectionCursor<T0>undefined
› parseSortedByResultParseGraphQLConnectionSortedByResult<T2>undefined
› parseWhereResultParseGraphQLConnectionWhereResult<T1>undefined

Returns

ParseGraphQLConnectionArgumentsWithSortedByAndWhereResult<T0, T1, T2>

Example

const result = await parseGraphQLConnectionArgumentsWithSortedBy(\{
args: \{
after,
first,
\},
maximumLimit: 20,
parseCursor,
parseSortedBy,
parseWhere,
\})
if (result.isSuccessful === false) \{
throw new GraphQLError("Invalid arguments provided.", \{
extensions: \{
code: "INVALID_ARGUMENTS",
errors: result.errors
\}
\})
\}
const \{ parsedArgs: \{ cursor, direction, filter, limit, sort \} \} = result;

Defined in

src/utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithSortedByAndWhere.ts:68