Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api/src/controllers/migration.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { migrationService } from "../services/migration.service.js"
*/
const createTestStack = async (req: Request, res: Response): Promise<void> => {
const resp = await migrationService.createTestStack(req);
res.status(200).json(resp);
res.status(resp?.status).json(resp);
};

/**
Expand Down Expand Up @@ -55,12 +55,12 @@ const getLogs = async (req: Request, res: Response): Promise<void> => {
res.status(200).json(resp);
};

const saveLocales = async (req:Request, res: Response):Promise<void> =>{
const saveLocales = async (req: Request, res: Response): Promise<void> => {
const resp = await migrationService.createSourceLocales(req)
res.status(200).json(resp);
}

const saveMappedLocales = async (req:Request, res:Response):Promise<void> =>{
const saveMappedLocales = async (req: Request, res: Response): Promise<void> => {
const resp = await migrationService.updateLocaleMapper(req);
res.status(200).json(resp);
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/services/contentful.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ const createEntry = async (packagePath: any, destination_stack_id: string, proje
const environmentsId = await readFile(environmentSave, ENVIRONMENTS_FILE_NAME) ?? {};
const displayField: { [key: string]: any } = {}
content.map((item: any) => {
displayField[item.name.toLowerCase().replace(/[^a-z0-9]+/g, "_")] =
displayField[item?.sys?.id] =
{
displayField: item.displayField || "untitled",
};
Expand Down
14 changes: 8 additions & 6 deletions upload-api/migration-contentful/libs/contentTypeMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,13 @@ const contentTypeMapper = (data) => {
};

// Process validations and content names when data.items is not defined
if (!item.items) {
if (item.validations?.length > 0) {
if (!item?.items) {
if (item?.validations?.length > 0) {
item.validations.forEach((entries) => {
if (entries.linkContentType?.length) {
commonRef = processLinkContentType(entries.linkContentType);
if (entries?.linkContentType?.length) {
commonRef = processLinkContentType(entries?.linkContentType);
referenceFields =
commonRef.length > 0 ? commonRef : item.contentNames?.slice(0, 9);
commonRef?.length > 0 ? commonRef : item?.contentNames?.slice(0, 9);
}
});
} else {
Expand All @@ -331,7 +331,9 @@ const contentTypeMapper = (data) => {
: item?.contentNames?.slice(0, 9);
}
}
acc.push(createFieldObject(item, 'reference', 'reference', referenceFields));
const refFieldData = createFieldObject(item, 'reference', 'reference', referenceFields)
refFieldData.refrenceTo = referenceFields;
acc.push(refFieldData);
break;
}
case 'checkbox':
Expand Down
Loading