eslint фикс

This commit is contained in:
Данил 2024-08-14 21:20:08 +03:00
parent bfccc5aac2
commit d7bcaf8c2e
8 changed files with 24 additions and 24 deletions

View file

@ -11,7 +11,7 @@ const logger = require('../../logger/src/main.js');
async function getDay(from_currency, conv_currency, date) {
if (!from_currency || !conv_currency) return new Error('fromCurrency and convCurrency are required');
else if (!date) return new Error('date is required')
else if (!date) return new Error('date is required');
const data = await pool.query('SELECT from_currency, conv_currency, date, rate FROM currency ' +
'WHERE from_currency = $1 AND conv_currency = $2 AND date = $3', [
@ -22,10 +22,10 @@ async function getDay(from_currency, conv_currency, date) {
if (!data) return new Error('Missing data');
let set_date = data['rows'][0]['date']
set_date = new Date(set_date.setDate(set_date.getDate() + 1));
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])
logger.debug(data['rows'][0]);
return data['rows'][0];
}
@ -41,7 +41,7 @@ async function getDay(from_currency, conv_currency, date) {
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');
else if(!start_date || !end_date) return new Error('start_date and end_date are required')
else if(!start_date || !end_date) return new Error('start_date and end_date are required');
const data = await pool.query('SELECT * FROM currency WHERE ' +
'(date BETWEEN $3 AND $4) AND from_currency = $1 AND conv_currency = $2 ORDER BY date', [
@ -54,11 +54,11 @@ async function getPeriod(from_currency, conv_currency, start_date, end_date) {
if (!data) return new Error('Missing data');
for (let i = 0; i < data['rows'].length; i++) {
let date = data['rows'][i]['date']
let date = data['rows'][i]['date'];
date = new Date(date.setDate(date.getDate() + 1));
}
logger.debug(data['rows'])
logger.debug(data['rows']);
return data['rows'];
}