rawriclark
02/13/2019, 9:23 AMrawriclark
02/13/2019, 9:23 AMrawriclark
02/13/2019, 9:23 AMssl: true
Onotoko
02/13/2019, 9:42 AMOnotoko
02/13/2019, 9:42 AMJonty Coertzen
02/13/2019, 3:20 PMchas13
02/13/2019, 5:03 PMchas13
02/13/2019, 5:11 PMJonty Coertzen
02/13/2019, 5:53 PMLuca
02/13/2019, 5:58 PMMatthew Frey
02/13/2019, 8:18 PMMike Bowen
02/13/2019, 8:25 PMjs
type Club {
id: ID! @unique
createdAt: DateTime!
name: String!
description: String!
members: [User!]!
}
type User {
id: ID! @unique
firstName: String!
lastName: String!
email: String! @unique
clubs: [Club!]!
password: String!
}
where there's a relationship between Users and Clubs (Clubs can have many members
(Users) and Users can belong to many clubs
) I'd like to make a mutation that adds an existing User
to an existing Club
. This is what I have, and it's not working:
js
async function addUserToClub(parent, args, context, info) {
console.log('connecting user with id: ' + args.id);
console.log('to: ' + args.clubid);
const user = context.prisma.updateUser({
data: {
clubs: {
connect: [
{
id: args.clubid
}
]
}
},
where: {
id: args.id
}
})
return user;
}
John Bendfeldt
02/13/2019, 8:31 PMimpowski
02/13/2019, 8:41 PMAustin
02/13/2019, 11:18 PMahebwa49
02/14/2019, 9:39 AMahebwa49
02/14/2019, 10:08 AMMartĂ CrespĂ
02/14/2019, 11:08 AMahebwa49
02/14/2019, 11:09 AMMartĂ CrespĂ
02/14/2019, 1:34 PMprisma introspect
but not generating datamodel.prisma, generating the SDL schema.michael.glitzos
02/14/2019, 1:39 PMmichael.glitzos
02/14/2019, 1:39 PMGaurav
02/14/2019, 3:44 PMgraphql-shield
, offloading my stupid queries here, please help, if you could:
1. How do I ensure that an authorized user is deleting say, wishlisht of its own? (Right now, I am using $exists from prisma client in resolvers to check if the user has that item (with isAuthenticated and isUser shield rules middleware) then only allow deletion). Should this constraint be somehow placed in the shield rule?
2. What are fragments in shield? Are they the one to use when I have to constraint some fields of a type to be public, and some to be authorized (but these could be achieved with field level rule defs, couldnt they?)
Thanks :)joan
02/14/2019, 4:14 PMhtml
data in prisma?Brian
02/14/2019, 4:23 PMScottAgirs
02/14/2019, 5:00 PMScottAgirs
02/14/2019, 5:01 PMvjsingh
02/14/2019, 5:28 PMjack
02/14/2019, 6:00 PMjack
02/14/2019, 6:00 PM