Skip to content

Commit

Permalink
Merge pull request #20342 from strapi/fix/transfer-documentId
Browse files Browse the repository at this point in the history
Fix transfer document id in DTS
  • Loading branch information
Bassel17 committed May 22, 2024
2 parents cb78770 + 5952f60 commit d687b16
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/core/data-transfer/src/engine/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { extname } from 'path';
import { EOL } from 'os';
import type Chain from 'stream-chain';
import { chain } from 'stream-chain';
import { isEmpty, uniq, last, isNumber, difference, set, omit } from 'lodash/fp';
import { isEmpty, uniq, last, isNumber, set, pick } from 'lodash/fp';
import { diff as semverDiff } from 'semver';

import type { Struct, Utils } from '@strapi/types';
Expand Down Expand Up @@ -840,9 +840,8 @@ class TransferEngine<

const { type, data } = entity;
const attributes = schemas[type].attributes;

const attributesToRemove = difference(Object.keys(data), Object.keys(attributes));
const updatedEntity = set('data', omit(attributesToRemove, data), entity);
const attributesToKeep = Object.keys(attributes).concat('documentId');
const updatedEntity = set('data', pick(attributesToKeep, data), entity);

callback(null, updatedEntity);
},
Expand Down

0 comments on commit d687b16

Please sign in to comment.