mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-19 03:29:37 +02:00
Created Cron job to get data from external api every 15 minutes and save it to local database. Created Weather model and controller to get latest weather status
This commit is contained in:
parent
3fc3d07598
commit
adc4aaed0f
8 changed files with 195 additions and 0 deletions
15
models/Weather.js
Normal file
15
models/Weather.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
const { DataTypes } = require('sequelize');
|
||||
const { sequelize } = require('../db');
|
||||
|
||||
const Weather = sequelize.define('Weather', {
|
||||
externalLastUpdate: DataTypes.STRING,
|
||||
tempC: DataTypes.FLOAT,
|
||||
tempF: DataTypes.FLOAT,
|
||||
isDay: DataTypes.INTEGER,
|
||||
conditionText: DataTypes.TEXT,
|
||||
conditionCode: DataTypes.INTEGER
|
||||
}, {
|
||||
freezeTableName: true
|
||||
});
|
||||
|
||||
module.exports = Weather;
|
Loading…
Add table
Add a link
Reference in a new issue