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:
@ -39,8 +39,11 @@ export class WorkspaceFieldComparator {
|
|||||||
string,
|
string,
|
||||||
Partial<PartialFieldMetadata>
|
Partial<PartialFieldMetadata>
|
||||||
> = {};
|
> = {};
|
||||||
|
// Double security to only compare non-custom fields
|
||||||
|
const filteredOriginalFieldCollection =
|
||||||
|
originalObjectMetadata.fields.filter((field) => !field.isCustom);
|
||||||
const originalFieldMetadataMap = transformMetadataForComparison(
|
const originalFieldMetadataMap = transformMetadataForComparison(
|
||||||
originalObjectMetadata.fields,
|
filteredOriginalFieldCollection,
|
||||||
{
|
{
|
||||||
propertiesToIgnore: fieldPropertiesToIgnore,
|
propertiesToIgnore: fieldPropertiesToIgnore,
|
||||||
propertiesToStringify: fieldPropertiesToStringify,
|
propertiesToStringify: fieldPropertiesToStringify,
|
||||||
|
|||||||
@ -43,7 +43,11 @@ export class WorkspaceSyncObjectMetadataService {
|
|||||||
// Retrieve object metadata collection from DB
|
// Retrieve object metadata collection from DB
|
||||||
const originalObjectMetadataCollection =
|
const originalObjectMetadataCollection =
|
||||||
await objectMetadataRepository.find({
|
await objectMetadataRepository.find({
|
||||||
where: { workspaceId: context.workspaceId, isCustom: false },
|
where: {
|
||||||
|
workspaceId: context.workspaceId,
|
||||||
|
isCustom: false,
|
||||||
|
fields: { isCustom: false },
|
||||||
|
},
|
||||||
relations: ['dataSource', 'fields'],
|
relations: ['dataSource', 'fields'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,11 @@ export class WorkspaceSyncRelationMetadataService {
|
|||||||
// Retrieve object metadata collection from DB
|
// Retrieve object metadata collection from DB
|
||||||
const originalObjectMetadataCollection =
|
const originalObjectMetadataCollection =
|
||||||
await objectMetadataRepository.find({
|
await objectMetadataRepository.find({
|
||||||
where: { workspaceId: context.workspaceId, isCustom: false },
|
where: {
|
||||||
|
workspaceId: context.workspaceId,
|
||||||
|
isCustom: false,
|
||||||
|
fields: { isCustom: false },
|
||||||
|
},
|
||||||
relations: ['dataSource', 'fields'],
|
relations: ['dataSource', 'fields'],
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -58,10 +62,12 @@ export class WorkspaceSyncRelationMetadataService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Retrieve relation metadata collection from DB
|
// Retrieve relation metadata collection from DB
|
||||||
// TODO: filter out custom relations once isCustom has been added to relationMetadata table
|
|
||||||
const originalRelationMetadataCollection =
|
const originalRelationMetadataCollection =
|
||||||
await relationMetadataRepository.find({
|
await relationMetadataRepository.find({
|
||||||
where: { workspaceId: context.workspaceId },
|
where: {
|
||||||
|
workspaceId: context.workspaceId,
|
||||||
|
fromFieldMetadata: { isCustom: false },
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create standard relation metadata collection
|
// Create standard relation metadata collection
|
||||||
|
|||||||
Reference in New Issue
Block a user