Skip to content

Commit

Permalink
feat: Implement all supoorted queries and mutations
Browse files Browse the repository at this point in the history
  • Loading branch information
cschroeter committed Sep 14, 2018
1 parent 806f079 commit ff828b9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions sample/22-graphql-prisma/src/posts/posts.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Info,
} from '@nestjs/graphql';
import { PrismaService } from '../prisma/prisma.service';
import { BatchPayload } from '../prisma/prisma.binding';
import { Post } from '../graphql.schema';

@Resolver()
Expand All @@ -28,6 +29,26 @@ export class PostsResolver {
return await this.prisma.mutation.createPost(args, info);
}

@Mutation('updatePost')
async updatePost(@Args() args, @Info() info): Promise<Post> {
return await this.prisma.mutation.updatePost(args, info);
}

@Mutation('updateManyPosts')
async updateManyPosts(@Args() args, @Info() info): Promise<BatchPayload> {
return await this.prisma.mutation.updateManyPosts(args, info);
}

@Mutation('deletePost')
async deletePost(@Args() args, @Info() info): Promise<Post> {
return await this.prisma.mutation.deletePost(args, info);
}

@Mutation('deleteManyPosts')
async deleteManyPosts(@Args() args, @Info() info): Promise<BatchPayload> {
return await this.prisma.mutation.deleteManyPosts(args, info);
}

@Subscription('post')
onUserMutation() {
return {
Expand Down

0 comments on commit ff828b9

Please sign in to comment.