Skip to content

Commit 418a3c8

Browse files
authored
Merge pull request #600 from contentstack/dev
Dev
2 parents 143ea2d + 04c9d0d commit 418a3c8

File tree

26 files changed

+327
-205
lines changed

26 files changed

+327
-205
lines changed

.github/workflows/repo-sync.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,15 @@ jobs:
9898
git gc --prune=now # Garbage collect and prune unreachable objects
9999
100100
# echo "Installing ESLint dependencies..."
101-
npm install --save-dev eslint @eslint/js globals
101+
npm install --save-dev eslint @eslint/js globals @typescript-eslint/eslint-plugin @typescript-eslint/parser
102102
103103
104104
if [ ! -f "eslint.config.cjs" ]; then
105105
echo "Creating default ESLint config..."
106106
cat <<EOL > eslint.config.cjs
107-
const js = require("@eslint/js");
108-
const globals = require("globals");
107+
const js = require("@eslint/js");
108+
const globals = require("globals");
109+
const tsPlugin = require("@typescript-eslint/eslint-plugin");
109110
110111
module.exports = [
111112
js.configs.recommended,
@@ -114,11 +115,19 @@ jobs:
114115
ecmaVersion: "latest",
115116
sourceType: "module",
116117
globals: globals.node,
118+
parser: require("@typescript-eslint/parser"),
119+
},
120+
plugins: {
121+
"@typescript-eslint": tsPlugin,
117122
},
118123
rules: {
119124
"no-unused-vars": "warn",
120125
"no-console": "off",
121-
"@typescript-eslint/no-var-requires": 'off'
126+
"@typescript-eslint/no-var-requires": "off",
127+
"no-prototype-builtins": "off",
128+
"@typescript-eslint/no-explicit-any": "off",
129+
"no-constant-condition": "off",
130+
"no-constant-binary-expression": "off",
122131
}
123132
}
124133
];
@@ -225,7 +234,7 @@ jobs:
225234
git gc --prune=now # Garbage collect and prune unreachable objects
226235
227236
echo "Installing ESLint dependencies..."
228-
npm install --save-dev eslint @eslint/js globals
237+
npm install --save-dev eslint @eslint/js globals @typescript-eslint/eslint-plugin @typescript-eslint/parser
229238
230239
if [ ! -f "eslint.config.cjs" ]; then
231240
echo "Creating default ESLint config..."
@@ -243,7 +252,12 @@ jobs:
243252
},
244253
rules: {
245254
"no-unused-vars": "warn",
246-
"no-console": "off"
255+
"no-console": "off",
256+
"@typescript-eslint/no-var-requires": 'off',
257+
"@typescript-eslint/no-var-requires": "off",
258+
"no-prototype-builtins": "off",
259+
"@typescript-eslint/no-explicit-any": "off",
260+
"no-constant-condition": "off"
247261
}
248262
}
249263
];
@@ -318,7 +332,7 @@ jobs:
318332
git gc --prune=now # Garbage collect and prune unreachable objects
319333
320334
echo "Installing ESLint dependencies..."
321-
npm install --save-dev eslint @eslint/js globals
335+
npm install --save-dev eslint @eslint/js globals @typescript-eslint/eslint-plugin @typescript-eslint/parser
322336
323337
if [ ! -f "eslint.config.cjs" ]; then
324338
echo "Creating default ESLint config..."
@@ -336,7 +350,12 @@ jobs:
336350
},
337351
rules: {
338352
"no-unused-vars": "warn",
339-
"no-console": "off"
353+
"no-console": "off",
354+
"@typescript-eslint/no-var-requires": 'off',
355+
"@typescript-eslint/no-var-requires": "off",
356+
"no-prototype-builtins": "off",
357+
"@typescript-eslint/no-explicit-any": "off",
358+
"no-constant-condition": "off"
340359
}
341360
}
342361
];

api/src/controllers/projects.contentMapper.controller.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { contentMapperService } from "../services/contentMapper.service.js";
99
*/
1010
const putTestData = async (req: Request, res: Response): Promise<void> => {
1111
const resp = await contentMapperService.putTestData(req);
12-
res.status(200).json(resp);
12+
res.status(resp?.status).json(resp);
1313
};
1414

1515
/**
@@ -21,7 +21,7 @@ const putTestData = async (req: Request, res: Response): Promise<void> => {
2121
*/
2222
const getContentTypes = async (req: Request, res: Response): Promise<void> => {
2323
const resp = await contentMapperService.getContentTypes(req);
24-
res.status(200).json(resp);
24+
res.status(resp?.status).json(resp);
2525
};
2626
/**
2727
* Retrieves the field mapping for a given request and sends the response as JSON.
@@ -32,7 +32,7 @@ const getContentTypes = async (req: Request, res: Response): Promise<void> => {
3232
*/
3333
const getFieldMapping = async (req: Request, res: Response): Promise<void> => {
3434
const resp = await contentMapperService.getFieldMapping(req);
35-
res.status(200).json(resp);
35+
res.status(resp?.status).json(resp);
3636
};
3737
/**
3838
* Retrieves the existing content types.
@@ -76,7 +76,7 @@ const putContentTypeFields = async (
7676
res: Response
7777
): Promise<void> => {
7878
const resp = await contentMapperService.updateContentType(req);
79-
res.status(200).json(resp);
79+
res.status(resp?.status).json(resp);
8080
};
8181
/**
8282
* Resets the content type to its initial mapping.
@@ -87,7 +87,7 @@ const putContentTypeFields = async (
8787
*/
8888
const resetContentType = async (req: Request, res: Response): Promise<void> => {
8989
const resp = await contentMapperService.resetToInitialMapping(req);
90-
res.status(200).json(resp);
90+
res.status(resp?.status).json(resp);
9191
};
9292
// TODO Will remove if not required
9393
// const removeMapping = async (req: Request, res: Response): Promise<void> => {

0 commit comments

Comments
 (0)