import { sequelize } from '../../utils/sequelize.js'; import { DataTypes } from 'sequelize'; import UserParamVisibilityType from '../type/user_param_visibility.js'; const Image = sequelize.define('image', { title: { type: DataTypes.STRING, allowNull: false, }, description: { type: DataTypes.TEXT, allowNull: true, }, originalFileName: { type: DataTypes.STRING, allowNull: false, }, hash: { type: DataTypes.STRING, allowNull: false, unique: true, }, folderId: { type: DataTypes.INTEGER, allowNull: false, references: { model: 'folder', key: 'id', }, }, userId: { type: DataTypes.INTEGER, allowNull: false, references: { model: 'user', key: 'id', }, }, visibilityType: { type: DataTypes.INTEGER, allowNull: false, references: { model: UserParamVisibilityType, key: 'id', }, }, }, { tableName: 'image', schema: 'community', underscored: true, timestamps: true, }); export default Image;