const { DataTypes } = require('sequelize'); const { sequelize } = require('../config/database'); const ClubFeature = sequelize.define('ClubFeature', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, autoIncrement: true }, clubId: { type: DataTypes.INTEGER.UNSIGNED, allowNull: false, references: { model: 'Clubs', key: 'id' } }, featureId: { type: DataTypes.INTEGER.UNSIGNED, allowNull: false, references: { model: 'Features', key: 'id' } }, enabled: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: true }, expiryDate: { type: DataTypes.DATE, allowNull: true }, createdAt: { type: DataTypes.DATE, allowNull: false }, updatedAt: { type: DataTypes.DATE, allowNull: false } }, { tableName: 'ClubFeatures', timestamps: true }); ClubFeature.associate = (models) => { ClubFeature.belongsTo(models.Club, { foreignKey: 'clubId' }); ClubFeature.belongsTo(models.Feature, { foreignKey: 'featureId' }); }; module.exports = ClubFeature;