Skip to content

Instantly share code, notes, and snippets.

@wickedev
Created July 8, 2021 16:03
Show Gist options
  • Save wickedev/42fa0aa3cadfabc21afcc77b0075431e to your computer and use it in GitHub Desktop.
Save wickedev/42fa0aa3cadfabc21afcc77b0075431e to your computer and use it in GitHub Desktop.
typegraphql-prisma sample
type Query {
post(where: PostWhereUniqueInput!): Post
findFirstPost(
where: PostWhereInput
orderBy: [PostOrderByInput!]
cursor: PostWhereUniqueInput
take: Int
skip: Int
distinct: [PostScalarFieldEnum!]
): Post
posts(
where: PostWhereInput
orderBy: [PostOrderByInput!]
cursor: PostWhereUniqueInput
take: Int
skip: Int
distinct: [PostScalarFieldEnum!]
): [Post!]!
aggregatePost(
where: PostWhereInput
orderBy: [PostOrderByInput!]
cursor: PostWhereUniqueInput
take: Int
skip: Int
): AggregatePost!
user(where: UserWhereUniqueInput!): User
findFirstUser(
where: UserWhereInput
orderBy: [UserOrderByInput!]
cursor: UserWhereUniqueInput
take: Int
skip: Int
distinct: [UserScalarFieldEnum!]
): User
users(
where: UserWhereInput
orderBy: [UserOrderByInput!]
cursor: UserWhereUniqueInput
take: Int
skip: Int
distinct: [UserScalarFieldEnum!]
): [User!]!
aggregateUser(
where: UserWhereInput
orderBy: [UserOrderByInput!]
cursor: UserWhereUniqueInput
take: Int
skip: Int
): AggregateUser!
}
type Post {
authorId: Int
content: String
id: Int!
published: Boolean!
title: String!
author: User
}
type User {
email: String!
id: Int!
name: String
posts(
where: PostWhereInput
orderBy: [PostOrderByInput!]
cursor: PostWhereUniqueInput
take: Int
skip: Int
distinct: [PostScalarFieldEnum!]
): [Post!]!
}
input PostWhereInput {
AND: [PostWhereInput!]
OR: [PostWhereInput!]
NOT: [PostWhereInput!]
authorId: IntNullableFilter
content: StringNullableFilter
id: IntFilter
published: BoolFilter
title: StringFilter
author: UserRelationFilter
}
input IntNullableFilter {
equals: Int
in: [Int!]
notIn: [Int!]
lt: Int
lte: Int
gt: Int
gte: Int
not: NestedIntNullableFilter
}
input NestedIntNullableFilter {
equals: Int
in: [Int!]
notIn: [Int!]
lt: Int
lte: Int
gt: Int
gte: Int
not: NestedIntNullableFilter
}
input StringNullableFilter {
equals: String
in: [String!]
notIn: [String!]
lt: String
lte: String
gt: String
gte: String
contains: String
startsWith: String
endsWith: String
not: NestedStringNullableFilter
}
input NestedStringNullableFilter {
equals: String
in: [String!]
notIn: [String!]
lt: String
lte: String
gt: String
gte: String
contains: String
startsWith: String
endsWith: String
not: NestedStringNullableFilter
}
input IntFilter {
equals: Int
in: [Int!]
notIn: [Int!]
lt: Int
lte: Int
gt: Int
gte: Int
not: NestedIntFilter
}
input NestedIntFilter {
equals: Int
in: [Int!]
notIn: [Int!]
lt: Int
lte: Int
gt: Int
gte: Int
not: NestedIntFilter
}
input BoolFilter {
equals: Boolean
not: NestedBoolFilter
}
input NestedBoolFilter {
equals: Boolean
not: NestedBoolFilter
}
input StringFilter {
equals: String
in: [String!]
notIn: [String!]
lt: String
lte: String
gt: String
gte: String
contains: String
startsWith: String
endsWith: String
not: NestedStringFilter
}
input NestedStringFilter {
equals: String
in: [String!]
notIn: [String!]
lt: String
lte: String
gt: String
gte: String
contains: String
startsWith: String
endsWith: String
not: NestedStringFilter
}
input UserRelationFilter {
is: UserWhereInput
isNot: UserWhereInput
}
input UserWhereInput {
AND: [UserWhereInput!]
OR: [UserWhereInput!]
NOT: [UserWhereInput!]
email: StringFilter
id: IntFilter
name: StringNullableFilter
posts: PostListRelationFilter
}
input PostListRelationFilter {
every: PostWhereInput
some: PostWhereInput
none: PostWhereInput
}
input PostOrderByInput {
authorId: SortOrder
content: SortOrder
id: SortOrder
published: SortOrder
title: SortOrder
author: UserOrderByInput
}
enum SortOrder {
asc
desc
}
input UserOrderByInput {
email: SortOrder
id: SortOrder
name: SortOrder
}
input PostWhereUniqueInput {
id: Int
}
enum PostScalarFieldEnum {
authorId
content
id
published
title
}
type AggregatePost {
count: PostCountAggregate
avg: PostAvgAggregate
sum: PostSumAggregate
min: PostMinAggregate
max: PostMaxAggregate
}
type PostCountAggregate {
authorId: Int
content: Int
id: Int!
published: Int
title: Int
_all: Int!
}
type PostAvgAggregate {
authorId: Float
id: Float!
}
type PostSumAggregate {
authorId: Int
id: Int!
}
type PostMinAggregate {
authorId: Int
content: String
id: Int!
published: Boolean
title: String
}
type PostMaxAggregate {
authorId: Int
content: String
id: Int!
published: Boolean
title: String
}
input UserWhereUniqueInput {
email: String
id: Int
}
enum UserScalarFieldEnum {
email
id
name
}
type AggregateUser {
count: UserCountAggregate
avg: UserAvgAggregate
sum: UserSumAggregate
min: UserMinAggregate
max: UserMaxAggregate
}
type UserCountAggregate {
email: Int
id: Int!
name: Int
_all: Int!
}
type UserAvgAggregate {
id: Float!
}
type UserSumAggregate {
id: Int!
}
type UserMinAggregate {
email: String
id: Int!
name: String
}
type UserMaxAggregate {
email: String
id: Int!
name: String
}
type Mutation {
createPost(data: PostCreateInput!): Post!
deletePost(where: PostWhereUniqueInput!): Post
updatePost(data: PostUpdateInput!, where: PostWhereUniqueInput!): Post
deleteManyPost(where: PostWhereInput): AffectedRowsOutput!
updateManyPost(
data: PostUpdateManyMutationInput!
where: PostWhereInput
): AffectedRowsOutput!
upsertPost(
where: PostWhereUniqueInput!
create: PostCreateInput!
update: PostUpdateInput!
): Post!
createUser(data: UserCreateInput!): User!
deleteUser(where: UserWhereUniqueInput!): User
updateUser(data: UserUpdateInput!, where: UserWhereUniqueInput!): User
deleteManyUser(where: UserWhereInput): AffectedRowsOutput!
updateManyUser(
data: UserUpdateManyMutationInput!
where: UserWhereInput
): AffectedRowsOutput!
upsertUser(
where: UserWhereUniqueInput!
create: UserCreateInput!
update: UserUpdateInput!
): User!
}
input PostCreateInput {
content: String
published: Boolean
title: String!
author: UserCreateNestedOneWithoutPostsInput
}
input UserCreateNestedOneWithoutPostsInput {
create: UserCreateWithoutPostsInput
connectOrCreate: UserCreateOrConnectWithoutPostsInput
connect: UserWhereUniqueInput
}
input UserCreateWithoutPostsInput {
email: String!
name: String
}
input UserCreateOrConnectWithoutPostsInput {
where: UserWhereUniqueInput!
create: UserCreateWithoutPostsInput!
}
input PostUpdateInput {
content: NullableStringFieldUpdateOperationsInput
published: BoolFieldUpdateOperationsInput
title: StringFieldUpdateOperationsInput
author: UserUpdateOneWithoutPostsInput
}
input NullableStringFieldUpdateOperationsInput {
set: String
}
input BoolFieldUpdateOperationsInput {
set: Boolean
}
input StringFieldUpdateOperationsInput {
set: String
}
input UserUpdateOneWithoutPostsInput {
create: UserCreateWithoutPostsInput
connectOrCreate: UserCreateOrConnectWithoutPostsInput
upsert: UserUpsertWithoutPostsInput
connect: UserWhereUniqueInput
disconnect: Boolean
delete: Boolean
update: UserUpdateWithoutPostsInput
}
input UserUpsertWithoutPostsInput {
update: UserUpdateWithoutPostsInput!
create: UserCreateWithoutPostsInput!
}
input UserUpdateWithoutPostsInput {
email: StringFieldUpdateOperationsInput
name: NullableStringFieldUpdateOperationsInput
}
type AffectedRowsOutput {
count: Int!
}
input PostUpdateManyMutationInput {
content: NullableStringFieldUpdateOperationsInput
published: BoolFieldUpdateOperationsInput
title: StringFieldUpdateOperationsInput
}
input UserCreateInput {
email: String!
name: String
posts: PostCreateNestedManyWithoutAuthorInput
}
input PostCreateNestedManyWithoutAuthorInput {
create: [PostCreateWithoutAuthorInput!]
connectOrCreate: [PostCreateOrConnectWithoutAuthorInput!]
connect: [PostWhereUniqueInput!]
}
input PostCreateWithoutAuthorInput {
content: String
published: Boolean
title: String!
}
input PostCreateOrConnectWithoutAuthorInput {
where: PostWhereUniqueInput!
create: PostCreateWithoutAuthorInput!
}
input UserUpdateInput {
email: StringFieldUpdateOperationsInput
name: NullableStringFieldUpdateOperationsInput
posts: PostUpdateManyWithoutAuthorInput
}
input PostUpdateManyWithoutAuthorInput {
create: [PostCreateWithoutAuthorInput!]
connectOrCreate: [PostCreateOrConnectWithoutAuthorInput!]
upsert: [PostUpsertWithWhereUniqueWithoutAuthorInput!]
connect: [PostWhereUniqueInput!]
set: [PostWhereUniqueInput!]
disconnect: [PostWhereUniqueInput!]
delete: [PostWhereUniqueInput!]
update: [PostUpdateWithWhereUniqueWithoutAuthorInput!]
updateMany: [PostUpdateManyWithWhereWithoutAuthorInput!]
deleteMany: [PostScalarWhereInput!]
}
input PostUpsertWithWhereUniqueWithoutAuthorInput {
where: PostWhereUniqueInput!
update: PostUpdateWithoutAuthorInput!
create: PostCreateWithoutAuthorInput!
}
input PostUpdateWithoutAuthorInput {
content: NullableStringFieldUpdateOperationsInput
published: BoolFieldUpdateOperationsInput
title: StringFieldUpdateOperationsInput
}
input PostUpdateWithWhereUniqueWithoutAuthorInput {
where: PostWhereUniqueInput!
data: PostUpdateWithoutAuthorInput!
}
input PostUpdateManyWithWhereWithoutAuthorInput {
where: PostScalarWhereInput!
data: PostUpdateManyMutationInput!
}
input PostScalarWhereInput {
AND: [PostScalarWhereInput!]
OR: [PostScalarWhereInput!]
NOT: [PostScalarWhereInput!]
authorId: IntNullableFilter
content: StringNullableFilter
id: IntFilter
published: BoolFilter
title: StringFilter
}
input UserUpdateManyMutationInput {
email: StringFieldUpdateOperationsInput
name: NullableStringFieldUpdateOperationsInput
}
model User {
email String @unique
id Int @default(autoincrement()) @id
name String?
posts Post[]
}
model Post {
authorId Int?
content String?
id Int @default(autoincrement()) @id
published Boolean @default(false)
title String
author User? @relation(fields: [authorId], references: [id])
}
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}
generator client {
provider = "prisma-client-js"
}
generator typegraphql {
provider = "typegraphql-prisma"
output = "../src/generated/typegraphql-prisma"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment