diff --git a/server/routes/metadata.js b/server/routes/metadata.js index 2912144..bd44014 100644 --- a/server/routes/metadata.js +++ b/server/routes/metadata.js @@ -3,16 +3,25 @@ const config = require('../../shared/config/src/main.js')(); module.exports = async function metadata(fastify) { fastify.get('/api/metadata/', async function (req, res) { - const first_date = await pool.query('SELECT * FROM currency ORDER BY date LIMIT 1'); - const last_date = await pool.query('SELECT * FROM currency ORDER BY date DESC LIMIT 1'); - + const first_date = await pool.query( + 'SELECT * FROM currency ORDER BY date LIMIT 1', + ); + const last_date = await pool.query( + 'SELECT * FROM currency ORDER BY date DESC LIMIT 1', + ); + return res.status(200).send({ - 'first_date': first_date.rows[0]?.date ? first_date.rows[0]?.date : 'None', - 'last_date': last_date.rows[0]?.date ? last_date.rows[0]?.date : 'None', - 'currencies': { - 'crypto': config['currency']['crypto'], - 'fiat': config['currency']['fiat'], - } - }) + timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, + first_date: first_date.rows[0]?.date + ? first_date.rows[0]?.date + : 'None', + last_date: last_date.rows[0]?.date + ? last_date.rows[0]?.date + : 'None', + currencies: { + crypto: config['currency']['crypto'], + fiat: config['currency']['fiat'], + }, + }); }); -} +};