38 lines
879 B
JavaScript
38 lines
879 B
JavaScript
import { sequelize } from '../../utils/sequelize.js';
|
|
import { DataTypes } from 'sequelize';
|
|
import User from './user.js';
|
|
import UserParamType from '../type/user_param.js';
|
|
|
|
const UserParam = sequelize.define('user_param', {
|
|
userId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
references: {
|
|
model: User,
|
|
key: 'id'
|
|
}
|
|
},
|
|
paramTypeId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
references: {
|
|
model: UserParamType,
|
|
key: 'id'
|
|
},
|
|
|
|
},
|
|
value: {
|
|
type: DataTypes.STRING,
|
|
allowNull: false
|
|
}
|
|
}, {
|
|
tableName: 'user_param',
|
|
schema: 'community',
|
|
underscored: true
|
|
});
|
|
|
|
UserParam.belongsTo(User, { foreignKey: 'userId' });
|
|
UserParam.belongsTo(UserParamType, { foreignKey: 'param_type_id' });
|
|
|
|
export default UserParam;
|