Files
yourpart3/backend/models/falukant/data/weather.js
Torsten Schulz (local) 956418f5f3 Enhance weather model and service logic; improve money history translation handling
- 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.
2025-12-02 14:05:25 +01:00

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;