mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 04:33:11 +03:00
feat: Removed function with adding +1 to date when issuing currency rate
This commit is contained in:
parent
d704f958e3
commit
0b4544520b
1 changed files with 0 additions and 27 deletions
|
@ -1,14 +1,6 @@
|
|||
const pool = require('./postgresql.js');
|
||||
const logger = require('../../logger/src/main.js');
|
||||
|
||||
/**
|
||||
* Getting the currency exchange rate for a specific day
|
||||
* @param from_currency {String}
|
||||
* @param conv_currency {String}
|
||||
* @param date
|
||||
* @returns {Promise<*|Error>}
|
||||
*/
|
||||
|
||||
async function getDay(from_currency, conv_currency, date) {
|
||||
if (!from_currency || !conv_currency)
|
||||
return new Error('fromCurrency and convCurrency are required');
|
||||
|
@ -22,25 +14,11 @@ async function getDay(from_currency, conv_currency, date) {
|
|||
|
||||
if (data?.['rows'].length <= 0) return 'Missing data';
|
||||
|
||||
const set_date = data['rows'][0]['date'];
|
||||
data['rows'][0]['date'] = new Date(
|
||||
set_date.setDate(set_date.getDate() + 1),
|
||||
);
|
||||
|
||||
logger.debug(data['rows'][0]);
|
||||
|
||||
return data['rows'][0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting the exchange rate for a certain period
|
||||
* @param {String} from_currency - The currency that is being converted
|
||||
* @param {String} conv_currency - The currency to be converted into
|
||||
* @param {String} start_date - Start date of the period
|
||||
* @param {String} end_date - End date of the period
|
||||
* @returns {Promise<*|Error>}
|
||||
*/
|
||||
|
||||
async function getPeriod(from_currency, conv_currency, start_date, end_date) {
|
||||
if (!from_currency || !conv_currency)
|
||||
return new Error('from_currency and conv_currency are required');
|
||||
|
@ -60,11 +38,6 @@ async function getPeriod(from_currency, conv_currency, start_date, end_date) {
|
|||
|
||||
if (data?.['rows'].length <= 0) return 'Missing data';
|
||||
|
||||
for (let i = 0; i < data['rows'].length; i++) {
|
||||
let date = data['rows'][i]['date'];
|
||||
date = new Date(date.setDate(date.getDate() + 1));
|
||||
}
|
||||
|
||||
logger.debug(data['rows']);
|
||||
|
||||
return data['rows'];
|
||||
|
|
Loading…
Add table
Reference in a new issue