Files
yourpart3/backend/models/falukant/data/production.js
Torsten Schulz (local) ba1a12402d Add product weather effects and regional pricing enhancements
- Introduced a new endpoint in FalukantController to retrieve product prices based on region and product ID.
- Implemented logic in FalukantService to calculate product prices considering user knowledge and regional factors.
- Added weather-related data models and associations to enhance product pricing accuracy based on weather conditions.
- Updated frontend components to cache and display regional product prices effectively, improving user experience.
2025-12-02 09:55:08 +01:00

40 lines
1.0 KiB
JavaScript

import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
import WeatherType from '../type/weather.js';
class Production extends Model { }
Production.init({
branchId: {
type: DataTypes.INTEGER,
allowNull: false},
productId: {
type: DataTypes.INTEGER,
allowNull: false},
quantity: {
type: DataTypes.INTEGER,
allowNull: false},
weatherTypeId: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: WeatherType,
key: 'id',
schema: 'falukant_type'
},
comment: 'Wetter zum Zeitpunkt der Produktionserstellung'
},
startTimestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_TIMESTAMP')}
}, {
sequelize,
modelName: 'Production',
tableName: 'production',
schema: 'falukant_data',
timestamps: false,
underscored: true});
export default Production;