Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/resolvers/Link.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions src/resolvers/Mutation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand All @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/User.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions src/resolvers/Vote.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down