Skip to content

Commit

Permalink
feat(cb2-11778): update evl query following database change
Browse files Browse the repository at this point in the history
  • Loading branch information
LGin-BJSS committed May 31, 2024
1 parent 3b17fb4 commit bc52f5d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
26 changes: 16 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"aws-lambda": "1.0.6",
"express": "4.18.2",
"moment": "2.29.4",
"mysql2": "3.9.7",
"mysql2": "3.9.8",
"serverless-http": "2.6.0",
"source-map-support": "0.5.19",
"winston": "^3.7.2",
Expand Down
10 changes: 1 addition & 9 deletions src/app/queries/evlQuery.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
const EVL_QUERY = `
SET @prev := '';
SELECT testExpiryDate, vrm_trm, certificateNumber
FROM (
SELECT testExpiryDate, vrm_trm, certificateNumber, IF(@prev <> vrm_trm, @rn:=0,@rn) AS row_number_over_partition, @prev:=vrm_trm, @rn:=@rn+1 AS rn
FROM evl_view
) as SubQ
WHERE row_number_over_partition = 0
`;
const EVL_QUERY = `SELECT testExpiryDate, vrm_trm, certificateNumber FROM evl_view`;

const EVL_VRM_QUERY = `${EVL_QUERY} AND vrm_trm = ?;`;

Expand Down
1 change: 0 additions & 1 deletion src/infrastructure/databaseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default class DatabaseService implements DatabaseServiceInterface {
port: dbConnectionDetails.port,
database: process.env.SCHEMA_NAME,
multipleStatements: true,
charset: 'utf8mb4',
});
}

Expand Down

0 comments on commit bc52f5d

Please sign in to comment.