Files
yourpart3/backend/models/falukant/data/product_knowledge.js
Torsten Schulz (local) 1ab9407e79
All checks were successful
Deploy to production / deploy (push) Successful in 2m56s
Refactor code structure for improved readability and maintainability; optimize performance across multiple modules.
2026-07-21 09:08:15 +02:00

32 lines
734 B
JavaScript
Executable File

import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class Knowledge extends Model { }
Knowledge.init({
productId: {
type: DataTypes.INTEGER,
allowNull: false},
characterId: {
type: DataTypes.INTEGER,
allowNull: false},
knowledge: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0}
}, {
sequelize,
modelName: 'Knowledge',
tableName: 'knowledge',
schema: 'falukant_data',
timestamps: false,
underscored: true,
hooks: {
beforeCreate: (knowledge) => {
knowledge.knowledge = Math.floor(Math.random() * 61) + 20;
}
}
});
export default Knowledge;