simple-graphql
Version:
The simple way to generates GraphQL schemas and Sequelize models from your models definition.
31 lines (30 loc) • 876 B
TypeScript
import { SGModel, SGModelCtrl } from '../../index';
import { GraphQLResolveInfo } from 'graphql';
import { BindOrReplacements, Includeable, OrderItem, WhereOptions } from 'sequelize';
export default function <M extends SGModel>(this: SGModelCtrl<M>, args: {
pagination?: {
after?: string;
first?: number;
before?: string;
last?: number;
};
selectionInfo?: GraphQLResolveInfo;
include?: Includeable | Includeable[];
attributes?: Array<string>;
where?: WhereOptions;
bind?: BindOrReplacements;
order?: OrderItem[];
subQuery?: boolean;
}): Promise<{
pageInfo: {
startCursor: string | number;
endCursor: string | number;
hasPreviousPage: boolean;
hasNextPage: boolean;
};
edges: Array<{
node: M;
cursor: string | number;
}>;
count: number;
}>;