feat(notes): let organizations define their own note fields
The note form was fixed. Owners can add fields and each note keeps those values. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,6 +20,7 @@ import { PrismaService } from '../prisma/prisma.service';
|
||||
import { buildSearchWhere, ci } from '../common/search';
|
||||
import { LocalFileStorage } from '../storage/local-file.storage';
|
||||
import { GamificationService } from '../gamification/gamification.service';
|
||||
import { asCustomFields, toJsonCustomFields } from '../common/custom-fields';
|
||||
import {
|
||||
type Actor,
|
||||
noteAccessWhere,
|
||||
@@ -45,6 +46,7 @@ type NoteRow = {
|
||||
checklist: Prisma.JsonValue | null;
|
||||
locationText: string | null;
|
||||
analyzeEnabled: boolean;
|
||||
customFields: Prisma.JsonValue;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
person: { id: string; firstName: string; lastName: string } | null;
|
||||
@@ -224,6 +226,7 @@ export class NotesService {
|
||||
: Prisma.JsonNull,
|
||||
locationText: emptyToNull(dto.locationText ?? null),
|
||||
analyzeEnabled,
|
||||
customFields: toJsonCustomFields(dto.customFields),
|
||||
personId: emptyToNull(dto.personId ?? null),
|
||||
companyId: emptyToNull(dto.companyId ?? null),
|
||||
dealId: emptyToNull(dto.dealId ?? null),
|
||||
@@ -280,6 +283,9 @@ export class NotesService {
|
||||
if (dto.analyzeEnabled !== undefined) {
|
||||
data.analyzeEnabled = dto.analyzeEnabled;
|
||||
}
|
||||
if ('customFields' in dto) {
|
||||
data.customFields = toJsonCustomFields(dto.customFields);
|
||||
}
|
||||
if ('personId' in dto) data.personId = emptyToNull(dto.personId ?? null);
|
||||
if ('companyId' in dto) data.companyId = emptyToNull(dto.companyId ?? null);
|
||||
if ('dealId' in dto) data.dealId = emptyToNull(dto.dealId ?? null);
|
||||
@@ -616,6 +622,7 @@ export class NotesService {
|
||||
checklist: parseChecklist(row.checklist),
|
||||
locationText: row.locationText ?? null,
|
||||
analyzeEnabled: row.analyzeEnabled ?? true,
|
||||
customFields: asCustomFields(row.customFields),
|
||||
person: row.person
|
||||
? {
|
||||
id: row.person.id,
|
||||
|
||||
Reference in New Issue
Block a user