Skip to content

Commit

Permalink
fix(sandbox): fix sonar code smell
Browse files Browse the repository at this point in the history
fix sonar code smell

MIGRATION CHANGE:
migration-20221123082900- fix prettier issu

BREAKING CHANGE:
lerna bootstrap command will not be supported

GH-1673
  • Loading branch information
Surbhi-sharma1 committed Sep 26, 2023
1 parent 6a4d607 commit 86754cf
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 39 deletions.
1 change: 1 addition & 0 deletions sandbox/cache-example/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
dist/
coverage/
migrations/
.eslintrc.js
1 change: 1 addition & 0 deletions sandbox/oauth-example/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
dist/
coverage/
migrations/
.eslintrc.js
40 changes: 23 additions & 17 deletions sandbox/oauth-example/migrations/20221123082900-updated-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,52 @@ var path = require('path');
var Promise;

/**
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function(options, seedLink) {
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function (options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
Promise = options.Promise;
};

exports.up = function(db) {
var filePath = path.join(__dirname, 'sqls', '20221123082900-updated-init-up.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
exports.up = function (db) {
var filePath = path.join(
__dirname,
'sqls',
'20221123082900-updated-init-up.sql',
);
return new Promise(function (resolve, reject) {
fs.readFile(filePath, {encoding: 'utf-8'}, function (err, data) {
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
})
.then(function(data) {
}).then(function (data) {
return db.runSql(data);
});
};

exports.down = function(db) {
var filePath = path.join(__dirname, 'sqls', '20221123082900-updated-init-down.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
exports.down = function (db) {
var filePath = path.join(
__dirname,
'sqls',
'20221123082900-updated-init-down.sql',
);
return new Promise(function (resolve, reject) {
fs.readFile(filePath, {encoding: 'utf-8'}, function (err, data) {
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
})
.then(function(data) {
}).then(function (data) {
return db.runSql(data);
});
};

exports._meta = {
"version": 1
version: 1,
};
4 changes: 1 addition & 3 deletions sandbox/oauth-example/src/repositories/user.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ export class UserRepository extends DefaultSoftCrudRepository<
if (!user || user.deleted) {
throw new HttpErrors.Unauthorized(AuthenticateErrorKeys.UserDoesNotExist);
} else if (
// eslint-disable-next-line
!creds ||
!creds.password ||
!creds?.password ||
creds.authProvider !== AuthProvider.INTERNAL ||
!(await bcrypt.compare(password, creds.password))
) {
Expand Down
1 change: 1 addition & 0 deletions sandbox/payment-example/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
dist/
coverage/
migrations/
.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules/
dist/
coverage/
migration/
cdk/
.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"synth": "cdktf synth",
"compile": "tsc --pretty",
"watch": "tsc -w",
"test": "jest",
"test": "echo 'No Tests'",
"test:watch": "jest --watch --coverage",
"test:snapshot": "jest --updateSnapshot",
"upgrade": "npm i cdktf@latest cdktf-cli@latest",
Expand Down
10 changes: 4 additions & 6 deletions sandbox/telemed-app/backend/authentication-service/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ const {
SecretsManagerClient,
GetSecretValueCommand,
} = require('@aws-sdk/client-secrets-manager');
// eslint-disable-next-line @typescript-eslint/naming-convention
const secret_name = 'telemed-app-service-authentication';
const secretName = 'telemed-app-service-authentication';
const client = new SecretsManagerClient({
region: 'us-east-1',
});
// eslint-disable-next-line @typescript-eslint/naming-convention
export interface secretEnv {
export interface SecretEnv {
DB_HOST: string;
DB_PORT: string;
DB_USER: string;
Expand All @@ -19,15 +17,15 @@ export interface secretEnv {
ENV: string;
}

let secret: secretEnv;
let secret: SecretEnv;

export async function getSecretValue() {
let response;
// eslint-disable-next-line
try {
response = await client.send(
new GetSecretValueCommand({
SecretId: secret_name,
SecretId: secretName,
VersionStage: 'AWSCURRENT', // VersionStage defaults to AWSCURRENT if unspecified
}),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules/
dist/
coverage/
migration/
cdk/
.eslintrc.js
10 changes: 4 additions & 6 deletions sandbox/telemed-app/backend/notification-service/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ const {
SecretsManagerClient,
GetSecretValueCommand,
} = require('@aws-sdk/client-secrets-manager');
// eslint-disable-next-line @typescript-eslint/naming-convention
const secret_name = 'telemed-app-service-notification';
const secretName = 'telemed-app-service-notification';
const client = new SecretsManagerClient({
region: 'us-east-1',
});
// eslint-disable-next-line @typescript-eslint/naming-convention
export interface secretEnv {
export interface SecretEnv {
DB_HOST: string;
DB_PORT: string;
DB_USER: string;
Expand All @@ -19,15 +17,15 @@ export interface secretEnv {
ENV: string;
}

let secret: secretEnv;
let secret: SecretEnv;

export async function getSecretValue() {
let response;
// eslint-disable-next-line
try {
response = await client.send(
new GetSecretValueCommand({
SecretId: secret_name,
SecretId: secretName,
VersionStage: 'AWSCURRENT', // VersionStage defaults to AWSCURRENT if unspecified
}),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules/
dist/
coverage/
cdk/
migration/
.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ const {
SecretsManagerClient,
GetSecretValueCommand,
} = require('@aws-sdk/client-secrets-manager');
// eslint-disable-next-line @typescript-eslint/naming-convention
const secret_name = 'telemed-app-service-video-conferencing';
const secretName = 'telemed-app-service-video-conferencing';
const client = new SecretsManagerClient({
region: 'us-east-1',
});
// eslint-disable-next-line @typescript-eslint/naming-convention
export interface secretEnv {
export interface SecretEnv {
DB_HOST: string;
DB_PORT: string;
DB_USER: string;
Expand All @@ -19,15 +17,15 @@ export interface secretEnv {
ENV: string;
}

let secret: secretEnv;
let secret: SecretEnv;

export async function getSecretValue() {
let response;
// eslint-disable-next-line
try {
response = await client.send(
new GetSecretValueCommand({
SecretId: secret_name,
SecretId: secretName,
VersionStage: 'AWSCURRENT', // VersionStage defaults to AWSCURRENT if unspecified
}),
);
Expand Down

0 comments on commit 86754cf

Please sign in to comment.