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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user