feat(shot-status): flag shots with new comments until marked read

A per-user ShotCommentRead marker records how far each person has read a
shot's comments. Comments and replies from others after the marker put an
orange "!" beside the shot code; its popover lists them and only "Mark
read" clears it. A chip filters the board to flagged shots and marks all
read. The migration marks existing comments as read so the board starts
clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
twotalesanimation
2026-10-17 09:06:25 +02:00
parent 0aedc4b1fa
commit 7a7088f2ad
7 changed files with 489 additions and 7 deletions
+20
View File
@@ -263,6 +263,7 @@ model User {
createdTakes Take[] @relation("TakeCreator")
uploadedTakeAttachments TakeAttachment[] @relation("TakeAttachmentUploader")
assignedBoardItems BoardItem[] @relation("BoardItemAssignee")
shotCommentReads ShotCommentRead[]
@@map("users")
}
@@ -498,6 +499,7 @@ model Shot {
exports Export[]
deliveryRequestLines DeliveryRequestLine[]
boardItems BoardItem[]
commentReads ShotCommentRead[]
@@unique([projectId, shotCode])
@@map("shots")
@@ -675,6 +677,24 @@ model Approval {
@@map("approvals")
}
/// How far each user has read a shot's comments. A comment or reply on any of
/// the shot's versions, written by someone else after `readAt`, is new to that
/// user and flags the shot on the shot-status board until they mark it read.
/// No row = nothing read since the account was created.
model ShotCommentRead {
id String @id @default(cuid())
userId String
shotId String
readAt DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
shot Shot @relation(fields: [shotId], references: [id], onDelete: Cascade)
@@unique([userId, shotId])
@@index([shotId])
@@map("shot_comment_reads")
}
model Notification {
id String @id @default(cuid())
userId String