I created a schema for a user who can choose eithe...
# orm-help
p
I created a schema for a user who can choose either a to be community manger or member
👀 1
Now i want the user to be able to create a community
But I get this error
How do I go about this?
l
Step one would be to upgrade to typescript as this will make life just easier 😸 Step two is that
connect
is for a Community with an existing CommunityAdmin doing something like:
Copy code
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!