Paul Obayuwana
07/27/2022, 1:24 PMPaul Obayuwana
07/27/2022, 1:25 PMPaul Obayuwana
07/27/2022, 1:25 PMPaul Obayuwana
07/27/2022, 1:26 PMLloyd Richards
07/27/2022, 4:40 PMconnect is for a Community with an existing CommunityAdmin doing something like:
data: {
commName,
commType,
commAbout,
managers:{
connect: [{id: idOfCommunityAdmin}]
}
}
But if the CommunityAdmin doesnt exist then you can also do something like connectOrCreate and read more in the docs on these:
https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries#connect-an-existing-record
Step three would be to rethink the relationship between CommunityAdmin, CommunityMemeber and User and these are really all just Users. You can make the relation in a field on the user or in a many to many table like MembersOfCommunity and AdminsOfCommunity since there could be people who are admins/members of multiple communities.
best of luck!