Skip to content
Merged

Dev #273

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
22b3597
tetsing added
umeshmore45 Jul 31, 2024
c53dc0a
tetsing added
umeshmore45 Jul 31, 2024
4ef0e15
reso;ving conficts
RohitKini Aug 14, 2024
3166a77
resolving conflits
RohitKini Aug 14, 2024
9939283
conflict resolve and folder name change
RohitKini Aug 14, 2024
34fa731
package.json
RohitKini Aug 14, 2024
ab9e610
added funtionality steps for redux mapping
RohitKini Aug 14, 2024
e5a9f8a
added funtionality steps for redux mapping
RohitKini Aug 14, 2024
daa468c
Merge branch 'dev' of https://github.com/contentstack/migration-v2-no…
RohitKini Aug 14, 2024
4dcf5a9
Merge branch 'stage' of https://github.com/contentstack/migration-v2-…
RohitKini Aug 14, 2024
ac14138
added dev changes
RohitKini Aug 14, 2024
ade2827
Merge branch 'dev' of https://github.com/contentstack/migration-v2-no…
RohitKini Aug 27, 2024
234c25a
added stack details in project db
RohitKini Aug 28, 2024
cd54dd3
createObject redux mapper
RohitKini Aug 28, 2024
5d612b6
content mapper update function
RohitKini Aug 30, 2024
09a8b42
Merge branch 'dev' of https://github.com/contentstack/migration-v2-no…
sayalijoshi27 Sep 2, 2024
2098bd6
Merge branch 'dev' of github.com:contentstack/migration-v2-node-serve…
AishDani Sep 2, 2024
4b7102c
refactor:refactored the legacy cms redux with the new redux setup me…
AishDani Sep 2, 2024
a1e193f
refactor:legacy cms redux logic
AishDani Sep 2, 2024
dfe412e
refactor:removed projectdata prop from legacy cms
AishDani Sep 2, 2024
51beb58
Merge pull request #258 from contentstack/feature/re-redux-legacy
RohitKini Sep 2, 2024
2721677
Merge branch 'feature/rohit' of https://github.com/contentstack/migra…
sayalijoshi27 Sep 3, 2024
333e3b4
dev merged
RohitKini Sep 3, 2024
5b739a7
Merge branch 'feature/rohit' of https://github.com/contentstack/migra…
RohitKini Sep 3, 2024
1df6a9f
added getStackLocale
RohitKini Sep 5, 2024
616fd50
UpdateContentMapper changes added
sayalijoshi27 Sep 5, 2024
8fc7137
Merge branch 'feature/rohit' of https://github.com/contentstack/migra…
sayalijoshi27 Sep 5, 2024
e412441
added user email in authentication
RohitKini Sep 5, 2024
6181c76
refactor:destination-stack-redux changes
AishDani Sep 9, 2024
c46982e
Merge branch 'feature/rohit' of github.com:contentstack/migration-v2-…
AishDani Sep 9, 2024
0d30dfa
Merge pull request #265 from contentstack/feature/re-redux-destinatio…
RohitKini Sep 9, 2024
50a643d
Content mapper redux changes
sayalijoshi27 Sep 9, 2024
ec55992
Redux set up for Content mapper
sayalijoshi27 Sep 10, 2024
460e2e4
Merge branch 'dev' of https://github.com/contentstack/migration-v2-no…
sayalijoshi27 Sep 10, 2024
cb2953f
Merge pull request #266 from contentstack/redux/sayali
RohitKini Sep 10, 2024
54cc77f
[CMG-273], [CMG-290]
sayalijoshi27 Sep 10, 2024
3674280
Merge branch 'feature/rohit' of https://github.com/contentstack/migra…
sayalijoshi27 Sep 10, 2024
cb71202
Merge pull request #267 from contentstack/redux/sayali
RohitKini Sep 10, 2024
25987ad
code merged
umeshmore45 Sep 10, 2024
2accc2c
code merged
umeshmore45 Sep 10, 2024
b875190
code merged
umeshmore45 Sep 10, 2024
0019bdb
added options
umeshmore45 Sep 10, 2024
c09e56a
updated code
umeshmore45 Sep 10, 2024
5aa07c4
updated code
umeshmore45 Sep 10, 2024
6928cc3
isNewStack usecase functionality done in ContentMapper module
sayalijoshi27 Sep 11, 2024
7bba992
Merge branch 'feature/rohit' of https://github.com/contentstack/migra…
sayalijoshi27 Sep 11, 2024
52319d6
Conflict resolved
sayalijoshi27 Sep 11, 2024
5372084
Merge pull request #269 from contentstack/redux/sayali
RohitKini Sep 11, 2024
5029668
cli utilites changes
RohitKini Sep 11, 2024
c3df7c7
added new code
umeshmore45 Sep 11, 2024
6abec1d
Merge pull request #270 from contentstack/feature/merge_two
RohitKini Sep 12, 2024
425ff46
Fixed name error validation
BhagyahsreeMatere Sep 12, 2024
30b5d15
Fixed name error validation message
BhagyahsreeMatere Sep 12, 2024
87a09a1
Merge pull request #272 from contentstack/bugfix/popup-modal
sayalijoshi27 Sep 12, 2024
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
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,10 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/

uploade-api/node_modules
uploade-api/build
upload-api/node_modules
upload-api/build
package-lock.json
ui/.env
uplaode-api/sitecoreMigrationData
uplaode-api/extracted_files
upload-api/sitecoreMigrationData
upload-api/extracted_files
locale-cli
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"eslint.workingDirectories": ["api", "ui", "uplaode-api"]
"eslint.workingDirectories": ["api", "ui", "upload-api"]
}
3 changes: 2 additions & 1 deletion api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,5 @@ package-lock.json

!example.env

database/
database/
/sitecoreMigrationData
10 changes: 10 additions & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,37 @@
},
"homepage": "https://github.com/contentstack-expert-services/migration-v2-node-server#readme",
"dependencies": {
"@contentstack/cli-cm-import": "^1.16.6",
"@contentstack/cli-utilities": "^1.7.1",
"@contentstack/json-rte-serializer": "^2.0.7",
"axios": "^1.6.5",
"chokidar": "^3.6.0",
"cors": "^2.8.5",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"express-validator": "^7.0.1",
"express-winston": "^4.2.0",
"fs-readdir-recursive": "^1.1.0",
"helmet": "^7.1.0",
"html-to-json-parser": "^2.0.1",
"http": "^0.0.1-security",
"jsdom": "^24.1.0",
"jsonwebtoken": "^9.0.2",
"lowdb": "^7.0.1",
"shelljs": "^0.8.5",
"socket.io": "^4.7.5",
"uuid": "^9.0.1",
"winston": "^3.11.0"
},
"devDependencies": {
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/fs-readdir-recursive": "^1.1.3",
"@types/jsdom": "^21.1.7",
"@types/jsonwebtoken": "^9.0.5",
"@types/lodash": "^4.17.0",
"@types/node": "^20.10.4",
"@types/shelljs": "^0.8.15",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
Expand Down
16 changes: 14 additions & 2 deletions api/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export const HTTP_TEXTS = {
FILEFORMAT_CONFIRMATION_UPDATED:
"Project's Fileformat confirmation updated successfully",
CMS_UPDATED: "Project's migration cms updated successfully",
STACK_UPDATED: "Project's migration stack details updated successfully",
CONTENT_MAPPER_UPDATED: "Project's migration content mapping updated successfully",
FILE_FORMAT_UPDATED: "Project's migration file format updated successfully",
DESTINATION_STACK_UPDATED:
"Project's migration destination stack updated successfully",
Expand Down Expand Up @@ -72,8 +74,10 @@ export const HTTP_TEXTS = {
"Sorry, the requested content mapper id does not exists.",
ADMIN_LOGIN_ERROR:
"Sorry, You Don't have admin access in any of the Organisation",
PROJECT_DELETE: "Project Deleted Successfully",
PROJECT_REVERT: "Project Reverted Successfully",
PROJECT_DELETE:
"Project Deleted Successfully",
PROJECT_REVERT:
"Project Reverted Successfully",
};

export const HTTP_RESPONSE_HEADERS = {
Expand Down Expand Up @@ -144,3 +148,11 @@ export const CONTENT_TYPE_STATUS = {
3: 3, //mapping failed
4: 4, //auto-dump
};
// Cs Locale : Destination Local
export const LOCALE_MAPPER: any = {
//not more than one locale mapping in master locale
masterLocale: {
'en-us': 'en'
},
'fr': 'fr-fr'
}
6 changes: 6 additions & 0 deletions api/src/controllers/migration.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ const createTestStack = async (req: Request, res: Response): Promise<void> => {
* @param {Response} res - The response object.
* @returns {Promise<void>} - A Promise that resolves when the stack is deleted.
*/
const fieldMapping = async (req: Request, res: Response): Promise<void> => {
const resp = await migrationService.fieldMapping(req);
res.status(200).json(resp);
};

const deleteTestStack = async (req: Request, res: Response): Promise<void> => {
const resp = await migrationService.deleteTestStack(req);
res.status(200).json(resp);
Expand All @@ -28,4 +33,5 @@ const deleteTestStack = async (req: Request, res: Response): Promise<void> => {
export const migrationController = {
createTestStack,
deleteTestStack,
fieldMapping,
};
15 changes: 15 additions & 0 deletions api/src/controllers/org.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,24 @@ const getStackStatus = async (req: Request, res: Response) => {
res.status(resp.status).json(resp.data);
};


/**
* Retrieves the stack status.
*
* @param req - The request object.
* @param res - The response object.
* @returns A Promise that resolves to the stack status response.
*/
const getStackLocale = async (req: Request, res: Response) => {
const resp = await orgService.getStackLocale(req);
res.status(resp.status).json(resp.data);
};


export const orgController = {
getAllStacks,
createStack,
getLocales,
getStackStatus,
getStackLocale
};
13 changes: 13 additions & 0 deletions api/src/controllers/projects.contentMapper.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ const getSingleContentTypes = async (
res.status(201).json(resp);
};

/**
* update content mapping details a project.
*
* @param req - The request object.
* @param res - The response object.
* @returns A Promise that resolves to void.
*/
const updateContentMapper = async (req: Request, res: Response): Promise<void> => {
const project = await contentMapperService.updateContentMapper(req);
res.status(project.status).json(project);
}

export const contentMapperController = {
getContentTypes,
getFieldMapping,
Expand All @@ -119,4 +131,5 @@ export const contentMapperController = {
// removeMapping,
getSingleContentTypes,
removeContentMapper,
updateContentMapper
};
13 changes: 13 additions & 0 deletions api/src/controllers/projects.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ const revertProject = async (req: Request, res: Response): Promise<void> => {
res.status(project.status).json(project);
};

/**
* update stack details a project.
*
* @param req - The request object.
* @param res - The response object.
* @returns A Promise that resolves to void.
*/
const updateStackDetails = async (req: Request, res: Response): Promise<void> => {
const project = await projectService.updateStackDetails(req);
res.status(project.status).json(project);
}

export const projectController = {
getAllProjects,
getProject,
Expand All @@ -168,4 +180,5 @@ export const projectController = {
updateCurrentStep,
deleteProject,
revertProject,
updateStackDetails
};
3 changes: 2 additions & 1 deletion api/src/models/FieldMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ interface Advanced {
EmbedObjects: any;
MinChars: string;
MaxChars: number;
Default_value: boolean;
Default_value: string;
options: any[];
}

/**
Expand Down
10 changes: 10 additions & 0 deletions api/src/models/project-lowdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ interface LegacyCMS {
is_localPath: boolean;
}

interface StackDetails{
uid: string;
label: string;
master_locale: string;
created_at: string;
isNewStack: boolean;
}

/**
* Represents an execution log.
*/
Expand Down Expand Up @@ -61,6 +69,8 @@ interface Project {
isDeleted: boolean;
isNewStack: boolean;
newStackId: string;
stackDetails: [];
mapperKeys: [];
extract_path: string;
}

Expand Down
3 changes: 3 additions & 0 deletions api/src/routes/contentMapper.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,7 @@ router.get(
asyncRouter(contentMapperController.removeContentMapper)
);

//update content mapper details
router.patch("/:orgId/:projectId/mapper_keys", asyncRouter(contentMapperController.updateContentMapper));

export default router;
2 changes: 1 addition & 1 deletion api/src/routes/migration.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const router = express.Router({ mergeParams: true });
*/
router.post(
"/test-stack/:orgId/:projectId",
asyncRouter(migrationController.createTestStack)
asyncRouter(migrationController.fieldMapping)
);

/**
Expand Down
8 changes: 8 additions & 0 deletions api/src/routes/org.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,12 @@ router.post(
asyncRouter(orgController.getStackStatus)
);

/**
* GET all contentstack locales route.
* @param req - Express request object.
* @param res - Express response object.
*/
router.get("/get_stack_locales", asyncRouter(orgController.getStackLocale));


export default router;
3 changes: 3 additions & 0 deletions api/src/routes/projects.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,7 @@ router.delete("/:projectId", asyncRouter(projectController.deleteProject));
//revert Project Route
router.patch("/:projectId", asyncRouter(projectController.revertProject));

//update stack details Project Route
router.patch("/:projectId/stack-details", asyncRouter(projectController.updateStackDetails));

export default router;
7 changes: 6 additions & 1 deletion api/src/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from "../utils/custom-errors.utils.js";
import AuthenticationModel from "../models/authentication.js";
import logger from "../utils/logger.js";
// import * as configHandler from "@contentstack/cli-utilities";

/**
* Logs in a user with the provided request data.
Expand All @@ -22,7 +23,7 @@ import logger from "../utils/logger.js";
*/
const login = async (req: Request): Promise<LoginServiceType> => {
const srcFun = "Login";

const cliUtilities: any = await import('@contentstack/cli-utilities');
/*
handles user authentication by making a request to an API,
performing various checks and validations,
Expand Down Expand Up @@ -109,6 +110,10 @@ const login = async (req: Request): Promise<LoginServiceType> => {
data.users[userIndex].authtoken = res?.data.user?.authtoken;
data.users[userIndex].updated_at = new Date().toISOString();
}

cliUtilities?.configHandler?.set('region', userData?.region);
cliUtilities?.configHandler?.set('authtoken', res?.data.user?.authtoken);

});

// JWT token generation
Expand Down
Loading