Marciano
09/15/2019, 8:04 PMError: Cannot return null for non-nullable field Log.id.
. Googled already to find an answer but I can't seem to find a solution. Does somebody have an idea what it could be? This is my code:
Query resolver:
const Query = {
async logs(parent, args, ctx, info) {
const logs = await ctx.db.query.logs();
return logs;
}
};
module.exports = Query;
schema.graphql
input LogInput {
name: String!
date: DateTime!
}
type Mutation {
createLog(data: LogInput): Log!
}
type Query {
logs: Log
}
datamodel:
type Log {
id: ID! @id
name: String!
date: DateTime!
}
Marciano
09/16/2019, 10:50 AMconst Query = {
async logs(parent, args, ctx, info) {
// console.log(" await ctx.db.query.logs()", ctx.db.query.logs());
const logs = await ctx.db.query.logs();
console.log("LOGS", logs[0]);
// console.log(ctx.db);
return logs[0];
}
};
Also used the playground on the prisma database side and that seems to be working fine aswell.