feat(notes): let organizations edit the note category bar

The filter chips were fixed labels. Owners can rename, hide, reorder, and add categories.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-01 16:34:34 +03:30
co-authored by Cursor
parent 8e1e94a439
commit 81edf61065
10 changed files with 645 additions and 390 deletions
+21
View File
@@ -170,6 +170,7 @@ model Organization {
deals Deal[]
activities Activity[]
notes Note[]
noteCategories NoteCategory[]
noteRevisions NoteRevision[]
customFields CustomFieldDefinition[]
products Product[]
@@ -973,6 +974,26 @@ model Note {
@@index([authorId])
}
/// دسته‌های نوار فیلتر یادداشت؛ برای هر سازمان قابل تغییر است
model NoteCategory {
id String @id @default(cuid())
organizationId String
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
key String
label String
tone String @default("general")
position Int @default(0)
isActive Boolean @default(true)
/// در نوار «همه / معمولی / پیگیری / …» دیده شود
showInBar Boolean @default(true)
isSystem Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([organizationId, key])
@@index([organizationId, position])
}
/// اسنپ‌شات متن قبل از هر ویرایش معنادار یادداشت
model NoteRevision {
id String @id @default(cuid())