How to use the graphql-sequelize.relay.createConnectionResolver function in graphql-sequelize

To help you get started, we’ve selected a few graphql-sequelize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github birkir / prime / packages / prime-core / src / routes / internal / index.ts View on Github external
updatedAt: { value: 'updatedAt' },
            createdAt: { value: 'createdAt' },
          },
        }),
      },
      order: {
        type: new GraphQLEnumType({
          name: 'SortOrder',
          values: {
            ASC: { value: 'ASC' },
            DESC: { value: 'DESC' },
          },
        }),
      },
    },
    resolve: relay.createConnectionResolver({
      target: ContentEntry,
      before: async (findOptions, args, context) => {
        const language = args.language || 'en';
        const published = null;
        const contentReleaseId = args.contentReleaseId || null;
        const settings = await Settings.get();
        const masterLocale = settings.masterLocale.id;

        findOptions.attributes = {
          include: [
            [
              sequelize.literal(
                `(
                  SELECT "versionId" "vId" from "ContentEntry" "b"
                  WHERE "b"."entryId" = "ContentEntry"."entryId"
                  AND "b"."isPublished" = true AND "b"."language" = ${sequelize.escape(language)}