Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e28c8fa

Browse files
authoredJun 16, 2021
Merge pull request #28 from topcoder-platform/develop
June 16 deploy
2 parents b5f2eb9 + caf8a59 commit e28c8fa

File tree

5 files changed

+10
-51
lines changed

5 files changed

+10
-51
lines changed
 

‎build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ KAFKA_CLIENT_CERT_KEY=$(eval "echo \$${ENV}_KAFKA_CLIENT_CERT_KEY")
2828
KAFKA_URL=$(eval "echo \$${ENV}_KAFKA_URL")
2929
ZOO_KEEPER=$(eval "echo \$${ENV}_ZOO_KEEPER")
3030
TOPIC=$(eval "echo \$${ENV}_TOPIC")
31-
MONGODB_URI=$(eval "echo \$${ENV}_MONGODB_URI")
3231

3332
LOG_LEVEL=$(eval "echo \$${ENV}_LOG_LEVEL")
3433
NODE_ENV=$(eval "echo \$${ENV}_NODE_ENV")

‎config/default.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ module.exports = {
2525
}
2626
},
2727
DYNAMODB: {
28-
// AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID || '',
29-
// AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY || '',
28+
AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID || '',
29+
AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY || '',
3030
AWS_REGION: process.env.AWS_REGION || '',
31-
IS_LOCAL: process.env.IS_LOCAL === 'true' || 'false'
31+
IS_LOCAL: process.env.IS_LOCAL || 'false'
3232
}
3333
};

‎models/Project.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,7 @@ const schema = new Schema({
2121
title: {type: String, required: true},
2222
tcDirectId: {
2323
type: Number,
24-
required: true,
25-
index: {
26-
global: true,
27-
rangeKey: 'id',
28-
project: true,
29-
name: 'TcDirectIdIndex'
30-
}
24+
required: true
3125
},
3226
repoUrl: {type: String, required: true},
3327
repoId: {type: String, required: false},

‎models/index.js

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,16 @@
1313
const config = require('config');
1414
const dynamoose = require('dynamoose');
1515

16-
17-
const awsConfigs = config.DYNAMODB.IS_LOCAL_DB ? {
16+
dynamoose.AWS.config.update({
1817
accessKeyId: config.DYNAMODB.AWS_ACCESS_KEY_ID,
1918
secretAccessKey: config.DYNAMODB.AWS_SECRET_ACCESS_KEY,
2019
region: config.DYNAMODB.AWS_REGION
21-
} : {
22-
region: config.DYNAMODB.AWS_REGION
23-
};
24-
25-
dynamoose.AWS.config.update(awsConfigs);
20+
});
2621

27-
if (config.DYNAMODB.IS_LOCAL_DB) {
28-
dynamoose.local(config.DYNAMODB.DYNAMODB_URL);
22+
if (config.DYNAMODB.IS_LOCAL === 'true') {
23+
dynamoose.local();
2924
}
3025

31-
// dynamoose.AWS.config.update({
32-
// // accessKeyId: config.DYNAMODB.AWS_ACCESS_KEY_ID,
33-
// // secretAccessKey: config.DYNAMODB.AWS_SECRET_ACCESS_KEY,
34-
// region: config.DYNAMODB.AWS_REGION
35-
// });
36-
37-
// if (config.DYNAMODB.IS_LOCAL === 'true') {
38-
// dynamoose.local();
39-
// }
40-
4126
dynamoose.setDefaults({
4227
create: false,
4328
update: false

‎utils/db-helper.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,6 @@ async function scan(model, scanParams) {
2626
});
2727
}
2828

29-
/**
30-
* Get single data by scan parameters
31-
* @param {Object} model The dynamoose model to scan
32-
* @param {Object} scanParams The scan parameters object
33-
* @returns {Promise<void>}
34-
*/
35-
async function scanOne(model, scanParams) {
36-
return await new Promise((resolve, reject) => {
37-
model.scan(scanParams).consistent().all().exec((err, result) => {
38-
if (err) {
39-
reject(err);
40-
}
41-
42-
return resolve(result[0]);
43-
});
44-
});
45-
}
46-
4729
module.exports = {
48-
scan,
49-
scanOne
50-
};
30+
scan
31+
};

0 commit comments

Comments
 (0)
This repository has been archived.