Skip to content

Commit 4f78f7c

Browse files
Merge pull request #528 from contentstack/feature/locale-mapper-fix
code refactor
2 parents 070ed55 + 5fa4c9a commit 4f78f7c

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

api/src/services/migration.service.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -417,17 +417,10 @@ const getLogs = async (req: Request): Promise<any> => {
417417
*/
418418
export const createSourceLocales = async (req: Request) => {
419419

420-
const projectFilePath = path.join(process.cwd(), 'database', 'project.json'); // Adjusted path to project.json
421420
const projectId = req.params.projectId;
422-
423421
const locales = req.body.locale
424422

425423
try {
426-
// Check if the project.json file exists
427-
if (!fs?.existsSync?.(projectFilePath)) {
428-
console.error(`project.json not found at ${projectFilePath}`);
429-
throw new Error(`project.json not found.`);
430-
}
431424
// Find the project with the specified projectId
432425
await ProjectModelLowdb?.read?.();
433426
const index = ProjectModelLowdb?.chain?.get?.("projects")?.findIndex?.({ id: projectId })?.value?.();
@@ -464,15 +457,10 @@ export const createSourceLocales = async (req: Request) => {
464457
*/
465458
export const updateLocaleMapper = async (req: Request) => {
466459
const mapperObject = req?.body;
467-
const projectFilePath = path?.join?.(process?.cwd(), 'database', 'project.json'); // Adjusted path to project.json
460+
// Adjusted path to project.json
468461
const projectId = req?.params?.projectId;
469462

470463
try {
471-
// Check if the project.json file exists
472-
if (!fs?.existsSync?.(projectFilePath)) {
473-
console.error(`project.json not found at ${projectFilePath}`);
474-
throw new Error(`project.json not found.`);
475-
}
476464
// Find the project with the specified projectId
477465
await ProjectModelLowdb?.read?.();
478466
const index = ProjectModelLowdb?.chain?.get?.("projects")?.findIndex?.({ id: projectId })?.value?.();

upload-api/src/config/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export default {
22
plan: {
33
dropdown: { optionLimit: 100 }
44
},
5-
cmsType: 'contentful',
5+
cmsType: 'sitecore',
66
isLocalPath: true,
77
awsData: {
88
awsRegion: 'us-east-2',
@@ -12,6 +12,6 @@ export default {
1212
bucketName: 'migartion-test',
1313
buketKey: 'project/package 45.zip'
1414
},
15-
localPath: '/Users/sayali.joshi/Downloads/contentfulDummyEmbedData.json' //package 45.zip'
16-
// localPath: '/Users/umesh.more/Documents/ui-migration/migration-v2-node-server/upload-api/extracted_files/package 45.zip'
15+
// localPath: '/Users/sayali.joshi/Downloads/contentfulDummyEmbedData.json' //package 45.zip'
16+
localPath: '/Users/umesh.more/Documents/ui-migration/migration-v2-node-server/upload-api/extracted_files/package 45.zip'
1717
};

0 commit comments

Comments
 (0)