diff --git a/src/resolvers/Link.js b/src/resolvers/Link.js index 6ca06c1..8ecd924 100644 --- a/src/resolvers/Link.js +++ b/src/resolvers/Link.js @@ -1,9 +1,9 @@ function postedBy(parent, args, context) { - return context.prisma.link.findOne({ where: { id: parent.id } }).postedBy() + return context.prisma.link.findUnique({ where: { id: parent.id } }).postedBy() } function votes(parent, args, context) { - return context.prisma.link.findOne({ where: { id: parent.id } }).votes() + return context.prisma.link.findUnique({ where: { id: parent.id } }).votes() } module.exports = { diff --git a/src/resolvers/Mutation.js b/src/resolvers/Mutation.js index b9c0694..34c6678 100644 --- a/src/resolvers/Mutation.js +++ b/src/resolvers/Mutation.js @@ -30,7 +30,7 @@ async function signup(parent, args, context, info) { } async function login(parent, args, context, info) { - const user = await context.prisma.user.findOne({ where: { email: args.email } }) + const user = await context.prisma.user.findUnique({ where: { email: args.email } }) if (!user) { throw new Error('No such user found') } @@ -50,7 +50,7 @@ async function login(parent, args, context, info) { async function vote(parent, args, context, info) { const userId = getUserId(context) - const vote = await context.prisma.vote.findOne({ + const vote = await context.prisma.vote.findUnique({ where: { linkId_userId: { linkId: Number(args.linkId), diff --git a/src/resolvers/User.js b/src/resolvers/User.js index 7d51d3a..25b9285 100644 --- a/src/resolvers/User.js +++ b/src/resolvers/User.js @@ -1,5 +1,5 @@ function links(parent, args, context) { - return context.prisma.user.findOne({ where: { id: parent.id } }).links() + return context.prisma.user.findUnique({ where: { id: parent.id } }).links() } module.exports = { diff --git a/src/resolvers/Vote.js b/src/resolvers/Vote.js index d0494f5..de5ef5b 100644 --- a/src/resolvers/Vote.js +++ b/src/resolvers/Vote.js @@ -1,9 +1,9 @@ function link(parent, args, context) { - return context.prisma.vote.findOne({ where: { id: parent.id } }).link() + return context.prisma.vote.findUnique({ where: { id: parent.id } }).link() } function user(parent, args, context) { - return context.prisma.vote.findOne({ where: { id: parent.id } }).user() + return context.prisma.vote.findUnique({ where: { id: parent.id } }).user() } module.exports = {