Add Smart Notes AI analysis and Mento Memory with user approval.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-01 14:29:34 +03:30
co-authored by Cursor
parent 4d9f3c04cd
commit d152d1c19f
20 changed files with 1577 additions and 9 deletions
+52
View File
@@ -103,6 +103,18 @@ enum AutomationAction {
add_loyalty_points
}
enum NoteAiSuggestionStatus {
pending
applied
dismissed
failed
}
enum MemorySourceType {
note
manual
}
model Organization {
id String @id @default(cuid())
name String
@@ -134,6 +146,8 @@ model Organization {
projectCards ProjectCard[]
loyaltyTiers LoyaltyTier[]
automationRules AutomationRule[]
memoryItems MemoryItem[]
noteAiSuggestions NoteAiSuggestion[]
}
model User {
@@ -158,6 +172,7 @@ model User {
assignedTickets Ticket[] @relation("TicketAssignee")
reportedTickets Ticket[] @relation("TicketReporter")
ticketMessages TicketMessage[] @relation("TicketMessageAuthor")
confirmedMemories MemoryItem[] @relation("MemoryConfirmedBy")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -223,6 +238,7 @@ model Person {
owner User? @relation("PersonOwner", fields: [ownerId], references: [id], onDelete: SetNull)
tickets Ticket[]
projectCards ProjectCard[]
memoryItems MemoryItem[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -359,6 +375,7 @@ model Note {
authorId String?
author User? @relation("NoteAuthor", fields: [authorId], references: [id], onDelete: SetNull)
attachments NoteAttachment[]
aiSuggestion NoteAiSuggestion?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -390,6 +407,41 @@ model NoteAttachment {
@@index([uploadedById])
}
model NoteAiSuggestion {
id String @id @default(cuid())
organizationId String
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
noteId String @unique
note Note @relation(fields: [noteId], references: [id], onDelete: Cascade)
status NoteAiSuggestionStatus @default(pending)
payload Json?
errorMessage String?
analyzedAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([organizationId, status])
}
model MemoryItem {
id String @id @default(cuid())
organizationId String
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
personId String
person Person @relation(fields: [personId], references: [id], onDelete: Cascade)
content String
sourceType MemorySourceType @default(manual)
sourceId String?
confirmedById String?
confirmedBy User? @relation("MemoryConfirmedBy", fields: [confirmedById], references: [id], onDelete: SetNull)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([organizationId, personId, updatedAt])
@@index([personId])
@@index([confirmedById])
}
model CustomFieldDefinition {
id String @id @default(cuid())
organizationId String