Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = {
- friendlyName: 'Seed data',
- description: 'Seed questions and answers in database',
- inputs: {},
- fn: async function (inputs, exits) {
- sails.log('Starting question and answers seeder..');
- let seededQuestions = await Question.createEach(data.map(q => ({
- body: q.body
- }))).fetch();
- return exits.success(seededQuestions);
- }
- };
- const data = [{
- body: 'Which of the following statements is true?',
- answers: [{
- value: 'Python is a high level programming language.',
- isCorrect: false
- },
- {
- value: 'Python is an interpreted language.',
- isCorrect: false
- },
- {
- value: 'Python is an object-oriented language.',
- isCorrect: false
- },
- {
- value: 'All of the above.',
- isCorrect: true
- }
- ]
- }, {
- body: 'What is used to define a block of code (body of loop, function etc.) in Python?',
- answers: [{
- value: 'Curly braces',
- isCorrect: false
- },
- {
- value: 'Parenthesis',
- isCorrect: false
- },
- {
- value: 'Indentation',
- isCorrect: true
- },
- {
- value: 'Quotation',
- isCorrect: false
- }
- ]
- }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement