@damn-dev/cli 0.15.0 → 0.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@ model User {
13
13
  email String @unique
14
14
  emailVerified Boolean @default(false)
15
15
  image String?
16
+ phone String?
16
17
  defaultWorkspaceId String?
17
18
  createdAt DateTime @default(now())
18
19
  updatedAt DateTime @updatedAt
@@ -162,6 +163,7 @@ model Channel {
162
163
  messages Message[]
163
164
  readReceipts ReadReceipt[]
164
165
  participants ChannelParticipant[]
166
+ attachments Attachment[]
165
167
 
166
168
  @@index([watchingAgentId])
167
169
  @@index([parentChannelId])
@@ -250,11 +252,15 @@ model Attachment {
250
252
  id String @id @default(cuid())
251
253
  messageId String?
252
254
  message Message? @relation(fields: [messageId], references: [id], onDelete: Cascade)
255
+ channelId String?
256
+ channel Channel? @relation(fields: [channelId], references: [id], onDelete: Cascade)
253
257
  filename String
254
258
  mimeType String
255
259
  path String
256
260
  size Int
257
261
  createdAt DateTime @default(now())
262
+
263
+ @@index([channelId])
258
264
  }
259
265
 
260
266
  model Skill {
@@ -510,6 +516,37 @@ model TelegramPairing {
510
516
  @@index([workspaceId])
511
517
  }
512
518
 
519
+ model WhatsAppPairing {
520
+ id String @id @default(cuid())
521
+ workspaceId String
522
+ userId String
523
+ waUserId String
524
+ waPushName String?
525
+ channelId String
526
+ externalChannelId String
527
+ pairedAt DateTime @default(now())
528
+
529
+ // Contact identity layer (read-only card; NOT a CRM — chut.co owns CRM depth).
530
+ // phoneNumber is best-effort: present when WhatsApp surfaces the PN alongside a
531
+ // LID address (msg.key.remoteJidAlt/participantAlt), null for strict-privacy.
532
+ // knownUserId links the contact to a workspace member (auto via User.phone match,
533
+ // or manual); null ⇒ prospect. isProspect is derived in the router, not stored.
534
+ phoneNumber String?
535
+ firstSeenAt DateTime @default(now())
536
+ lastSeenAt DateTime @default(now())
537
+ messageCount Int @default(0)
538
+ knownUserId String?
539
+
540
+ // One pairing per WhatsApp identity (waUserId) is the real invariant. We do NOT
541
+ // constrain (externalChannelId, userId) unique: in "open" inbox mode every
542
+ // external WhatsApp sender is pinned to the workspace owner's userId but lives in
543
+ // its own per-sender thread, so a single damn.dev user legitimately holds many
544
+ // WhatsApp pairings on the same channel. The old userId-unique blocked the 2nd
545
+ // sender with a P2002 (the "my other number got no reply" bug).
546
+ @@unique([externalChannelId, waUserId])
547
+ @@index([workspaceId])
548
+ }
549
+
513
550
  model AgentTask {
514
551
  id String @id @default(cuid())
515
552
  parentTaskId String?
@@ -734,3 +771,18 @@ model RemoteAgent {
734
771
  @@unique([nodeId, remoteAgentId])
735
772
  @@index([nodeId])
736
773
  }
774
+
775
+ model SupportAccessGrant {
776
+ id String @id @default(cuid())
777
+ workspaceId String
778
+ grantedByUserId String
779
+ ttlMinutes Int
780
+ reason String?
781
+ status String @default("active") // active | expired | revoked
782
+ createdAt DateTime @default(now())
783
+ expiresAt DateTime
784
+ revokedAt DateTime?
785
+ revokedByUserId String?
786
+
787
+ @@index([workspaceId, createdAt])
788
+ }