Skip to content

Commit 29d8ace

Browse files
walmatclaude
andcommitted
Fix authoredAttachments schema error by restoring deprecated relation metadata
The author/authoredAttachments relation was removed from metadata computation but still exists in the DB metadata tables, causing the frontend to query a field that doesn't exist in the GraphQL schema during login. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 507a77d commit 29d8ace

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-attachment-standard-flat-field-metadata.util.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,4 +431,31 @@ export const buildAttachmentStandardFlatFieldMetadatas = ({
431431
twentyStandardApplicationId,
432432
now,
433433
}),
434+
// @deprecated – kept so DB metadata stays consistent until author is fully removed
435+
author: createStandardRelationFieldFlatMetadata({
436+
objectName,
437+
workspaceId,
438+
context: {
439+
type: FieldMetadataType.RELATION,
440+
morphId: null,
441+
fieldName: 'author',
442+
label: 'Author',
443+
description: 'Attachment author',
444+
icon: 'IconUserCircle',
445+
isSystem: true,
446+
isNullable: true,
447+
isUIReadOnly: true,
448+
targetObjectName: 'workspaceMember',
449+
targetFieldName: 'authoredAttachments',
450+
settings: {
451+
relationType: RelationType.MANY_TO_ONE,
452+
onDelete: RelationOnDeleteAction.SET_NULL,
453+
joinColumnName: 'authorId',
454+
},
455+
},
456+
standardObjectMetadataRelatedEntityIds,
457+
dependencyFlatEntityMaps,
458+
twentyStandardApplicationId,
459+
now,
460+
}),
434461
});

packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workspace-member-standard-flat-field-metadata.util.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,31 @@ export const buildWorkspaceMemberStandardFlatFieldMetadatas = ({
482482
twentyStandardApplicationId,
483483
now,
484484
}),
485+
// @deprecated – kept so DB metadata stays consistent until author is fully removed
486+
authoredAttachments: createStandardRelationFieldFlatMetadata({
487+
objectName,
488+
workspaceId,
489+
context: {
490+
type: FieldMetadataType.RELATION,
491+
morphId: null,
492+
fieldName: 'authoredAttachments',
493+
label: 'Authored attachments',
494+
description: 'Attachments created by the workspace member',
495+
icon: 'IconFileDescription',
496+
isSystem: true,
497+
isNullable: false,
498+
isUIReadOnly: true,
499+
targetObjectName: 'attachment',
500+
targetFieldName: 'author',
501+
settings: {
502+
relationType: RelationType.ONE_TO_MANY,
503+
},
504+
},
505+
standardObjectMetadataRelatedEntityIds,
506+
dependencyFlatEntityMaps,
507+
twentyStandardApplicationId,
508+
now,
509+
}),
485510
connectedAccounts: createStandardRelationFieldFlatMetadata({
486511
objectName,
487512
workspaceId,

packages/twenty-shared/src/metadata/standard-object.constant.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ export const STANDARD_OBJECTS = {
5353
targetWorkflow: {
5454
universalIdentifier: '20202020-f1e8-4c9d-8a7b-3f5e1d2c9a8b',
5555
},
56+
//deprecated
57+
author: {
58+
universalIdentifier: '20202020-d036-493c-b3b3-e53b7fc1f834',
59+
},
5660
},
5761
morphIds: {
5862
targetMorphId: { morphId: '20202020-f634-435d-ab8d-e1168b375c69' },
@@ -2322,6 +2326,10 @@ export const STANDARD_OBJECTS = {
23222326
accountOwnerForCompanies: {
23232327
universalIdentifier: '20202020-dc29-4bd4-a3c1-29eafa324bee',
23242328
},
2329+
//deprecated
2330+
authoredAttachments: {
2331+
universalIdentifier: '20202020-9e80-4eec-a3e2-3a0d42f3c3f5',
2332+
},
23252333
connectedAccounts: {
23262334
universalIdentifier: '20202020-e322-4bde-a525-727079b4a100',
23272335
},

0 commit comments

Comments
 (0)