This commit is contained in:
Filip Rojek 2024-04-29 20:19:04 +02:00
parent c34d052e50
commit 97dc6d222a

View File

@ -1,37 +1,32 @@
import { Schema, model } from 'mongoose'
import path from 'path'
import {DataTypes} from Sequelize;
import sequelize from '../config/database'
const schema = new Schema<any>(
{
export default = sequelize.define(path.basename(__filename).split('.')[0], {
name: {
type: String,
required: true
type: DataTypes.STRING,
allowNull: false
},
degree: {
type: Number,
required: true,
type: DataTypes.INTEGER,
allowNull: false
},
percentage: {
type: Number,
required: true
type: DataTypes.INTEGER,
allowNull: false
},
packaging: {
type: Number,
required: true
type: DataTypes.INTEGER,
allowNull: false
},
note: {
type: String,
required: false
type: DataTypes.STRING,
allowNull: true
},
photo: {
type: Array,
required: false,
type: DataTypes.ARRAY(DataTypes.STRING), // Assuming photo is an array of strings
allowNull: true
}
},
{
}, {
timestamps: true,
},
)
export default model(path.basename(__filename).split('.')[0], schema)
// Other model options here
});