Skip to content

Commit 6d10ad0

Browse files
committed
contentfull affix issue fixed
1 parent edebe42 commit 6d10ad0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

upload-api/migration-contentful/libs/createInitialMapper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const idArray = require('../utils/restrictedKeyWords');
3535
* // Outputs: 'prefix_my_special_id'
3636
*/
3737
const uidCorrector = (uid, prefix) => {
38+
console.log('uidCorrector', uid, prefix);
3839
let newId = uid;
3940
if (idArray.includes(uid)) {
4041
newId = uid.replace(uid, `${prefix}_${uid}`);
@@ -62,7 +63,8 @@ const uidCorrector = (uid, prefix) => {
6263
*
6364
* // Outputs: an array of content type objects, each containing metadata and field mappings.
6465
*/
65-
const createInitialMapper = async () => {
66+
const createInitialMapper = async (affix="") => {
67+
console.log('Creating initial mapper for content types...',config,affix);
6668
try {
6769
const initialMapper = [];
6870
const files = await fs.readdir(
@@ -82,7 +84,7 @@ const createInitialMapper = async () => {
8284
otherCmsTitle: title,
8385
otherCmsUid: data[0]?.contentfulID,
8486
contentstackTitle: title.charAt(0).toUpperCase() + title.slice(1),
85-
contentstackUid: uidCorrector(data[0]?.contentUid),
87+
contentstackUid: uidCorrector(data[0]?.contentUid,affix),
8688
type: 'content_type',
8789
fieldMapping: []
8890
};

upload-api/src/services/contentful/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const createContentfulMapper = async (
1919
const fetchedLocales: [] = await extractLocale(cleanLocalPath);
2020

2121
await extractContentTypes(cleanLocalPath, affix);
22-
const initialMapper = await createInitialMapper();
22+
const initialMapper = await createInitialMapper(affix);
2323
const req = {
2424
method: 'post',
2525
maxBodyLength: Infinity,

0 commit comments

Comments
 (0)