feat: expose foreign key (#2505)

* fix: typo

* feat: expose foreign key

* fix: foreign key exposition

* fix: be able to filter by foreign key

* feat: add `isSystem` on field metadata

* feat: update all seeds

* fix: seed issues

* fix: sync metadata generated files

* fix: squash metadata migrations

* Fix conflicts

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Jérémy M
2023-11-16 12:30:40 +01:00
committed by GitHub
parent e5caa7a5df
commit e026b2b6e9
45 changed files with 786 additions and 327 deletions

View File

@ -100,18 +100,33 @@ export class RelationMetadataService extends TypeOrmQueryService<RelationMetadat
description: undefined,
icon: record.toIcon,
isCustom: true,
targetColumnMap: {
value: foreignKeyColumnName,
},
targetColumnMap: {},
isActive: true,
type: FieldMetadataType.RELATION,
objectMetadataId: record.toObjectMetadataId,
workspaceId: record.workspaceId,
},
// FOREIGN KEY
{
name: foreignKeyColumnName,
label: `${record.toLabel} Foreign Key`,
description: undefined,
icon: undefined,
isCustom: true,
targetColumnMap: {},
isActive: true,
// Should not be visible on the front side
isSystem: true,
type: FieldMetadataType.UUID,
objectMetadataId: record.toObjectMetadataId,
workspaceId: record.workspaceId,
},
]);
const createdFieldMap = createdFields.reduce((acc, curr) => {
acc[curr.objectMetadataId] = curr;
const createdFieldMap = createdFields.reduce((acc, fieldMetadata) => {
if (fieldMetadata.type === FieldMetadataType.RELATION) {
acc[fieldMetadata.objectMetadataId] = fieldMetadata;
}
return acc;
}, {});