Files
yourpart3/backend/models/falukant/log/dayproduction.js
Torsten Schulz (local) 4cc2aace6b
All checks were successful
Deploy to production / deploy (push) Successful in 1m51s
feat(DayProduction, FalukantService, VocabLessonView): enhance vocabulary training and production tracking
- Added a new `completionCount` field to the DayProduction model to track the number of completed productions.
- Updated the FalukantService to aggregate completed productions using the new `completionCount` field, improving accuracy in production statistics.
- Introduced new vocabulary training features in VocabLessonView, including options to mark vocabulary as difficult and track remaining hard vocabulary, enhancing user engagement and learning effectiveness.
- Updated localization files for German and English to support new vocabulary training features, ensuring a consistent user experience across languages.
2026-04-21 15:44:44 +02:00

47 lines
1.2 KiB
JavaScript

import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class DayProduction extends Model { }
DayProduction.init({
regionId: {
type: DataTypes.INTEGER,
allowNull: false},
productId: {
type: DataTypes.INTEGER,
allowNull: false},
quantity: {
type: DataTypes.INTEGER,
allowNull: false},
producerId: {
type: DataTypes.INTEGER,
allowNull: false},
productionTimestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_TIMESTAMP')},
productionDate: {
type: DataTypes.DATEONLY,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_DATE')},
completionCount: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1}
}, {
sequelize,
modelName: 'DayProduction',
tableName: 'production',
schema: 'falukant_log',
timestamps: false,
underscored: true,
indexes: [
{
unique: true,
fields: ['producer_id', 'product_id', 'region_id', 'production_date']
}
]
});
export default DayProduction;