How to add item to array in prisma database at frontend?
Hello, lets say I have user and this user have coins. How can I then inside a React component add coins to this array? And then displaying them on different page? For example:
model User { id String @id @default(cuid()) name String? email String? @unique emailVerified DateTime? image String? accounts Account[] sessions Session[] coins Coin[]}
model User { id String @id @default(cuid()) name String? email String? @unique emailVerified DateTime? image String? accounts Account[] sessions Session[] coins Coin[]}
model Coin { id String @id @default(cuid()) name String rank Int? User User? @relation(fields: [userId], references: [id]) userId String?}
model Coin { id String @id @default(cuid()) name String rank Int? User User? @relation(fields: [userId], references: [id]) userId String?}
And then let's say in frontend I want a button that adds item to this Coin array.