I am designing a chat system. I want to have this relational model but not sure how to configure the schema in datastore. A user can have many conversation and a conversation can have many users. I have setup a schema but it doesn't let me attach many users to a conversation. This is my current schema but as you can see, the UserConversation class doesn't let me add multiple users to it. The idea is that when I query a user, I want to be able to fetch all the conversations they are in but a conversation will need to have more than 1 person but according to schema I can only link 1 user to the relation. How do I achieve what I want.
This is my attempt of schema but it doesn't seem to work.
type User @model @auth(rules: [{allow: public}]) {
id: ID!
Conversations: [Conversation] @manyToMany(relationName: "UserConversation")
}
type Conversation @model @auth(rules: [{allow: public}]) {
id: ID!
users: [User] @manyToMany(relationName: "UserConversation")
}
class UserConversation extends Model {
static const classType = const _UserConversationModelType();
final String id;
final Conversation? _conversation;
final User? _user;
// Other class methods
}