박기홍

job db updated

No preview for this file type
......@@ -15,10 +15,6 @@ const jobSchema = new schema({
type: String,
default: "대분류를 입력하세요",
},
middle:{
type: String,
default: "중분류를 입력하세요",
},
low:{
type: String,
default: "소분류를 입력하세요",
......
......@@ -7,7 +7,7 @@ const questionSchema = new schema({
* 번호 질문내용 답1 답2 가중치1, 가중치2
*/
questionNum:{
num:{
type: Number,
default: -1
},
......@@ -23,27 +23,27 @@ const questionSchema = new schema({
type: String,
default: "아니다"
},
fit: {
fight: {
type: Number,
default: 0,
},
dtl: {
detail: {
type: Number,
default: 0,
},
trf: {
traffic: {
type: Number,
default: 0,
},
ctr: {
control: {
type: Number,
default: 0,
},
sup: {
support: {
type: Number,
default: 0,
},
act: {
activity: {
type: Number,
default: 0,
},
......
......@@ -71,15 +71,34 @@ module.exports = function(app)
app.post('/addJobs', async(req, res, next) => {
// 보직 추가하는 api
const datas = req.body;
});
app.post('/addQuestions', async(req, res, next) => {
// 질문 추가하는 api
const datas = req.body;
console.log(datas);
console.log(typeof(datas));
for(let i=0; i<datas.length; i++){
const data = new Question();
data.num = datas[i].num;
data.question = datas[i].question;
data.answer1 = datas[i].answer1;
data.answer2 = datas[i].answer2;
data.fight = datas[i].fight;
data.detail = datas[i].detail;
data.traffic = datas[i].traffic;
data.control = datas[i].control;
data.support = datas[i].support;
data.activity = datas[i].activity;
console.log(data);
await data.save();
}
});
}
\ No newline at end of file
......