Skip to content

Commit

Permalink
feat data validation updates node updates (#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
chavda-bhavik authored Sep 26, 2024
2 parents 64d88ce + 7160a6d commit f777a22
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 9 deletions.
9 changes: 9 additions & 0 deletions apps/api/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"loader": "ts-node/esm",
"extensions": [
"ts"
],
"spec": [
"src/**/**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion apps/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.16.1-bullseye-slim
FROM node:20.13.1-bullseye-slim

COPY apps/api/src/config/default.cf /usr/local/etc/isolate

Expand Down
2 changes: 1 addition & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"lint": "eslint src",
"lint:fix": "pnpm lint -- --fix",
"migration": "cross-env NODE_ENV=local MIGRATION=true ts-node --require tsconfig-paths/register --transpileOnly",
"test": "cross-env TZ=UTC NODE_ENV=test E2E_RUNNER=true mocha --timeout 10000 --require ts-node/register --exit src/**/**/*.spec.ts"
"test": "cross-env TZ=UTC NODE_ENV=test E2E_RUNNER=true mocha --timeout 10000 --require ts-node/register --exit"
},
"dependencies": {
"@impler/client": "workspace:^",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ export class DoReReview extends BaseReview {
// update second occurance of data for validity
bulkOperations.push({
updateOne: {
filter: { [`record.${key}`]: item, [`updated.${key}`]: false },
filter: {
[`record.${key}`]: item,
$or: [{ [`updated.${key}`]: false }, { [`updated.${key}`]: { $exists: false } }],
},
update: { $set: { [`updated.${key}`]: true } },
},
});
Expand Down Expand Up @@ -260,7 +263,15 @@ export class DoReReview extends BaseReview {
objectMode: true,
async write(record, encoding, callback) {
bulkOp.push({
updateOne: { filter: { index: record.index }, update: { $set: record, $unset: { updated: {} } } },
updateOne: {
filter: { index: record.index },
update: {
$set: {
errors: record.errors,
updated: {},
},
},
},
});
callback();
},
Expand Down
5 changes: 3 additions & 2 deletions apps/api/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"declaration": true,
"noImplicitAny": false,
"removeComments": true,
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es6",
"target": "esnext",
"esModuleInterop": false,
"sourceMap": true,
"outDir": "./dist",
Expand Down
5 changes: 3 additions & 2 deletions apps/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"types": ["node", "multer", "mocha", "chai"],
"target": "es2017",
"target": "esnext",
"allowJs": false,
"esModuleInterop": false,
"declarationMap": true,
Expand Down
1 change: 0 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"suppressImplicitAnyIndexErrors": true,
"lib": ["es2019", "dom"],
"target": "es5",
"typeRoots": ["./node_modules/@types"],
Expand Down

0 comments on commit f777a22

Please sign in to comment.