我如何在评估表中插入与地图表名称中的问题表关联的多个问题,作为我的架构的评估_问题
const assessment=db.define('assessment',{
id:{type:Sequelize.INTEGER,primaryKey:true,autoIncrement:true},
name:{type:Sequelize.STRING},
description:{type:Sequelize.STRING},
time:{type:Sequelize.DATE},
prep_time:{type:Sequelize.DATE},
is_retry:{type:Sequelize.BOOLEAN},
is_video:{type:Sequelize.BOOLEAN},
created_at:{type:Sequelize.DATE},
updated_at:{type:Sequelize.DATE}
},
dbConfig.sequelize_settings
)
const question=db.define('question',{
id:{type:Sequelize.INTEGER,primaryKey:true,autoIncrement:true},
question:{type:Sequelize.STRING},
question_video:{type:Sequelize.STRING},
erpeat_question:{type:Sequelize.STRING},
repeat_question_video:{type:Sequelize.STRING},
created_at:{type:Sequelize.DATE},
updated_at:{type:Sequelize.DATE}
},
dbConfig.sequelize_settings
)
const assessment_question=db.define('assessment_question',{
id:{type:Sequelize.INTEGER,primaryKey:true,autoIncrement:true},
question_id:{type:Sequelize.INTEGER},
assessment_id:{type:Sequelize.INTEGER},
created_at:{type:Sequelize.DATE},
updated_at:{type:Sequelize.DATE}
},
dbConfig.sequelize_settings
)
assessment_question.belongsTo(question,{foreignKey:'question_id'})
dimension_question.belongsTo(dimension,{foreignKey:'dimension_id'})
而我的req.body
是{ name:"something",description:"any description",question:[1,3,4,5]}
问题是question_id的数组。如何创建包含多个问题的单个评估