Сделал в некоторых местах JSDocs

This commit is contained in:
Данил 2024-08-04 13:55:37 +03:00
parent d36f9a67f3
commit 74947f0409
4 changed files with 40 additions and 6 deletions

View file

@ -1,5 +1,14 @@
const pool = require('./postgresql.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');
else if (!date) return new Error('date is required')
@ -16,6 +25,15 @@ async function getDay(from_currency, conv_currency, date) {
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');
else if(!start_date || !end_date) return new Error('start_date and end_date are required')