From 35ffe90561d320205295c47c59c7c4e4b3de0789 Mon Sep 17 00:00:00 2001 From: AishDani Date: Wed, 17 Jul 2024 18:51:24 +0530 Subject: [PATCH] refactor:changed uid of title and url to lowercase --- api/src/services/contentMapper.service.ts | 4 ++-- uplaode-api/migration-sitecore/libs/contenttypes.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/services/contentMapper.service.ts b/api/src/services/contentMapper.service.ts index 47c8a92e..298e3774 100644 --- a/api/src/services/contentMapper.service.ts +++ b/api/src/services/contentMapper.service.ts @@ -48,7 +48,7 @@ const putTestData = async (req: Request) => { contentTypes.map((type: any, index: any) => { const fieldIds: string[] = []; const fields = type?.fieldMapping?.map?.((field: any) => { - const id = field?.id.replace(/[{}-]/g, '').toLowerCase() || uuidv4(); + const id = field?.id?.replace(/[{}]/g, '')?.toLowerCase() || uuidv4(); fieldIds.push(id); return { id, projectId, isDeleted: true, ...field }; }); @@ -68,7 +68,7 @@ const putTestData = async (req: Request) => { and the generated id values are pushed into the contentIds array. */ const contentType = contentTypes.map((item: any) => { - const id = item?.id.replace(/[{}-]/g, '').toLowerCase() || uuidv4(); + const id = item?.id?.replace(/[{}]/g, '')?.toLowerCase() || uuidv4(); contentIds.push(id); return { ...item, id, projectId }; }); diff --git a/uplaode-api/migration-sitecore/libs/contenttypes.js b/uplaode-api/migration-sitecore/libs/contenttypes.js index 570384ec..dbfd138b 100644 --- a/uplaode-api/migration-sitecore/libs/contenttypes.js +++ b/uplaode-api/migration-sitecore/libs/contenttypes.js @@ -464,7 +464,7 @@ const contentTypeMapper = ({ components, standardValues, content_type, basePath, if (isUrlfound === undefined) { mainSchema?.unshift( { - uid: "Url", + uid: "url", "otherCmsField": "url", "otherCmsType": "text", "contentstackField": "Url", @@ -478,7 +478,7 @@ const contentTypeMapper = ({ components, standardValues, content_type, basePath, ) if (isPresent === undefined) { mainSchema.unshift({ - uid: "Title", + uid: "title", "otherCmsField": "title", "otherCmsType": "text", "contentstackField": "Title",