marcaaron
09/17/2018, 9:43 PMHenry
09/17/2018, 9:44 PMreturn await context.client.discussion({ id: dId })
.messages({
orderBy: 'createdAt_DESC',
first: count,
after: cursor,
});
marcaaron
09/17/2018, 9:45 PMmarcaaron
09/17/2018, 9:45 PMmarcaaron
09/17/2018, 9:46 PMmarcaaron
09/17/2018, 9:46 PMgetUserLogs: async (_, {first, skip}, ctx) => {
const logs = await ctx.prisma.user({id: getUserId(ctx)}).logs({
first, skip
});
marcaaron
09/17/2018, 9:47 PMUser: {
logs(root, args, context){
return context.prisma.user({id:root.id}).logs({orderBy: "created_at_DESC"})
},
marcaaron
09/17/2018, 9:47 PMmarcaaron
09/17/2018, 9:53 PMmarcaaron
09/17/2018, 9:57 PMmarcaaron
09/17/2018, 10:00 PMtype User {
id: ID! @unique
username: String! @unique
email: String! @unique
password: String!
logs: [Log!]! @relation(name:"UserLogs", onDelete: CASCADE)
sets: [Set!]! @relation(name:"UserSets", onDelete: CASCADE)
}
type Log {
id: ID! @unique
created_at: DateTime!
sets: [Set!]! @relation(name: "SetsOnLog" onDelete: CASCADE)
user: User! @relation(name:"UserLogs", onDelete: SET_NULL)
}
marcaaron
09/17/2018, 10:00 PMmarcaaron
09/17/2018, 10:36 PMmarcaaron
09/17/2018, 11:00 PMmarcaaron
09/17/2018, 11:51 PMnilan
09/19/2018, 11:45 AM