Add deal co-assignees and saved filters on people/pipeline lists.

Deals keep a primary owner plus shared assignees with matching visibility; Contacts and Pipeline can save and reuse filter presets.
This commit is contained in:
2026-09-27 14:25:32 +03:30
parent 00f8b91d78
commit c06c92b333
19 changed files with 553 additions and 20 deletions
@@ -0,0 +1,16 @@
-- CreateTable
CREATE TABLE "_DealAssignees" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL,
CONSTRAINT "_DealAssignees_AB_pkey" PRIMARY KEY ("A","B")
);
-- CreateIndex
CREATE INDEX "_DealAssignees_B_index" ON "_DealAssignees"("B");
-- AddForeignKey
ALTER TABLE "_DealAssignees" ADD CONSTRAINT "_DealAssignees_A_fkey" FOREIGN KEY ("A") REFERENCES "Deal"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_DealAssignees" ADD CONSTRAINT "_DealAssignees_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+2
View File
@@ -224,6 +224,7 @@ model User {
organizationId String
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
ownedDeals Deal[] @relation("DealOwner")
assignedDeals Deal[] @relation("DealAssignees")
ownedQuotes Quote[] @relation("QuoteOwner")
ownedInvoices Invoice[] @relation("InvoiceOwner")
ownedPeople Person[] @relation("PersonOwner")
@@ -509,6 +510,7 @@ model Deal {
company Company? @relation(fields: [companyId], references: [id], onDelete: SetNull)
ownerId String?
owner User? @relation("DealOwner", fields: [ownerId], references: [id], onDelete: SetNull)
assignees User[] @relation("DealAssignees")
position Int @default(0)
activities Activity[]
smartNotes Note[]