Skip to content

Commit

Permalink
Handle relations separately for remotes (twentyhq#5538)
Browse files Browse the repository at this point in the history
Remote object id columns are not removed anymore when a remote object is
unsynced.
This is because we do not use relations anymore. We only created the id
field. So the current behavior that was implemented for custom objects,
to retrieve the fields to deleted, does not work.

Since remote object relations are really different, I extracted the
logic from `objectMetadataService`. It now handles only the relations
for custom objects creation and deletion (this part should be extracted
as well).

I create a new remote table relation service that will:
- fetch objects metadata linked to remotes (favorites,
activityTargets...)
- look for columns based on remote object name
- delete the fields and columns
  • Loading branch information
thomtrp authored May 23, 2024
1 parent 8019ba8 commit 0d6fe7b
Show file tree
Hide file tree
Showing 10 changed files with 762 additions and 624 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { FeatureFlagModule } from 'src/engine/core-modules/feature-flag/feature-
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
import { WorkspaceCacheVersionModule } from 'src/engine/metadata-modules/workspace-cache-version/workspace-cache-version.module';
import { BeforeUpdateOneObject } from 'src/engine/metadata-modules/object-metadata/hooks/before-update-one-object.hook';
import { RemoteTableRelationsModule } from 'src/engine/metadata-modules/remote-server/remote-table/remote-table-relations/remote-table-relations.module';

import { ObjectMetadataService } from './object-metadata.service';
import { ObjectMetadataEntity } from './object-metadata.entity';
Expand All @@ -43,6 +44,7 @@ import { ObjectMetadataDTO } from './dtos/object-metadata.dto';
WorkspaceMigrationRunnerModule,
WorkspaceCacheVersionModule,
FeatureFlagModule,
RemoteTableRelationsModule,
],
services: [ObjectMetadataService],
resolvers: [
Expand Down
Loading

0 comments on commit 0d6fe7b

Please sign in to comment.