Coder Social home page Coder Social logo

dopaminedriven / next-prisma Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 5.97 MB

MongoDB with Prisma, Nexus, Nextjs, TypeScript, and Apollo. Hosted on Vercel.

Home Page: https://www.andrewross.app

License: MIT License

JavaScript 0.57% TypeScript 97.93% CSS 1.49% Shell 0.01%
mongodb prisma nextjs typescript nexus codegen apollo graphql authentication vercel

next-prisma's Introduction

next-prisma

Augmentation

import NextAuth, { Session } from "next-auth";
import { PrismaAdapter } from "@next-auth/prisma-adapter/dist";
import { RecursivePartial } from "../mapped";

enum Role {
  SUPERADMIN = "SUPERADMIN",
  MAINTAINER = "MAINTAINER",
  ADMIN = "ADMIN",
  USER = "USER"
}

declare module "next-auth" {
  interface Session {
    user: {
      email: string; // String
      emailVerified?: Date | null; // DateTime
      id?: string | null; // ID
      image?: string | null; // String
      name?: string | null; // String
      role?: keyof typeof Role;
    };
  }
  interface Profile {
    iss?: string;
    at_hash?: string;
    picture: string;
    id: string;
    sub?: string;
    emailVerified?: Date;
    bio?: string | null; // String
    coverImage?: string | null; // String
    dob?: Date | null; // DateTime
    memberSince?: Date | null; // DateTime
    phoneNumber?: string | null; // PhoneNumber
    userId?: string | null; // String}
  }
}

declare module "next-auth/jwt" {
  interface JWT {
    idToken?: string;
    id?: string | null; // ID
    role?: keyof typeof Role;
  }
}

To integrate

query listUsers {
  usersQuery(first: 10) {
    pageInfo {
      ...PageInfoPartial
    }
    edges {
      ...UserEdgePartial
      node {
        ...UserPartial
        _count {
          ...UserCountPartial
        }
        imageMeta {
          ...MediaItemPartial
        }
        accounts(first: 10) {
          pageInfo {
            ...PageInfoPartial
          }
          __typename
          edges {
            ...AccountEdgePartial
            node {
              ...AccountPartial
            }
          }
        }
        sessions(first: 10) {
          pageInfo {
            ...PageInfoPartial
          }
          edges {
            ...SessionEdgePartial
            node {
              ...SessionPartial
            }
          }
        }
        profile {
          bio {
            ...BioPartial
          }
          coverPhoto {
            ...MediaItemPartial
          }
          ...ProfilePartial
        }
        entries(first: 10) {
          pageInfo {
            ...PageInfoPartial
          }
          edges {
            ...EntryEdgePartial
            node {
              _count {
                ...EntryCountPartial
              }
              ...EntryPartial
              featuredImage {
                ...MediaItemPartial
              }
              attachments {
                ...MediaItemPartial
              }
            }
          }
        }
      }
    }
  }
}

Nexus in detail

next-prisma's People

Contributors

dopaminedriven avatar

Stargazers

Tyler Davis Mitchell avatar Jan Killian avatar Beno avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.