How to use the nexus-prisma.prismaObjectType function in nexus-prisma

To help you get started, we’ve selected a few nexus-prisma 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 prisma-labs / nexus-prisma / examples / src / resolvers / Query.ts View on Github external
import { stringArg } from 'nexus'
import { prismaObjectType } from 'nexus-prisma'

export const Query = prismaObjectType({
  name: 'Query',
  definition(t) {
    /**
     * - use `t.prismaFields(['*'])` to expose all the underlying object type fields
     * - use `t.primaFields(['fieldName', ...])` to pick and/or customize specific fields
     * - use `t.prismaFields({ filter: ['fieldName', ...] })` to filter and/or customize specific fields
     */

    // An empty array removes all fields from the underlying object type
    t.prismaFields([])

    t.list.field('feed', {
      type: 'Post',
      resolve: (parent, args, ctx) => {
        return ctx.prisma.posts({
          where: { published: true },
github nice-boys / product-boilerplate / web / graphql / schema / index.ts View on Github external
import { prisma } from "../../database/generated/client";
import datamodelInfo from "../../database/generated/nexus-prisma";
import { prismaObjectType, makePrismaSchema } from "nexus-prisma";
const path = require("path");

// @ts-ignore
const User = prismaObjectType({
  name: "User",
  definition(t) {
    t.prismaFields(["name", "id", "avatarUrl"]);
  }
});

const Query = prismaObjectType({
  name: "Query",
  definition(t) {
    t.prismaFields([
      {
        name: "user",
        args: ["where"]
      }
    ]);
    t.field("viewer", {
github fluidstackdev / fluidstack / packages / server / src / resolvers / Image.ts View on Github external
import { prismaObjectType } from 'nexus-prisma'

export const Image = prismaObjectType('Image')
github fluidstackdev / fluidstack / packages / server / src / resolvers / Option.ts View on Github external
import { prismaObjectType } from 'nexus-prisma'

export const Option = prismaObjectType('Option')
github diego3g / graphql-nexus-example / src / resolvers / channels.ts View on Github external
import { queryType } from 'nexus';
import { prismaObjectType } from 'nexus-prisma';

import { Context } from '../types';

export const Channel = prismaObjectType({
  name: 'Channel',
  definition(t) {
    t.prismaFields(['*']);
  },
});

export const Query = queryType({
  definition(t) {
    t.list.field('testChannels', {
      type: 'Channel',
      resolve: (parent, args, ctx) => ctx.prisma.channels(),
    });
  },
});
github prisma / prisma-examples / typescript / graphql-crud / src / index.ts View on Github external
import { GraphQLServer } from 'graphql-yoga'
import { makePrismaSchema, prismaObjectType } from 'nexus-prisma'
import * as path from 'path'
import datamodelInfo from './generated/nexus-prisma'
import { prisma } from './generated/prisma-client'

const User = prismaObjectType({
  name: 'User',
  definition(t) {
    t.prismaFields(['*'])
  },
})

const Post = prismaObjectType({
  name: 'Post',
  definition(t) {
    t.prismaFields(['*'])
  },
})

const Query = prismaObjectType({
  name: 'Query',
  definition(t) {
    t.prismaFields(['*'])
  },
})

const Mutation = prismaObjectType({
  name: 'Mutation',
  definition(t) {

nexus-prisma

<p align="center"> <img src="https://i.imgur.com/8qvElTM.png" width="300" align="center" /> <h1 align="center"><a style="color:black;" href="https://graphql-nexus.github.io/nexus-prisma">nexus-prisma</a></h1> </p>

MIT
Latest version published 7 months ago

Package Health Score

70 / 100
Full package analysis