From c0d29c0b369ab977c5b2e5d24ad6b29b782e94ac Mon Sep 17 00:00:00 2001 From: umeshmore45 Date: Tue, 18 Mar 2025 15:42:32 +0530 Subject: [PATCH] code refactor --- api/src/services/migration.service.ts | 14 +------------- upload-api/src/config/index.ts | 6 +++--- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/api/src/services/migration.service.ts b/api/src/services/migration.service.ts index 5caa240f0..94eaaa07d 100644 --- a/api/src/services/migration.service.ts +++ b/api/src/services/migration.service.ts @@ -417,17 +417,10 @@ const getLogs = async (req: Request): Promise => { */ export const createSourceLocales = async (req: Request) => { - const projectFilePath = path.join(process.cwd(), 'database', 'project.json'); // Adjusted path to project.json const projectId = req.params.projectId; - const locales = req.body.locale try { - // Check if the project.json file exists - if (!fs?.existsSync?.(projectFilePath)) { - console.error(`project.json not found at ${projectFilePath}`); - throw new Error(`project.json not found.`); - } // Find the project with the specified projectId await ProjectModelLowdb?.read?.(); const index = ProjectModelLowdb?.chain?.get?.("projects")?.findIndex?.({ id: projectId })?.value?.(); @@ -464,15 +457,10 @@ export const createSourceLocales = async (req: Request) => { */ export const updateLocaleMapper = async (req: Request) => { const mapperObject = req?.body; - const projectFilePath = path?.join?.(process?.cwd(), 'database', 'project.json'); // Adjusted path to project.json + // Adjusted path to project.json const projectId = req?.params?.projectId; try { - // Check if the project.json file exists - if (!fs?.existsSync?.(projectFilePath)) { - console.error(`project.json not found at ${projectFilePath}`); - throw new Error(`project.json not found.`); - } // Find the project with the specified projectId await ProjectModelLowdb?.read?.(); const index = ProjectModelLowdb?.chain?.get?.("projects")?.findIndex?.({ id: projectId })?.value?.(); diff --git a/upload-api/src/config/index.ts b/upload-api/src/config/index.ts index 380544b23..a3e627499 100644 --- a/upload-api/src/config/index.ts +++ b/upload-api/src/config/index.ts @@ -2,7 +2,7 @@ export default { plan: { dropdown: { optionLimit: 100 } }, - cmsType: 'contentful', + cmsType: 'sitecore', isLocalPath: true, awsData: { awsRegion: 'us-east-2', @@ -12,6 +12,6 @@ export default { bucketName: 'migartion-test', buketKey: 'project/package 45.zip' }, - localPath: '/Users/sayali.joshi/Downloads/contentfulDummyEmbedData.json' //package 45.zip' - // localPath: '/Users/umesh.more/Documents/ui-migration/migration-v2-node-server/upload-api/extracted_files/package 45.zip' + // localPath: '/Users/sayali.joshi/Downloads/contentfulDummyEmbedData.json' //package 45.zip' + localPath: '/Users/umesh.more/Documents/ui-migration/migration-v2-node-server/upload-api/extracted_files/package 45.zip' };