29801/backend/src/db/seeders/20231127130745-sample-data.js
2025-03-11 20:41:31 +00:00

90 lines
1.6 KiB
JavaScript

const db = require('../models');
const Users = db.users;
const Answers = db.answers;
const Questions = db.questions;
const AnswersData = [
{
answer_text: 'Cloud computing platform by Microsoft.',
is_correct: true,
},
{
answer_text: 'Virtual machines in the cloud.',
is_correct: true,
},
{
answer_text: 'Object storage solution.',
is_correct: true,
},
{
answer_text: 'Identity and access management service.',
is_correct: true,
},
];
const QuestionsData = [
{
question_text: "What is Azure's primary use?",
difficulty: 'hard',
// type code here for "relation_many" field
},
{
question_text: 'Define Azure Virtual Machines.',
difficulty: 'easy',
// type code here for "relation_many" field
},
{
question_text: 'Explain Azure Blob Storage.',
difficulty: 'medium',
// type code here for "relation_many" field
},
{
question_text: 'What is Azure Active Directory?',
difficulty: 'easy',
// type code here for "relation_many" field
},
];
// Similar logic for "relation_many"
// Similar logic for "relation_many"
module.exports = {
up: async (queryInterface, Sequelize) => {
await Answers.bulkCreate(AnswersData);
await Questions.bulkCreate(QuestionsData);
await Promise.all([
// Similar logic for "relation_many"
// Similar logic for "relation_many"
]);
},
down: async (queryInterface, Sequelize) => {
await queryInterface.bulkDelete('answers', null, {});
await queryInterface.bulkDelete('questions', null, {});
},
};