How can I insert into nanization and make sure that each time a member is created as the Admin of this anization?
I can't seem to make the correct mutation insert.
Below is the main Organization Table which has a many-to-many relationship to OrganizationMember table.
type Organization @table {
id: UUID! @default(expr: "uuidV4()")
slug: String! @col(dataType: "varchar(255)") @unique @index
name: String! @col(dataType: "varchar(200)")
logo: String
createdAt: Date! @default(expr: "request.time")
updatedAt: Date! @default(expr: "request.time")
owner: User!
members: OrganizationMember!
}
type OrganizationMember @table {
userId: String! @index
user: User!
anizationId: UUID! @index
anization: Organization!
role: String! @col(dataType: "varchar(50)")
}
I want to be able to create a mutation in which in one call creates the anization and adds the owner of that anization as one of the OrganizationMember's with role "ADMIN".