mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-19 03:29:37 +02:00
Split remaining controllers into separate files. Added iOS homescreen icon. Removed additional logging from weather module.
This commit is contained in:
parent
88694c7e27
commit
4ed29fe276
32 changed files with 418 additions and 312 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue