Jidé
02/01/2019, 11:08 AMimpowski
02/01/2019, 1:47 PMdan
02/01/2019, 3:02 PMEmil Forsmann
02/01/2019, 4:26 PMJack Toumey
02/01/2019, 9:04 PMMichael Freeman
02/01/2019, 11:17 PMMichael Freeman
02/02/2019, 12:07 AMMichael Freeman
02/02/2019, 12:58 AMMichael Freeman
02/02/2019, 3:27 AMMichael Freeman
02/02/2019, 3:27 AMDaniel
02/02/2019, 3:12 PMMitchell
02/02/2019, 7:54 PMfeed()
function in Query.js solves the error. Seems the problems is in this change:
async function feed(parent, args, ctx, info) {
const { filter, first, skip } = args // destructure input arguments
const where = filter
? { OR: [{ url_contains: filter }, { description_contains: filter }] }
: {}
const queriedLinks = await ctx.db.query.links({ first, skip, where })
return {
linkIds: queriedLinks.map(link => link.id),
count
}
}
https://www.howtographql.com/react-apollo/7-filtering-searching-the-list-of-links/
This looks suspect to me. The original code queries Links as: await context.prisma.links(...)
. While the new change queries links with: await ctx.db.query.links(...)
Mitchell
02/02/2019, 8:01 PMawait ctx.db.query.links(...)
to await ctx.prisma.links(...)
fixes the problem above but now has an error where count
is undefined, it doesn't seem to be referenced anywhere in this code block?Mitchell
02/02/2019, 8:03 PMcount: queriedLinks.length,
but still see a GraphQL error: > Error: GraphQL error: Cannot return null for non-nullable field Feed.links.Mitchell
02/02/2019, 8:34 PMqueriedLinks
the array contains object with id
, createdAt
, description
, url
. The schema shows postedBy
and votes
where votes
is [Vote!]!
making it required. Could this be the problem?Mitchell
02/02/2019, 8:47 PMError: Cannot return null for non-nullable field Link.id.
. Seems there is something in the change to the feed function made at step 7 of the tutorial that loses Link.id. The results look the same for both. Maybe the problem is at the Query in LinkList.js...Mitchell
02/02/2019, 8:49 PMreturn {
linkIds: queriedLinks.map(link => link.id),
links: queriedLinks,
count: queriedLinks.length,
}
links were not returned as a field.Daniel Clough
02/02/2019, 9:51 PMmatt
02/03/2019, 12:09 AMmichael.glitzos
02/03/2019, 5:37 AMmichael.glitzos
02/03/2019, 5:37 AMRoy Derks
02/03/2019, 12:43 PMZowpi
02/03/2019, 2:55 PMZowpi
02/03/2019, 3:00 PMalex h
02/03/2019, 4:57 PMTypeError: Cannot read property 'startsWith' of undefined
at GenereateCommand.<anonymous> (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/src/commands/generate/generate.ts:99:39)
when following the learngraphql tutorial and running the generate prisma
command for the first time.alex h
02/03/2019, 4:57 PMalex h
02/03/2019, 4:58 PMtype Link {
id: ID! @unique
createdAt: DateTime!
description: String!
url: String!
}
alex h
02/03/2019, 4:58 PMendpoint: <https://us1.prisma.sh/***/hackernews-node/dev>
datamodel: datamodel.prisma
generate:
- generator: javascript-client
- output: ../src/generated/prisma-client
E
02/04/2019, 5:02 AMCihad Turhan
02/04/2019, 8:31 AMgraphql
type ReadHistory {
id: ID! @unique
user: User!
article: Article!
}
I need unique user id and article id pairs on that. What I currently have is
context.prisma.readHistories({
where: {
user: { id: args.userId },
article: { authors_some: { isPOC: true } }
},
orderBy: 'createdAt_DESC'
})