feat: add updatedBy field to track last record modifier (#16807)

<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Implements last-modifier tracking and unified actor injection.
> 
> - New `ActorFromAuthContextService` replaces createdBy-only logic;
pre-query hooks now inject both `createdBy` and `updatedBy` on create
and `updatedBy` on update
> - Add `updatedBy` standard field to core/custom objects (e.g.,
`person`, `company`, `task`, `note`, `attachment`, `dashboard`,
`workflow`, `workflowRun`) with IDs, metadata builders, and ORM entity
fields
> - Record CRUD: `create` now sets both `createdBy` and `updatedBy`;
`update` sets `updatedBy`; workflow actions use a shared workflow actor
builder; REST base handler uses the new actor service
> - Seeder data and snapshots updated to include `updatedBy`; GraphQL
result formatting adds defaults/handling for empty composite fields
(incl. actor)
> - Frontend `useUpdateOneRecord` upserts returned record into the local
store after mutation
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
1f283778e9cb28a35bf84632a1a2997250bb3131. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
Abdul Rahman
2025-12-29 14:35:17 +05:30
committed by GitHub
parent 0da5cf29de
commit 01e0502fcf
58 changed files with 1516 additions and 118 deletions
@@ -54,6 +54,9 @@ export const STANDARD_OBJECTS = {
createdBy: {
universalIdentifier: ATTACHMENT_STANDARD_FIELD_IDS.createdBy,
},
updatedBy: {
universalIdentifier: ATTACHMENT_STANDARD_FIELD_IDS.updatedBy,
},
task: { universalIdentifier: ATTACHMENT_STANDARD_FIELD_IDS.task },
note: { universalIdentifier: ATTACHMENT_STANDARD_FIELD_IDS.note },
person: { universalIdentifier: ATTACHMENT_STANDARD_FIELD_IDS.person },
@@ -397,6 +400,7 @@ export const STANDARD_OBJECTS = {
},
position: { universalIdentifier: COMPANY_STANDARD_FIELD_IDS.position },
createdBy: { universalIdentifier: COMPANY_STANDARD_FIELD_IDS.createdBy },
updatedBy: { universalIdentifier: COMPANY_STANDARD_FIELD_IDS.updatedBy },
people: { universalIdentifier: COMPANY_STANDARD_FIELD_IDS.people },
accountOwner: {
universalIdentifier: COMPANY_STANDARD_FIELD_IDS.accountOwner,
@@ -549,6 +553,9 @@ export const STANDARD_OBJECTS = {
createdBy: {
universalIdentifier: DASHBOARD_STANDARD_FIELD_IDS.createdBy,
},
updatedBy: {
universalIdentifier: DASHBOARD_STANDARD_FIELD_IDS.updatedBy,
},
timelineActivities: {
universalIdentifier: DASHBOARD_STANDARD_FIELD_IDS.timelineActivities,
},
@@ -1029,6 +1036,7 @@ export const STANDARD_OBJECTS = {
title: { universalIdentifier: NOTE_STANDARD_FIELD_IDS.title },
bodyV2: { universalIdentifier: NOTE_STANDARD_FIELD_IDS.bodyV2 },
createdBy: { universalIdentifier: NOTE_STANDARD_FIELD_IDS.createdBy },
updatedBy: { universalIdentifier: NOTE_STANDARD_FIELD_IDS.updatedBy },
noteTargets: { universalIdentifier: NOTE_STANDARD_FIELD_IDS.noteTargets },
attachments: { universalIdentifier: NOTE_STANDARD_FIELD_IDS.attachments },
timelineActivities: {
@@ -1127,6 +1135,9 @@ export const STANDARD_OBJECTS = {
createdBy: {
universalIdentifier: OPPORTUNITY_STANDARD_FIELD_IDS.createdBy,
},
updatedBy: {
universalIdentifier: OPPORTUNITY_STANDARD_FIELD_IDS.updatedBy,
},
pointOfContact: {
universalIdentifier: OPPORTUNITY_STANDARD_FIELD_IDS.pointOfContact,
},
@@ -1255,6 +1266,7 @@ export const STANDARD_OBJECTS = {
avatarUrl: { universalIdentifier: PERSON_STANDARD_FIELD_IDS.avatarUrl },
position: { universalIdentifier: PERSON_STANDARD_FIELD_IDS.position },
createdBy: { universalIdentifier: PERSON_STANDARD_FIELD_IDS.createdBy },
updatedBy: { universalIdentifier: PERSON_STANDARD_FIELD_IDS.updatedBy },
company: { universalIdentifier: PERSON_STANDARD_FIELD_IDS.company },
pointOfContactForOpportunities: {
universalIdentifier:
@@ -1352,6 +1364,7 @@ export const STANDARD_OBJECTS = {
dueAt: { universalIdentifier: TASK_STANDARD_FIELD_IDS.dueAt },
status: { universalIdentifier: TASK_STANDARD_FIELD_IDS.status },
createdBy: { universalIdentifier: TASK_STANDARD_FIELD_IDS.createdBy },
updatedBy: { universalIdentifier: TASK_STANDARD_FIELD_IDS.updatedBy },
taskTargets: { universalIdentifier: TASK_STANDARD_FIELD_IDS.taskTargets },
attachments: { universalIdentifier: TASK_STANDARD_FIELD_IDS.attachments },
assignee: { universalIdentifier: TASK_STANDARD_FIELD_IDS.assignee },
@@ -1670,6 +1683,7 @@ export const STANDARD_OBJECTS = {
universalIdentifier: WORKFLOW_STANDARD_FIELD_IDS.attachments,
},
createdBy: { universalIdentifier: WORKFLOW_STANDARD_FIELD_IDS.createdBy },
updatedBy: { universalIdentifier: WORKFLOW_STANDARD_FIELD_IDS.updatedBy },
searchVector: {
universalIdentifier: WORKFLOW_STANDARD_FIELD_IDS.searchVector,
},
@@ -1772,6 +1786,9 @@ export const STANDARD_OBJECTS = {
createdBy: {
universalIdentifier: WORKFLOW_RUN_STANDARD_FIELD_IDS.createdBy,
},
updatedBy: {
universalIdentifier: WORKFLOW_RUN_STANDARD_FIELD_IDS.updatedBy,
},
output: { universalIdentifier: WORKFLOW_RUN_STANDARD_FIELD_IDS.output },
context: { universalIdentifier: WORKFLOW_RUN_STANDARD_FIELD_IDS.context },
state: { universalIdentifier: WORKFLOW_RUN_STANDARD_FIELD_IDS.state },