Skip to content

Commit

Permalink
fix: lint:fix applied
Browse files Browse the repository at this point in the history
  • Loading branch information
ZavenArra committed Oct 20, 2021
1 parent 18dc333 commit 9e61b7c
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 38 deletions.
23 changes: 12 additions & 11 deletions database/migrations/20211018163322-createContract.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict';

var dbm;
var type;
var seed;
var fs = require('fs');
var path = require('path');
var Promise;

let dbm;
let type;
let seed;
const fs = require('fs');
const path = require('path');

let Promise;

/**
* We receive the dbmigrate dependency from dbmigrate initially.
Expand All @@ -19,11 +20,11 @@ exports.setup = function(options, seedLink) {
};

exports.up = function(db) {
var filePath = path.join(__dirname, 'sqls', '20211018163322-createContract-up.sql');
const filePath = path.join(__dirname, 'sqls', '20211018163322-createContract-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);
console.log(`received data: ${ data}`);

resolve(data);
});
Expand All @@ -34,11 +35,11 @@ exports.up = function(db) {
};

exports.down = function(db) {
var filePath = path.join(__dirname, 'sqls', '20211018163322-createContract-down.sql');
const filePath = path.join(__dirname, 'sqls', '20211018163322-createContract-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);
console.log(`received data: ${ data}`);

resolve(data);
});
Expand Down
23 changes: 12 additions & 11 deletions database/migrations/20211018163418-createEarning.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict';

var dbm;
var type;
var seed;
var fs = require('fs');
var path = require('path');
var Promise;

let dbm;
let type;
let seed;
const fs = require('fs');
const path = require('path');

let Promise;

/**
* We receive the dbmigrate dependency from dbmigrate initially.
Expand All @@ -19,11 +20,11 @@ exports.setup = function(options, seedLink) {
};

exports.up = function(db) {
var filePath = path.join(__dirname, 'sqls', '20211018163418-createEarning-up.sql');
const filePath = path.join(__dirname, 'sqls', '20211018163418-createEarning-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);
console.log(`received data: ${ data}`);

resolve(data);
});
Expand All @@ -34,11 +35,11 @@ exports.up = function(db) {
};

exports.down = function(db) {
var filePath = path.join(__dirname, 'sqls', '20211018163418-createEarning-down.sql');
const filePath = path.join(__dirname, 'sqls', '20211018163418-createEarning-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);
console.log(`received data: ${ data}`);

resolve(data);
});
Expand Down
23 changes: 12 additions & 11 deletions database/migrations/20211018163620-alterCapture.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict';

var dbm;
var type;
var seed;
var fs = require('fs');
var path = require('path');
var Promise;

let dbm;
let type;
let seed;
const fs = require('fs');
const path = require('path');

let Promise;

/**
* We receive the dbmigrate dependency from dbmigrate initially.
Expand All @@ -19,11 +20,11 @@ exports.setup = function(options, seedLink) {
};

exports.up = function(db) {
var filePath = path.join(__dirname, 'sqls', '20211018163620-alterCapture-up.sql');
const filePath = path.join(__dirname, 'sqls', '20211018163620-alterCapture-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);
console.log(`received data: ${ data}`);

resolve(data);
});
Expand All @@ -34,11 +35,11 @@ exports.up = function(db) {
};

exports.down = function(db) {
var filePath = path.join(__dirname, 'sqls', '20211018163620-alterCapture-down.sql');
const filePath = path.join(__dirname, 'sqls', '20211018163620-alterCapture-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);
console.log(`received data: ${ data}`);

resolve(data);
});
Expand Down
2 changes: 1 addition & 1 deletion server/handlers/earningsHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const earningsBatchPatch = async (req, res, next) => {
throw new HttpError(406, 'Only text/csv is supported');

const key = `treetracker_earnings/${uuid()}.csv`;
let batch_id = uuid();
const batch_id = uuid();
const fileBuffer = await fs.readFile(req.file.path);
await upload_csv(fileBuffer, key);
const session = new Session();
Expand Down
6 changes: 3 additions & 3 deletions server/models/Earnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Earning = ({
batch_id,
}) => {
// make a call to the contract microservice and get the consolidation_rule
let consolidation_rule = 'mock value';
const consolidation_rule = 'mock value';
return Object.freeze({
worker_id,
funder_id,
Expand Down Expand Up @@ -93,7 +93,7 @@ const getEarnings =
filter = FilterCriteria({
...filterCriteria,
});
let queryObject = {
const queryObject = {
...QueryOptions({ ...filterCriteria }),
...filterCriteria,
};
Expand All @@ -103,7 +103,7 @@ const getEarnings =
delete queryObject.offset;

const query = Object.keys(queryObject)
.map((key) => key + '=' + queryObject[key])
.map((key) => `${key }=${ queryObject[key]}`)
.join('&');

const urlWithLimitAndOffset = `${url}?${query}&offset=`;
Expand Down
2 changes: 1 addition & 1 deletion server/services/aws.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const s3 = require('../services/s3');
const s3 = require("./s3");

const upload_csv = async (csv, Key) => {
const params = {
Expand Down
1 change: 1 addition & 0 deletions server/services/s3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const AWS = require('aws-sdk');

const s3 = new AWS.S3({
accessKeyId: process.env.ACCESS_KEY_ID,
secretAccessKey: process.env.SECRET_ACCESS_KEY,
Expand Down

0 comments on commit 9e61b7c

Please sign in to comment.