mirror of
https://github.com/pawelmalak/flame.git
synced 2026-02-28 01:13:11 +08:00
Split remaining controllers into separate files. Added iOS homescreen icon. Removed additional logging from weather module.
This commit is contained in:
@@ -2,23 +2,28 @@ const { Op } = require('sequelize');
|
||||
const Weather = require('../models/Weather');
|
||||
const Logger = require('./Logger');
|
||||
const logger = new Logger();
|
||||
const loadConfig = require('./loadConfig');
|
||||
|
||||
const clearWeatherData = async () => {
|
||||
const { WEATHER_API_KEY: secret } = await loadConfig();
|
||||
|
||||
const weather = await Weather.findOne({
|
||||
order: [[ 'createdAt', 'DESC' ]]
|
||||
order: [['createdAt', 'DESC']],
|
||||
});
|
||||
|
||||
if (weather) {
|
||||
await Weather.destroy({
|
||||
where: {
|
||||
id: {
|
||||
[Op.lt]: weather.id
|
||||
}
|
||||
}
|
||||
})
|
||||
[Op.lt]: weather.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
logger.log('Old weather data was deleted');
|
||||
}
|
||||
if (secret) {
|
||||
logger.log('Old weather data was deleted');
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = clearWeatherData;
|
||||
module.exports = clearWeatherData;
|
||||
|
||||
Reference in New Issue
Block a user