Skip to content
Merged

Dev #205

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
dfe6890
aded type to distinguish content type and global field
RohitKini Jul 15, 2024
4d72c20
aded type to distinguish content type and global field
RohitKini Jul 15, 2024
3ef0e59
Merge pull request #192 from contentstack/feature/commenting-code
v1shalpatel Jul 16, 2024
ca14e97
[CMG-244], [CMG-245]
sayalijoshi27 Jul 16, 2024
d2c739d
Merge branch 'dev' of https://github.com/contentstack/migration-v2-no…
sayalijoshi27 Jul 16, 2024
2daecc2
[CMG-233] - Content Mapper | LHS | Icons of Content type and Global f…
sayalijoshi27 Jul 16, 2024
8b0da3f
Merge pull request #193 from contentstack/feature/profile-design
v1shalpatel Jul 16, 2024
e61d772
type ans newstack flag and newstackId in DB
RohitKini Jul 16, 2024
f14a61e
Merge pull request #194 from contentstack/feature/commenting-code
v1shalpatel Jul 16, 2024
360f69f
added comments on api controllers,middlewares,models
RohitKini Jul 16, 2024
f90de1e
Merge pull request #195 from contentstack/feature/commenting-code
v1shalpatel Jul 16, 2024
bb3a7fa
added comments on api controllers,middlewares,models
RohitKini Jul 16, 2024
cc56cef
Merge branch 'dev' of https://github.com/contentstack/migration-v2-no…
RohitKini Jul 16, 2024
7d3b27a
Merge pull request #196 from contentstack/feature/commenting-code
RohitKini Jul 16, 2024
104cc06
added comments on api routes,services,utils
RohitKini Jul 16, 2024
548f017
Merge pull request #197 from contentstack/feature/commenting-code
RohitKini Jul 16, 2024
4608251
added comments on validators
RohitKini Jul 17, 2024
b46d818
Merge pull request #198 from contentstack/feature/commenting-code
RohitKini Jul 17, 2024
46cdcb6
refactor:resolved content mapper bugs
AishDani Jul 17, 2024
9a48508
Merge branch 'dev' of github.com:contentstack/migration-v2-node-serve…
AishDani Jul 17, 2024
a1736c6
components till DocLink
RohitKini Jul 17, 2024
16e5b71
Merge pull request #199 from contentstack/feature/commenting-code
RohitKini Jul 17, 2024
613f7d5
refactor:added regex for id of fieldmapper
AishDani Jul 17, 2024
3f81925
Merge branch 'dev' of github.com:contentstack/migration-v2-node-serve…
AishDani Jul 17, 2024
a96c315
Merge pull request #200 from contentstack/bugs-legacyCMS
v1shalpatel Jul 17, 2024
ce81981
added comments till Content mapper
RohitKini Jul 17, 2024
184104b
Merge pull request #201 from contentstack/feature/commenting-code
RohitKini Jul 17, 2024
35ffe90
refactor:changed uid of title and url to lowercase
AishDani Jul 17, 2024
a69246e
Merge pull request #202 from contentstack/bugs-legacyCMS
v1shalpatel Jul 17, 2024
a2188e7
[CMG-247] - debugging
sayalijoshi27 Jul 18, 2024
15d36be
Merge branch 'dev' of https://github.com/contentstack/migration-v2-no…
sayalijoshi27 Jul 18, 2024
dd15779
refactor:resolved undefined error
AishDani Jul 18, 2024
a6f68ba
Merge pull request #203 from contentstack/bugs-legacyCMS
v1shalpatel Jul 18, 2024
198ffc4
Merge branch 'dev' of https://github.com/contentstack/migration-v2-no…
sayalijoshi27 Jul 18, 2024
85e8c88
[CMG-247], [CMG-256]
sayalijoshi27 Jul 18, 2024
ed8e201
Merge pull request #204 from contentstack/bugfix/content-mapper
RohitKini Jul 18, 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
2 changes: 1 addition & 1 deletion api/src/config/dev.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export const devConfig = {
},
LOG_FILE_PATH:
process.platform === "win32" ? ".\\combine.log" : "./combine.log", // Replace with the actual path to your log file
};
};
9 changes: 9 additions & 0 deletions api/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ import path from "path";
import { prodConfig } from "./prod.config.js";
import { devConfig } from "./dev.config.js";

/**
* Loads the environment variables from the .env file.
*/
dotenv.config({
path: path.resolve(process.cwd(), `${process.env.NODE_ENV}.env`),
});

/**
* Configuration type for the application.
*/
export type ConfigType = {
APP_TOKEN_EXP: string;
APP_TOKEN_KEY: string;
Expand All @@ -28,6 +34,9 @@ export type ConfigType = {
};
};

/**
* Configuration object for the application.
*/
export const config: ConfigType = {
APP_TOKEN_EXP: "1d",
PORT: process.env.PORT!,
Expand Down
12 changes: 12 additions & 0 deletions api/src/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import { Request, Response } from "express";
import { authService } from "../services/auth.service.js";

/**
* Handles the login request.
*
* @param req - The request object.
* @param res - The response object.
*/
const login = async (req: Request, res: Response) => {
const resp = await authService.login(req);
res.status(resp?.status).json(resp?.data);
};

/**
* Handles the request for sending an SMS.
*
* @param req - The request object.
* @param res - The response object.
*/
const RequestSms = async (req: Request, res: Response) => {
const resp = await authService.requestSms(req);
res.status(resp.status).json(resp.data);
Expand Down
14 changes: 14 additions & 0 deletions api/src/controllers/migration.controller.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import { Request, Response } from "express";
import { migrationService } from "../services/migration.service.js";

/**
* Creates a test stack.
*
* @param req - The request object.
* @param res - The response object.
* @returns A promise that resolves to void.
*/
const createTestStack = async (req: Request, res: Response): Promise<void> => {
const resp = await migrationService.createTestStack(req);
res.status(200).json(resp);
};

/**
* Deletes the test stack.
*
* @param {Request} req - The request object.
* @param {Response} res - The response object.
* @returns {Promise<void>} - A Promise that resolves when the stack is deleted.
*/
const deleteTestStack = async (req: Request, res: Response): Promise<void> => {
const resp = await migrationService.deleteTestStack(req);
res.status(200).json(resp);
Expand Down
28 changes: 28 additions & 0 deletions api/src/controllers/org.controller.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,49 @@
import { Request, Response } from "express";
import { orgService } from "../services/org.service.js";

/**
* Retrieves all stacks.
*
* @param {Request} req - The request object.
* @param {Response} res - The response object.
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
*/
const getAllStacks = async (req: Request, res: Response) => {
const resp = await orgService.getAllStacks(req);
res.status(resp?.status).json(resp?.data);
};

/**
* Creates a stack.
*
* @param {Request} req - The request object.
* @param {Response} res - The response object.
* @returns {Promise<void>} - A promise that resolves when the stack is created.
*/
const createStack = async (req: Request, res: Response) => {
const resp = await orgService.createStack(req);
res.status(resp.status).json(resp.data);
};

/**
* Retrieves the locales for an organization.
*
* @param {Request} req - The request object.
* @param {Response} res - The response object.
* @returns {Promise<void>} - A promise that resolves when the locales are retrieved.
*/
const getLocales = async (req: Request, res: Response) => {
const resp = await orgService.getLocales(req);
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 getStackStatus = async (req: Request, res: Response) => {
const resp = await orgService.getStackStatus(req);
res.status(resp.status).json(resp.data);
Expand Down
65 changes: 62 additions & 3 deletions api/src/controllers/projects.contentMapper.controller.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,74 @@
import { Request, Response } from "express";
import { contentMapperService } from "../services/contentMapper.service.js";
/**
* Handles the PUT request to update test data.
*
* @param req - The request object.
* @param res - The response object.
* @returns A Promise that resolves to void.
*/
const putTestData = async (req: Request, res: Response): Promise<void> => {
const resp = await contentMapperService.putTestData(req);
res.status(200).json(resp);
};

/**
* Retrieves the content types from the content mapper service and sends the response as JSON.
*
* @param req - The Express request object.
* @param res - The Express response object.
* @returns A Promise that resolves to void.
*/
const getContentTypes = async (req: Request, res: Response): Promise<void> => {
const resp = await contentMapperService.getContentTypes(req);
res.status(200).json(resp);
};
/**
* Retrieves the field mapping for a given request and sends the response as JSON.
*
* @param req - The request object.
* @param res - The response object.
* @returns A Promise that resolves to void.
*/
const getFieldMapping = async (req: Request, res: Response): Promise<void> => {
const resp = await contentMapperService.getFieldMapping(req);
res.status(200).json(resp);
};
/**
* Retrieves the existing content types.
*
* @param {Request} req - The request object.
* @param {Response} res - The response object.
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
*/
const getExistingContentTypes = async (
req: Request,
res: Response
): Promise<void> => {
const resp = await contentMapperService.getExistingContentTypes(req);
res.status(201).json(resp);
};
/**
* Updates the content type fields.
*
* @param {Request} req - The request object.
* @param {Response} res - The response object.
* @returns {Promise<void>} A promise that resolves when the content type fields are updated.
*/
const putContentTypeFields = async (
req: Request,
res: Response
): Promise<void> => {
const resp = await contentMapperService.updateContentType(req);
res.status(200).json(resp);
};
/**
* Resets the content type to its initial mapping.
*
* @param req - The request object.
* @param res - The response object.
* @returns A Promise that resolves to void.
*/
const resetContentType = async (req: Request, res: Response): Promise<void> => {
const resp = await contentMapperService.resetToInitialMapping(req);
res.status(200).json(resp);
Expand All @@ -37,11 +79,28 @@ const resetContentType = async (req: Request, res: Response): Promise<void> => {
// res.status(200).json(resp);
// };

const removeContentMapper = async (req: Request, res: Response): Promise<void> => {
/**
* Removes a content mapper.
*
* @param {Request} req - The request object.
* @param {Response} res - The response object.
* @returns {Promise<void>} - A promise that resolves when the content mapper is removed.
*/
const removeContentMapper = async (
req: Request,
res: Response
): Promise<void> => {
const resp = await contentMapperService.removeContentMapper(req);
res.status(200).json(resp);
}
};

/**
* Retrieves single content types.
*
* @param req - The request object.
* @param res - The response object.
* @returns A Promise that resolves to void.
*/
const getSingleContentTypes = async (
req: Request,
res: Response
Expand All @@ -59,5 +118,5 @@ export const contentMapperController = {
resetContentType,
// removeMapping,
getSingleContentTypes,
removeContentMapper
removeContentMapper,
};
Loading