Skip to content

Commit a7ae479

Browse files
author
GaurishN
committed
local workdpress
1 parent e6143ab commit a7ae479

File tree

3 files changed

+1845
-10
lines changed

3 files changed

+1845
-10
lines changed

api/src/constants/index.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,14 @@ export const LOCALE_MAPPER: any = {
165165

166166
export const MIGRATION_DATA_CONFIG = {
167167
DATA :"cmsMigrationData",
168+
DATA_FILE_NAME :"data.json",
168169

169170
BACKUP_DATA: "migration-data",
170171
BACKUP_LOG_DIR: "logs",
171172
BACKUP_FOLDER_NAME: "import",
172173
BACKUP_FILE_NAME: "success.log",
173174

174-
LOCALE_DIR_NAME : "locale",
175+
LOCALE_DIR_NAME : "locales",
175176
LOCALE_FILE_NAME : "locales.json",
176177
LOCALE_MASTER_LOCALE : "master-locale.json",
177178
LOCALE_CF_LANGUAGE : "language.json",
@@ -197,11 +198,35 @@ export const MIGRATION_DATA_CONFIG = {
197198
ASSETS_FILE_NAME : "assets.json",
198199
ASSETS_SCHEMA_FILE : "index.json",
199200
ASSETS_FAILED_FILE : "cs_failed.json",
200-
ASSETS_METADATA_FILE :"metadata.json",
201+
ASSETS_METADATA_FILE :"metadata.json",
202+
ASSETS_FOLDER_FILE_NAME: "folders.json",
201203

202204
ENTRIES_DIR_NAME : "entries",
203205
ENTRIES_MASTER_FILE : "index.json",
204206

207+
AUTHORS_DIR_NAME : "authors",
208+
AUTHORS_FILE_NAME : "en-us.json",
209+
AUTHORS_MASTER_FILE : "authors.json",
210+
211+
CATEGORIES_DIR_NAME: "categories",
212+
CATEGORIES_FILE_NAME: "en-us.json",
213+
CATEGORIES_MASTER_FILE: "categories.json",
214+
215+
TAG_DIR_NAME: "tags",
216+
TAG_FILE_NAME: "en-us.json",
217+
TAG_MASTER_FILE: "tag.json",
218+
219+
TERMS_DIR_NAME: "terms",
220+
TERMS_FILE_NAME: "en-us.json",
221+
TERMS_MASTER_FILE: "terms.json",
222+
223+
POSTS_DIR_NAME: "posts",
224+
POSTS_FOLDER_NAME: "en-us",
225+
POSTS_FILE_NAME: "en-us.json",
226+
POSTS_MASTER_FILE: "posts.json",
227+
228+
CHUNKS_DIR_NAME: "chunks",
229+
205230
GLOBAL_FIELDS_DIR_NAME : "global_fields",
206231
GLOBAL_FIELDS_FILE_NAME : "globalfields.json",
207232

api/src/services/migration.service.ts

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { HTTP_TEXTS, HTTP_CODES, LOCALE_MAPPER, STEPPER_STEPS } from "../constan
1111
import { BadRequestError, ExceptionFunction } from "../utils/custom-errors.utils.js";
1212
import { fieldAttacher } from "../utils/field-attacher.utils.js";
1313
import { siteCoreService } from "./sitecore.service.js";
14+
import { wordpressService } from "./wordpress.service.js";
1415
import { testFolderCreator } from "../utils/test-folder-creator.utils.js";
1516
import { utilsCli } from './runCli.service.js';
1617
import customLogger from "../utils/custom-logger.utils.js";
@@ -217,10 +218,22 @@ const startTestMigration = async (req: Request): Promise<any> => {
217218
const message = getLogMessage('startTestMigration', 'Starting Test Migration...', {});
218219
await customLogger(projectId, project?.current_test_stack_id, 'info', message);
219220
await setLogFilePath(loggerPath);
220-
const contentTypes = await fieldAttacher({ orgId, projectId, destinationStackId: project?.current_test_stack_id });
221-
await siteCoreService?.createEntry({ packagePath, contentTypes, destinationStackId: project?.current_test_stack_id, projectId });
222-
await siteCoreService?.createLocale(req, project?.current_test_stack_id, projectId);
223-
await siteCoreService?.createVersionFile(project?.current_test_stack_id);
221+
// const contentTypes = await fieldAttacher({ orgId, projectId, destinationStackId: project?.current_test_stack_id });
222+
// await siteCoreService?.createEntry({ packagePath, contentTypes, destinationStackId: project?.current_test_stack_id, projectId });
223+
// await siteCoreService?.createLocale(req, project?.current_test_stack_id, projectId);
224+
// await siteCoreService?.createVersionFile(project?.current_test_stack_id);
225+
let affix = "ogip"
226+
await wordpressService?.getAllAssets(affix)
227+
await wordpressService?.createAssetFolderFile(affix)
228+
await wordpressService?.getAllreference(affix)
229+
await wordpressService?.extractChunks(affix)
230+
await wordpressService?.getAllAuthors(affix)
231+
await wordpressService?.extractContentTypes(affix)
232+
await wordpressService?.getAllTerms(affix)
233+
await wordpressService?.getAllTags(affix)
234+
await wordpressService?.getAllCategories(affix)
235+
await wordpressService?.extractPosts(affix)
236+
await wordpressService?.extractGlobalFields()
224237
await testFolderCreator?.({ destinationStackId: project?.current_test_stack_id });
225238
await utilsCli?.runCli(region, user_id, project?.current_test_stack_id, projectId, true, loggerPath);
226239
}
@@ -251,10 +264,22 @@ const startMigration = async (req: Request): Promise<any> => {
251264
const message = getLogMessage('startTestMigration', 'Starting Migration...', {});
252265
await customLogger(projectId, project?.destination_stack_id, 'info', message);
253266
await setLogFilePath(loggerPath);
254-
const contentTypes = await fieldAttacher({ orgId, projectId, destinationStackId: project?.destination_stack_id });
255-
await siteCoreService?.createEntry({ packagePath, contentTypes, destinationStackId: project?.destination_stack_id, projectId });
256-
await siteCoreService?.createLocale(req, project?.destination_stack_id, projectId);
257-
await siteCoreService?.createVersionFile(project?.destination_stack_id);
267+
// const contentTypes = await fieldAttacher({ orgId, projectId, destinationStackId: project?.destination_stack_id });
268+
// await siteCoreService?.createEntry({ packagePath, contentTypes, destinationStackId: project?.destination_stack_id, projectId });
269+
// await siteCoreService?.createLocale(req, project?.destination_stack_id, projectId);
270+
// await siteCoreService?.createVersionFile(project?.destination_stack_id);
271+
let affix = "ogip"
272+
await wordpressService?.getAllAssets(affix)
273+
await wordpressService?.createAssetFolderFile(affix)
274+
await wordpressService?.getAllreference(affix)
275+
await wordpressService?.extractChunks(affix)
276+
await wordpressService?.getAllAuthors(affix)
277+
await wordpressService?.extractContentTypes(affix)
278+
await wordpressService?.getAllTerms(affix)
279+
await wordpressService?.getAllTags(affix)
280+
await wordpressService?.getAllCategories(affix)
281+
await wordpressService?.extractPosts(affix)
282+
await wordpressService?.extractGlobalFields()
258283
await utilsCli?.runCli(region, user_id, project?.destination_stack_id, projectId, false, loggerPath);
259284
}
260285
}

0 commit comments

Comments
 (0)