Skip to content

Commit cd1e202

Browse files
authored
Merge pull request #27 from imdhruvgupta/explanation
[CHANGE] added explanation column in questions
2 parents 6b51af5 + dfe78c8 commit cd1e202

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

framework/serializers/questions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = function (included = [], type, config) {
2424
}
2525

2626
const options = {
27-
attributes: ['title', 'description', 'difficulty' ,'user', 'choices', 'tags','createdBy'],
27+
attributes: ['title', 'description', 'explanation','difficulty' ,'user', 'choices', 'tags','createdBy'],
2828
meta: {
2929
pagination: function (record) {
3030
return record.pagination
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
module.exports = {
4+
async up (queryInterface, Sequelize){
5+
await queryInterface.addColumn(
6+
'questions',
7+
'explanation',
8+
{
9+
type: Sequelize.STRING,
10+
allowNull: true
11+
}
12+
)
13+
},
14+
15+
async down (queryInterface, Sequelize) {
16+
await queryInterface.removeColumn('questions', 'explanation');
17+
}
18+
};

models/questions.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ module.exports = (sequelize, DataTypes) => {
99
type: DataTypes.TEXT,
1010
allowNull: true
1111
},
12+
explanation: {
13+
type: DataTypes.TEXT,
14+
allowNull: true
15+
},
1216
difficulty: {
1317
type: DataTypes.INTEGER,
1418
allowNull: false,

0 commit comments

Comments
 (0)