Added tag support + Post link and many more changes and optimizations.

This commit is contained in:
Daniel
2023-02-24 21:02:28 +03:30
parent e0f4c71eb2
commit 9b53608097
36 changed files with 1062 additions and 176 deletions
+15 -6
View File
@@ -1,6 +1,3 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
@@ -16,7 +13,7 @@ model User {
email String @unique
password String
collections Collection[]
collectionsJoined UserAndCollection[]
collectionsJoined UsersAndCollections[]
createdAt DateTime @default(now())
}
@@ -25,12 +22,13 @@ model Collection {
name String
owner User @relation(fields: [ownerId], references: [id])
ownerId Int
members UserAndCollection[]
members UsersAndCollections[]
links Link[]
tags Tag[]
createdAt DateTime @default(now())
}
model UserAndCollection {
model UsersAndCollections {
user User @relation(fields: [userId], references: [id])
userId Int
@@ -51,4 +49,15 @@ model Link {
url String
collection Collection @relation(fields: [collectionId], references: [id])
collectionId Int
tags Tag[]
}
model Tag {
id Int @id @default(autoincrement())
name String
links Link[]
collections Collection @relation(fields: [collectionId], references: [id])
collectionId Int
@@unique([name, collectionId])
}