Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

1.7 KB
Raw Blame
enum FolderType {
  default
  mega
}

enum FolderAccessLevel {
  read // can view the links
  write // can view and move links
}

enum FolderUserRole {
  owner // full control
  editor // can move links to the folder
  viewer // can view the links
}

model Folder {
  id          String             @id
  name        String
  description String?            @db.Text
  projectId   String
  type        FolderType         @default(default)
  accessLevel FolderAccessLevel? // Access level of the folder within the workspace
  createdAt   DateTime           @default(now())
  updatedAt   DateTime           @updatedAt

  project        Project               @relation(fields: [projectId], references: [id])
  links          Link[]
  users          FolderUser[]
  accessRequests FolderAccessRequest[]
  webhooks       FolderWebhook[]
  dashboard      Dashboard?

  @@unique([name, projectId])
  @@index(projectId)
}

model FolderUser {
  id        String          @id @default(cuid())
  folderId  String
  userId    String
  role      FolderUserRole?
  createdAt DateTime        @default(now())
  updatedAt DateTime        @updatedAt

  folder Folder @relation(fields: [folderId], references: [id], onDelete: Cascade)
  user   User   @relation(fields: [userId], references: [id], onDelete: Cascade)

  @@unique([folderId, userId])
  @@index(userId)
}

model FolderAccessRequest {
  id        String   @id @default(cuid())
  folderId  String
  userId    String
  createdAt DateTime @default(now())

  folder Folder @relation(fields: [folderId], references: [id], onDelete: Cascade)
  user   User   @relation(fields: [userId], references: [id], onDelete: Cascade)

  @@unique([folderId, userId])
  @@index(userId)
}