mirror of
https://github.com/twentyhq/twenty.git
synced 2024-09-11 23:37:21 +03:00
fix: sync metadata shouldn't remove non custom fields (#3750)
* fix: sync metadata shouldn't remove non custom fields * fix: filter out custom relations
This commit is contained in:
parent
bd5d930be2
commit
8abd5be4b5
@ -39,8 +39,11 @@ export class WorkspaceFieldComparator {
|
||||
string,
|
||||
Partial<PartialFieldMetadata>
|
||||
> = {};
|
||||
// Double security to only compare non-custom fields
|
||||
const filteredOriginalFieldCollection =
|
||||
originalObjectMetadata.fields.filter((field) => !field.isCustom);
|
||||
const originalFieldMetadataMap = transformMetadataForComparison(
|
||||
originalObjectMetadata.fields,
|
||||
filteredOriginalFieldCollection,
|
||||
{
|
||||
propertiesToIgnore: fieldPropertiesToIgnore,
|
||||
propertiesToStringify: fieldPropertiesToStringify,
|
||||
|
@ -43,7 +43,11 @@ export class WorkspaceSyncObjectMetadataService {
|
||||
// Retrieve object metadata collection from DB
|
||||
const originalObjectMetadataCollection =
|
||||
await objectMetadataRepository.find({
|
||||
where: { workspaceId: context.workspaceId, isCustom: false },
|
||||
where: {
|
||||
workspaceId: context.workspaceId,
|
||||
isCustom: false,
|
||||
fields: { isCustom: false },
|
||||
},
|
||||
relations: ['dataSource', 'fields'],
|
||||
});
|
||||
|
||||
|
@ -44,7 +44,11 @@ export class WorkspaceSyncRelationMetadataService {
|
||||
// Retrieve object metadata collection from DB
|
||||
const originalObjectMetadataCollection =
|
||||
await objectMetadataRepository.find({
|
||||
where: { workspaceId: context.workspaceId, isCustom: false },
|
||||
where: {
|
||||
workspaceId: context.workspaceId,
|
||||
isCustom: false,
|
||||
fields: { isCustom: false },
|
||||
},
|
||||
relations: ['dataSource', 'fields'],
|
||||
});
|
||||
|
||||
@ -58,10 +62,12 @@ export class WorkspaceSyncRelationMetadataService {
|
||||
);
|
||||
|
||||
// Retrieve relation metadata collection from DB
|
||||
// TODO: filter out custom relations once isCustom has been added to relationMetadata table
|
||||
const originalRelationMetadataCollection =
|
||||
await relationMetadataRepository.find({
|
||||
where: { workspaceId: context.workspaceId },
|
||||
where: {
|
||||
workspaceId: context.workspaceId,
|
||||
fromFieldMetadata: { isCustom: false },
|
||||
},
|
||||
});
|
||||
|
||||
// Create standard relation metadata collection
|
||||
|
Loading…
Reference in New Issue
Block a user