- Added primary key to the Weather model for better data integrity. - Updated FalukantService to include specific weather attributes in queries, enhancing data retrieval. - Refactored money history view to utilize a dedicated translation method for improved localization handling.
41 lines
815 B
JavaScript
41 lines
815 B
JavaScript
import { Model, DataTypes } from 'sequelize';
|
|
import { sequelize } from '../../../utils/sequelize.js';
|
|
import RegionData from './region.js';
|
|
import WeatherType from '../type/weather.js';
|
|
|
|
class Weather extends Model {}
|
|
|
|
Weather.init(
|
|
{
|
|
regionId: {
|
|
type: DataTypes.INTEGER,
|
|
primaryKey: true,
|
|
allowNull: false,
|
|
references: {
|
|
model: RegionData,
|
|
key: 'id',
|
|
schema: 'falukant_data'
|
|
}
|
|
},
|
|
weatherTypeId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
references: {
|
|
model: WeatherType,
|
|
key: 'id',
|
|
schema: 'falukant_type'
|
|
}
|
|
}
|
|
},
|
|
{
|
|
sequelize,
|
|
modelName: 'Weather',
|
|
tableName: 'weather',
|
|
schema: 'falukant_data',
|
|
timestamps: false,
|
|
underscored: true}
|
|
);
|
|
|
|
export default Weather;
|
|
|