Commit c7af3456 authored by Devinda's avatar Devinda

update question create function

parent cc6ec4b4
module.exports = {
mongoURI: 'mongodb+srv://admin:admin@cluster0.wmb3b.mongodb.net/SmartCoach?retryWrites=true&w=majority',
};
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const ImageSchema = new Schema({
caption: {
required: true,
type: String,
},
lessonname: {
required: true,
type: String,
},
lessonno: {
required: true,
type: String,
},
filename: {
required: true,
type: String,
},
fileId: {
required: true,
type: String,
},
createdAt: {
default: Date.now(),
type: Date,
},
});
const Image = mongoose.model('Image', ImageSchema);
module.exports = Image;
\ No newline at end of file
......@@ -4,10 +4,10 @@ const Schema = mongoose.Schema;
let Question = new Schema({
question_id: mongoose.Schema.Types.ObjectId,
category:{
type:String
lesson_no:{
type:Number
},
name:{
lesson_name:{
type:String
},
question_text:{
......@@ -17,10 +17,7 @@ let Question = new Schema({
type:String
},
defult_mark:{
type: Number
},
q_type:{
type: String
type:Number
},
time_createdby:{
type: Date
......
......@@ -4,6 +4,15 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/body-parser": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.1.tgz",
"integrity": "sha512-a6bTJ21vFOGIkwM0kzh9Yr89ziVxq4vYH2fQ6N8AeipEzai/cFK6aGMArIkUeIdRIgpwQa+2bXiLuUJCpSf2Cg==",
"requires": {
"@types/connect": "*",
"@types/node": "*"
}
},
"@types/bson": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.3.tgz",
......@@ -12,6 +21,40 @@
"@types/node": "*"
}
},
"@types/connect": {
"version": "3.4.35",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
"integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==",
"requires": {
"@types/node": "*"
}
},
"@types/express": {
"version": "4.17.13",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz",
"integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==",
"requires": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "^4.17.18",
"@types/qs": "*",
"@types/serve-static": "*"
}
},
"@types/express-serve-static-core": {
"version": "4.17.24",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.24.tgz",
"integrity": "sha512-3UJuW+Qxhzwjq3xhwXm2onQcFHn76frIYVbTu+kn24LFxI+dEhdfISDFovPB8VpEgW8oQCTpRuCe+0zJxB7NEA==",
"requires": {
"@types/node": "*",
"@types/qs": "*",
"@types/range-parser": "*"
}
},
"@types/mime": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz",
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
},
"@types/mongodb": {
"version": "3.6.18",
"resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.18.tgz",
......@@ -21,11 +64,46 @@
"@types/node": "*"
}
},
"@types/multer": {
"version": "1.4.7",
"resolved": "https://registry.npmjs.org/@types/multer/-/multer-1.4.7.tgz",
"integrity": "sha512-/SNsDidUFCvqqcWDwxv2feww/yqhNeTRL5CVoL3jU4Goc4kKEL10T7Eye65ZqPNi4HRx8sAEX59pV1aEH7drNA==",
"requires": {
"@types/express": "*"
}
},
"@types/node": {
"version": "15.12.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.4.tgz",
"integrity": "sha512-zrNj1+yqYF4WskCMOHwN+w9iuD12+dGm0rQ35HLl9/Ouuq52cEtd0CH9qMgrdNmi5ejC1/V7vKEXYubB+65DkA=="
},
"@types/pump": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/pump/-/pump-1.1.1.tgz",
"integrity": "sha512-wpRerjHDxFBQ4r8XNv3xHJZeuqrBBoeQ/fhgkooV2F7KsPIYRROb/+f9ODgZfOEyO5/w2ej4YQdpPPXipT8DAA==",
"requires": {
"@types/node": "*"
}
},
"@types/qs": {
"version": "6.9.7",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw=="
},
"@types/range-parser": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz",
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
},
"@types/serve-static": {
"version": "1.13.10",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz",
"integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==",
"requires": {
"@types/mime": "^1",
"@types/node": "*"
}
},
"accepts": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
......@@ -35,11 +113,24 @@
"negotiator": "0.6.2"
}
},
"append-field": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz",
"integrity": "sha1-HjRA6RXwsSA9I3SOeO3XubW0PlY="
},
"array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"basic-auth": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
"integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
"requires": {
"safe-buffer": "5.1.2"
}
},
"bl": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz",
......@@ -76,11 +167,59 @@
"resolved": "https://registry.npmjs.org/bson/-/bson-1.1.6.tgz",
"integrity": "sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg=="
},
"buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
},
"busboy": {
"version": "0.2.14",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz",
"integrity": "sha1-bCpiLvz0fFe7vh4qnDetNseSVFM=",
"requires": {
"dicer": "0.2.5",
"readable-stream": "1.1.x"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
},
"readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
}
}
},
"bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
},
"concat-stream": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"requires": {
"buffer-from": "^1.0.0",
"inherits": "^2.0.3",
"readable-stream": "^2.2.2",
"typedarray": "^0.0.6"
}
},
"content-disposition": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
......@@ -99,6 +238,15 @@
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
"integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg=="
},
"cookie-parser": {
"version": "1.4.5",
"resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.5.tgz",
"integrity": "sha512-f13bPUj/gG/5mDr+xLmSxxDsB9DQiTIfhJS/sqjrmfAWiAN+x2O4i/XguTL9yDZ+/IFDanJ+5x7hC4CXT9Tdzw==",
"requires": {
"cookie": "0.4.0",
"cookie-signature": "1.0.6"
}
},
"cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
......@@ -141,6 +289,38 @@
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"dicer": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz",
"integrity": "sha1-WZbAhrszIYyBLAkL3cCc0S+stw8=",
"requires": {
"readable-stream": "1.1.x",
"streamsearch": "0.1.2"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
},
"readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
}
}
},
"dotenv": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
......@@ -156,6 +336,14 @@
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
"end-of-stream": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
"requires": {
"once": "^1.4.0"
}
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
......@@ -227,6 +415,11 @@
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"has-own-prop": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-own-prop/-/has-own-prop-2.0.0.tgz",
"integrity": "sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ=="
},
"http-errors": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
......@@ -257,6 +450,16 @@
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="
},
"is-generator": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/is-generator/-/is-generator-1.0.3.tgz",
"integrity": "sha1-wUwhBX7TbjKNuANHlmxpP4hjifM="
},
"is-promise": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
......@@ -267,6 +470,11 @@
"resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.2.tgz",
"integrity": "sha512-STHz9P7X2L4Kwn72fA4rGyqyXdmrMSdxqHx9IXon/FXluXieaFA6KJ2upcHAHxQPQ0LeM/OjLrhFxifHewOALQ=="
},
"lodash.isplainobject": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
"integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs="
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
......@@ -283,6 +491,27 @@
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
},
"method-override": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/method-override/-/method-override-3.0.0.tgz",
"integrity": "sha512-IJ2NNN/mSl9w3kzWB92rcdHpz+HjkxhDJWNDBqSlas+zQdP8wBiJzITPg08M/k2uVvMow7Sk41atndNtt/PHSA==",
"requires": {
"debug": "3.1.0",
"methods": "~1.1.2",
"parseurl": "~1.3.2",
"vary": "~1.1.2"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
}
}
},
"methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
......@@ -306,6 +535,19 @@
"mime-db": "1.48.0"
}
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "^1.2.5"
}
},
"mongodb": {
"version": "3.6.8",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.8.tgz",
......@@ -319,6 +561,11 @@
"saslprep": "^1.0.0"
}
},
"mongodb-uri": {
"version": "0.9.7",
"resolved": "https://registry.npmjs.org/mongodb-uri/-/mongodb-uri-0.9.7.tgz",
"integrity": "sha1-D3ca0W9IOuZfQoeWlCjp+8SqYYE="
},
"mongoose": {
"version": "5.12.15",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.15.tgz",
......@@ -355,6 +602,25 @@
"resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz",
"integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ=="
},
"morgan": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
"integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==",
"requires": {
"basic-auth": "~2.0.1",
"debug": "2.6.9",
"depd": "~2.0.0",
"on-finished": "~2.3.0",
"on-headers": "~1.0.2"
},
"dependencies": {
"depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="
}
}
},
"mpath": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.3.tgz",
......@@ -387,6 +653,39 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"multer": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/multer/-/multer-1.4.3.tgz",
"integrity": "sha512-np0YLKncuZoTzufbkM6wEKp68EhWJXcU6fq6QqrSwkckd2LlMgd1UqhUJLj6NS/5sZ8dE8LYDWslsltJznnXlg==",
"requires": {
"append-field": "^1.0.0",
"busboy": "^0.2.11",
"concat-stream": "^1.5.2",
"mkdirp": "^0.5.4",
"object-assign": "^4.1.1",
"on-finished": "^2.3.0",
"type-is": "^1.6.4",
"xtend": "^4.0.0"
}
},
"multer-gridfs-storage": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/multer-gridfs-storage/-/multer-gridfs-storage-5.0.1.tgz",
"integrity": "sha512-1mdt+HYk+K9FQ8qXZG6nQ4zEeeaZ8ngqv179iaBJDxCnWz4zsxU90KdyYKRlqlDm0/p4jxO43mW8UDE1HlTLog==",
"requires": {
"@types/express": "^4.17.6",
"@types/mongodb": "^3.5.25",
"@types/multer": "^1.4.3",
"@types/pump": "^1.1.0",
"has-own-prop": "^2.0.0",
"is-generator": "^1.0.3",
"is-promise": "^4.0.0",
"lodash.isplainobject": ">=0.8.0",
"mongodb": ">=2",
"mongodb-uri": "^0.9.7",
"pump": "^3.0.0"
}
},
"negotiator": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
......@@ -411,6 +710,19 @@
"ee-first": "1.1.1"
}
},
"on-headers": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
"integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA=="
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"requires": {
"wrappy": "1"
}
},
"optional-require": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.3.tgz",
......@@ -440,6 +752,15 @@
"ipaddr.js": "1.9.1"
}
},
"pump": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
"requires": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
}
},
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
......@@ -566,6 +887,11 @@
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"streamsearch": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz",
"integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo="
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
......@@ -588,6 +914,11 @@
"mime-types": "~2.1.24"
}
},
"typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
......@@ -607,6 +938,16 @@
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
}
}
}
......@@ -10,10 +10,15 @@
"author": "",
"license": "ISC",
"dependencies": {
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"mongoose": "^5.12.15"
"method-override": "^3.0.0",
"mongoose": "^5.12.15",
"morgan": "^1.10.0",
"multer": "^1.4.3",
"multer-gridfs-storage": "^5.0.1"
},
"devDependencies": {
"nodemailer": "^6.6.2"
......
const express = require('express');
const imageRouter = express.Router();
const mongoose = require('mongoose');
const Image = require('../models/pdf.model');
const config = require('../config');
module.exports = (upload) => {
const url = config.mongoURI;
const connect = mongoose.createConnection(url, {useNewUrlParser: true, useUnifiedTopology: true});
let gfs;
connect.once('open', () => {
// initialize stream
gfs = new mongoose.mongo.GridFSBucket(connect.db, {
bucketName: "uploads"
});
});
/*
POST: Upload a single image/file to Image collection
*/
imageRouter.route('/')
.post(upload.single('file'), (req, res, next) => {
console.log(req.body);
// check for existing images
Image.findOne({caption: req.body.caption})
.then((image) => {
console.log(image);
if (image) {
return res.status(200).json({
success: false,
message: 'Image already exists',
});
}
let newImage = new Image({
lessonname: req.body.lessonname,
lessonno: req.body.lessonno,
caption: req.body.caption,
filename: req.file.filename,
fileId: req.file.id,
});
newImage.save()
.then((image) => {
res.status(200).json({
success: true,
image,
});
})
.catch(err => res.status(500).json(err));
})
.catch(err => res.status(500).json(err));
})
.get((req, res, next) => {
Image.find({})
.then(images => {
res.status(200).json({
success: true,
images,
});
})
.catch(err => res.status(500).json(err));
});
/*
GET: Delete an image from the collection
*/
imageRouter.route('/delete/:id')
.get((req, res, next) => {
Image.findOne({_id: req.params.id})
.then((image) => {
if (image) {
Image.deleteOne({_id: req.params.id})
.then(() => {
return res.status(200).json({
success: true,
message: `File with ID: ${req.params.id} deleted`,
});
})
.catch(err => {
return res.status(500).json(err)
});
} else {
res.status(200).json({
success: false,
message: `File with ID: ${req.params.id} not found`,
});
}
})
.catch(err => res.status(500).json(err));
});
/*
GET: Fetch most recently added record
*/
imageRouter.route('/recent')
.get((req, res, next) => {
Image.findOne({}, {}, {sort: {'_id': -1}})
.then((image) => {
res.status(200).json({
success: true,
image,
});
})
.catch(err => res.status(500).json(err));
});
/*
POST: Upload multiple files upto 3
*/
imageRouter.route('/multiple')
.post(upload.array('file', 3), (req, res, next) => {
res.status(200).json({
success: true,
message: `${req.files.length} files uploaded successfully`,
});
});
/*
GET: Fetches all the files in the uploads collection
*/
imageRouter.route('/')
.get((req, res, next) => {
gfs.find().toArray((err, files) => {
if (!files || files.length === 0) {
return res.status(200).json({
success: false,
message: 'No files available'
});
}
files.map(file => {
if (file.contentType === 'image/jpeg' || file.contentType === 'image/png' || file.contentType === 'image/svg') {
file.isImage = true;
} else {
file.isImage = false;
}
});
res.status(200).json({
success: true,
files,
});
});
});
/*
GET: Fetches a particular file by filename
*/
imageRouter.route('/file/:filename')
.get((req, res, next) => {
gfs.find({ filename: req.params.filename }).toArray((err, files) => {
if (!files[0] || files.length === 0) {
return res.status(200).json({
success: false,
message: 'No files available',
});
}
res.status(200).json({
success: true,
file: files[0],
});
});
});
/*
GET: Fetches a particular image and render on browser
*/
imageRouter.route('/image/:filename')
.get((req, res, next) => {
gfs.find({ filename: req.params.filename }).toArray((err, files) => {
if (!files[0] || files.length === 0) {
return res.status(200).json({
success: false,
message: 'No files available',
});
}
if (files[0].contentType === 'image/jpeg' || files[0].contentType === 'image/png' || files[0].contentType === 'image/svg+xml') {
// render image to browser
gfs.openDownloadStreamByName(req.params.filename).pipe(res);
} else {
res.status(404).json({
err: 'Not an image',
});
}
});
});
/*
GET: Fetches a particular PDF and render on browser
*/
imageRouter.route('/pdf/:filename')
.get((req, res, next) => {
gfs.find({ filename: req.params.filename }).toArray((err, files) => {
if (!files[0] || files.length === 0) {
return res.status(200).json({
success: false,
message: 'No files available',
});
}
if (files[0].contentType === 'application/pdf' || files[0].contentType === 'application/vnd.ms-powerpoint'|| files[0].contentType === 'application/vnd.openxmlformats-officedocument.presentationml.presentation') {
// render PDF to browser
gfs.openDownloadStreamByName(req.params.filename).pipe(res);
} else {
res.status(404).json({
err: 'Not a PDF',
});
}
});
});
/*
DELETE: Delete a particular file by an ID
*/
imageRouter.route('/file/del/:id')
.post((req, res, next) => {
console.log(req.params.id);
gfs.delete(new mongoose.Types.ObjectId(req.params.id), (err, data) => {
if (err) {
return res.status(404).json({ err: err });
}
res.status(200).json({
success: true,
message: `File with ID ${req.params.id} is deleted`,
});
});
});
return imageRouter;
};
\ No newline at end of file
......@@ -32,43 +32,20 @@ questionRouter.route('/questionId/:id').get(function (req, res) {
questionRouter.route('/add').post(function(req, res) {
const question = new Question({
question_id: new mongoose.Types.ObjectId(),
category : req.body.category,
name : req.body.name,
lesson_no : req.body.lesson_no,
lesson_name : req.body.lesson_name,
question_text: req.body.question_text,
question_answer:req.body.question_answer,
defult_mark: req.body.defult_mark,
q_type: req.body.q_type,
time_createdby: req.body.time_createdby,
time_modifiedby: req.body.time_modifiedby,
general_feedback: req.body.general_feedback
});
question
.save()
.then(result => {
res.json(result);
console.log(result);
res.status(201).json({
message: "Created product successfully",
createdProduct: {
category: result.category,
name: result.name,
question_text: result.question_text,
defult_mark: result.defult_mark,
q_type: result.q_type,
time_createdby: req.body.time_createdby,
time_modifiedby: req.body.time_modifiedby,
general_feedback: req.body.general_feedback,
question_id: result.question_id,
request: {
type: 'GET',
url: "http://localhost:5000/questions/" + result._id
}
}
});
})
.catch(err => {
console.log(err);
res.status(500).json({error: err});
question.save().then(question =>{
res.json('Item update!');
})
.catch(err =>{
res.status(400).send("Update not possible");
});
});
......@@ -77,8 +54,8 @@ questionRouter.route('/update/:id').post((req, res) => {
if(!question)
req.status(404).send("data is not found");
else {
question.category = req.body.category;
question.name = req.body.name;
question.lesson_no = req.body.lesson_no;
question.lesson_name = req.body.lesson_name;
question.question_text = req.body.question_text;
question.question_answer = req.body.question_answer;
question.defult_mark = req.body.defult_mark;
......@@ -96,7 +73,14 @@ questionRouter.route('/update/:id').post((req, res) => {
});
});
questionRouter.route('/lessonNo/:id').get(function (req, res) {
console.log("Product Item ID");
console.log(req.params.id);
let id = req.params.id;
Question.find({"lesson_no" : id}, function (err, product) {
res.json(product);
});
});
questionRouter.route('/delete/:id').delete((req, res) => {
Question.findByIdAndDelete(req.params.id)
......
const createError = require('http-errors');
const express = require('express');
const path = require('path');
const cookieParser = require('cookie-parser');
const logger = require('morgan');
const methodOverride = require('method-override');
const config = require('./config');
const multer = require('multer');
const {GridFsStorage} = require('multer-gridfs-storage');
const crypto = require('crypto');
const cors = require('cors');
const bodyParser = require('body-parser');
const mongoose =require('mongoose');
......@@ -6,22 +15,65 @@ require('dotenv').config();
const app = express();
const port = process.env.PORT || 5000;
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cors());
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(cors({
origin: '*',
}));
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(methodOverride('_method'));
app.use(express.static(path.join(__dirname, 'public')));
mongoose.Promise = require('bluebird');
const uri = process.env.ATLAS_URI;
mongoose.connect(uri,{useNewUrlParser:true, useUnifiedTopology: true, useCreateIndex:true, useFindAndModify: false });
const url = config.mongoURI;
const connect = mongoose.connect(url, { useNewUrlParser:true, useUnifiedTopology: true, useCreateIndex:true, useFindAndModify: false });
const connection = mongoose.connection;
connection.once('open',() => {
console.log("MongoDB database connection established successfully");
}).catch(err => {
console.error('App starting error:', err.stack);
process.exit(1);
connect.then(() => {
console.log('Connected to database: GridApp');
}, (err) => console.log(err));
// create storage engine
const storage = new GridFsStorage({
url: config.mongoURI,
file: (req, file) => {
return new Promise((resolve, reject) => {
crypto.randomBytes(16, (err, buf) => {
if (err) {
return reject(err);
}
const filename = buf.toString('hex') + path.extname(file.originalname);
const fileInfo = {
filename: filename,
bucketName: 'uploads'
};
resolve(fileInfo);
});
});
}
});
const upload = multer({ storage });
// const connection = mongoose.connection;
// connection.once('open',() => {
// console.log("MongoDB database connection established successfully");
// }).catch(err => {
// console.error('App starting error:', err.stack);
// process.exit(1);
// });
const studentRouter = require('./routes/student.route');
const tutorRouter = require('./routes/tutor.route');
const instituteRouter = require('./routes/institute.route');
......@@ -29,6 +81,7 @@ const userAccount = require('./routes/userAccount.route');
const questionManage = require('./routes/question.route');
const financeRouter = require('./routes/finance.route');
const studentResult = require('./routes/studentALResult.route');
const imageRouter = require('./routes/pdf.route');
app.use('/studentSingUp',studentRouter);
app.use('/tutorSingUp',tutorRouter);
......@@ -37,7 +90,8 @@ app.use('/userAccount',userAccount);
app.use('/questions', questionManage);
app.use('/admin/finance', financeRouter);
app.use('/studentResults', studentResult);
app.use('/', imageRouter(upload));
app.listen(port, () => {
console.log(`Server is running on Port: ${port}`);
});
\ No newline at end of file
});
......@@ -11,7 +11,9 @@
<link rel="stylesheet" href="DashboardAssets/css/dashboard.css">
<link rel="stylesheet" href="DashboardAssets/css/custom.css">
<!-- fa fa icons cdn -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.7/css/all.css">
</head>
<body>
......
......@@ -14,8 +14,9 @@ import Dashboard from "./Components/Admin/Dashboard";
import StudentDashboard from "./Components/Student/StudentDashboard";
import QuestionDetails from "./Components/IT18050240/question_details"
import QuestionLayout from "./Components/IT18050240/question_layout"
//import AdminQuestionManagement from "./Components/IT18050240/admin_question_management.js"
import AdminQuestionManagement from "./Components/IT18050240/admin_question_management.js"
import QuestionBank from "./Components/IT18050240/question_bank"
import LessonAndExam from "./Components/IT18050240/lessonandexampage";
function App() {
return (
......@@ -35,10 +36,11 @@ function App() {
<Route path="/admin"><Dashboard/></Route>
<Route path="/studentDashboard"><StudentDashboard/></Route>
<Route path="/questiondetails" exact component={QuestionDetails}/>
<Route path="/question" exact component={QuestionLayout}/>
{/*<Route path="/questionmanagement" exact component={AdminQuestionManagement}/>*/}
<Route path="/question/:id" exact component={QuestionLayout}/>
<Route path="/questionmanagement/:id" exact component={AdminQuestionManagement}/>
<Route path="/questionbank" exact component={QuestionBank}/>
{/*<Route path="/edititem/:id" exact component={AdminQuestionManagement}/>*/}
<Route path="/questionmanagement" exact component={AdminQuestionManagement}/>
<Route path="/lesson" exact component={LessonAndExam}/>
</Switch>
......
......@@ -9,16 +9,11 @@ export default class AdminUI extends Component {
constructor(props){
super(props);
var today = new Date(),
time = today.getFullYear() + '-' + ("0" + (today.getMonth() + 1)).slice(-2) + '-' + today.getDate() +'T'+today.getHours() + ':' + today.getMinutes() + ':' + today.getSeconds()+'Z';
this.onChangeCategory = this.onChangeCategory.bind(this);
this.onChangeName = this.onChangeName.bind(this);
this.onChangeLessonNo = this.onChangeLessonNo.bind(this);
this.onChangeLessonName = this.onChangeLessonName.bind(this);
this.onChangeQuestionText = this.onChangeQuestionText.bind(this);
this.onChangeQuestionAnswer = this.onChangeQuestionAnswer.bind(this);
this.onChangeDefultMark = this.onChangeDefultMark.bind(this);
this.onChangeQType = this.onChangeQType.bind(this);
this.onChangeGeneralFeedback = this.onChangeGeneralFeedback.bind(this);
this.addQuestion = this.addQuestion.bind(this);
......@@ -26,31 +21,30 @@ export default class AdminUI extends Component {
this.state = {
question_id : '',
category : '',
name : '',
lesson_no : '',
lesson_name : '',
question_text : '',
question_answer : '',
defult_mark : '',
q_type : '',
general_feedback : '',
submitStatus : false,
currentTime: time,
currentTime: Date.now(),
editItem : false
}
}
onChangeCategory(e){
onChangeLessonNo(e){
this.setState({
category :e.target.value
lesson_no :e.target.value
});
}
onChangeName(e){
onChangeLessonName(e){
this.setState({
name :e.target.value
lesson_name :e.target.value
});
}
......@@ -99,11 +93,11 @@ export default class AdminUI extends Component {
const newQuestion = {
category : this.state.category,
name : this.state.name,
lesson_no : this.state.lesson_no,
lesson_name : this.state.lesson_name,
question_text : this.state.question_text,
question_answer : this.state.question_answer,
defult_mark : this.state.defult_mark,
q_type : this.state.q_type,
time_createdby: this.state.currentTime,
time_modifiedby: this.state.currentTime,
general_feedback : this.state.general_feedback,
......@@ -117,14 +111,6 @@ export default class AdminUI extends Component {
);
swal("Data Saved Successfully!", "Your Details has been Saved Successfully!", "success");
// this.setState({
// nextStep : true
// });
// } else{
// alert("You must fill in all of the fields.");
// }
// window.location = 'https://senosafrontend.herokuapp.com/admin/itemlist';
}
......@@ -133,8 +119,8 @@ export default class AdminUI extends Component {
axios.get('http://localhost:5000/questions/'+ this.props.match.params.id)
.then(response =>{
this.setState({
category : response.data.category,
name : response.data.name,
lesson_no : response.data.lesson_no,
lesson_name : response.data.lesson_name,
question_text : response.data.question_text,
question_answer : response.data.question_answer,
defult_mark : response.data.defult_mark,
......@@ -161,7 +147,7 @@ export default class AdminUI extends Component {
editQuestion(e){
e.preventDefault();
//if(this.state.item_name != null && this.state.item_description != null && this.state.item_category != null && this.state.item_quantity != null && this.state.item_price){
if(this.props.match.params.id != null){
console.log(`Form Update submitted:`);
console.log(`Category: ${this.state.category}`);
console.log(`Name: ${this.state.name}`);
......@@ -171,14 +157,13 @@ export default class AdminUI extends Component {
console.log(`Genaral Feedback: ${this.state.general_feedback}`);
const editQuestion = {
category : this.state.category,
name : this.state.name,
question_text : this.state.question_text,
question_answer : this.state.question_answer,
defult_mark : this.state.defult_mark,
q_type : this.state.q_type,
time_modifiedby: this.state.currentTime,
general_feedback : this.state.general_feedback,
lesson_no : this.state.lesson_no,
lesson_name : this.state.lesson_name,
question_text : this.state.question_text,
question_answer : this.state.question_answer,
defult_mark : this.state.defult_mark,
time_modifiedby: this.state.currentTime,
general_feedback : this.state.general_feedback,
};
// axios.post('https://senosaonlineshoppingwebsite.herokuapp.com/products/update/'+this.props.match.params.id,editItem)
......@@ -195,7 +180,7 @@ export default class AdminUI extends Component {
// }else{
// alert("You must fill in all of the fields.");
// }
}
}}
render(){
return(
......@@ -226,11 +211,17 @@ export default class AdminUI extends Component {
<div className="row">
<div className="col-sm-5">
<label>Category: </label>
<label>Lesson No: </label>
<div style={{padding: '0px'}}>
<select style={{width: '100%'}} className="browser-default custom-select"
onChange={(e) => this.onChangeCategory(e)}>
<option>Select Category</option>
onChange={(e) => this.onChangeLessonNo(e)}>
<option>Select Lesson No</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
......@@ -241,8 +232,8 @@ export default class AdminUI extends Component {
<div style={{padding: '0px'}}>
<input type="text" required
className="form-control"
value ={this.state.name}
onChange={this.onChangeName}
value ={this.state.lesson_name}
onChange={this.onChangeLessonName}
/>
</div>
......@@ -275,7 +266,7 @@ export default class AdminUI extends Component {
<div className="row">
<div className="col-sm-5">
<div className="col-sm-10">
<label>Default mark: </label>
<input type="text"
className="form-control"
......@@ -283,14 +274,6 @@ export default class AdminUI extends Component {
onChange = {this.onChangeDefultMark}
/>
</div>
<div className="col-sm-5">
<label>Question type: </label>
<input type="text"
className="form-control"
value ={this.state.q_type}
onChange = {this.onChangeQType}
/>
</div>
</div>
......@@ -321,17 +304,14 @@ export default class AdminUI extends Component {
<div className="row">
<div className="col-sm-4">
</div>
<div className="col-sm- mt-3">
<Link style={{textDecoration:"none"}} to={"/admin/itemlist"}><button className="btn btn-block btn-warning" style={{width:"159px" , color:"white"}}>BACK</button></Link>
<div className="col-sm-5">
<Link style={{textDecoration:"none"}} to={"/admin/itemlist"}><button className="btn btn-block btn-warning" style={{color:"white"}}>BACK</button></Link>
</div>
<div className="col-sm-4">
<button style={{marginTop:10}} type ="submit" value ="Submit"
<div className="col-sm-5">
<button type ="submit" value ="Submit"
className = {this.state.submitStatus
? "btn btn-block btn-success mt-3"
: "btn btn-block btn-primary mt-3"}
? "btn btn-block btn-success"
: "btn btn-block btn-primary"}
> {this.state.submitStatus ? "EDIT" : "ADD"}
</button>
</div>
......
import React, {Component} from 'react';
import axios from 'axios';
import {Link} from "react-router-dom";
import EX from '../../Images/exam.png';
import LS from '../../Images/lesson.png';
export default class LessonAndExam extends Component {
constructor(props) {
super(props);
this.state = {
lessonList:[]
}
}
componentDidMount = () => {
let quizLessonTemp = []
axios.get('http://localhost:5000/')
.then(response => {
this.setState({ lessonList: response.data.images });
console.log(this.state.lessonList.length)
})
.catch(err => alert(err));
}
render(){
return(
<div className="container">
<div className="p-3 mb-2 bg-light text-dark text-left">Accounting Lecture</div>
<div className="text-left ml-3">
<p>First lab session will be started from 10/02/2021 at 4.00pm</p>
</div>
{this.state.lessonList.map((file) => (
<div className="">
<div className="p-3 mb-2 bg-light text-dark text-left">Accounting Lecture {file.lessonno}</div>
<div className="text-left ml-3">
<p>First lab session will be started from 10/02/2021 at 4.00pm</p>
</div>
<div className="row">
<div className="col-1">
<div style={{padding: '0px'}}>
<img src={EX} alt="upload-image" style={{width:'35px'}}/>
<hr/>
<img src={LS} alt="upload-image" style={{width:'35px'}}/>
</div>
</div>
<div style={{padding: '0px'}}>
<a href={'http://localhost:5000/pdf/'+ file.filename}><p style={{marginTop: '7px'}}>{file.lessonname}</p></a>
<br/>
<a href={'/question/'+ file.lessonno}><p style={{marginTop: '7px'}}>Exam {file.lessonno}</p></a>
</div>
</div>
</div>
))
}
</div>
)
}
}
\ No newline at end of file
......@@ -6,13 +6,12 @@ import swal from 'sweetalert';
const Quantity = props => (
<tr>
{/*<td>{props.quantity.item_id}</td>*/}
<td>{props.quantity.question_text}</td>
<td>{props.quantity.question_answer}</td>
<td>{props.quantity.time_modifiedby}</td>
<td>{props.questions.lesson_name}</td>
<td>{props.questions.question_text}</td>
<td>{props.questions.question_answer}</td>
<td>
<div>
<Link className="mx-1 text-success fas fa-pen text-decoration-none" to={"/edititem/"+props.quantity._id}></Link> <span className=" mx-1 text-danger fas fa-trash" href='#' onClick={()=>{props.deleteProduct(props.quantity._id)}} ></span>
<Link className="text-success fas fa-edit" to={"/questionmanagement/"+props.questions._id}></Link> <span className=" mx-1 text-danger fas fa-trash" href='#' onClick={()=>{props.deleteProduct(props.questions._id)}} ></span>
</div>
</td>
</tr>
......@@ -29,13 +28,13 @@ export default class QuestionBankUI extends Component {
this.state = {
q_type: '',
quantity: []
questions: []
}
}
quantityList() {
return this.state.quantity.map(currentTodo => {
return <Quantity quantity={currentTodo} deleteProduct={this.deleteProduct} key={currentTodo._id} />
return this.state.questions.map(currentTodo => {
return <Quantity questions={currentTodo} deleteProduct={this.deleteProduct} key={currentTodo._id} />
});
}
......@@ -43,7 +42,7 @@ export default class QuestionBankUI extends Component {
axios.get('http://localhost:5000/questions/')
.then(response => {
this.setState({ quantity: response.data });
this.setState({ questions: response.data });
})
.catch(function (error) {
console.log(error);
......@@ -56,7 +55,7 @@ export default class QuestionBankUI extends Component {
axios.get('http://localhost:5000/questions/')
.then(response => {
this.setState({ quantity: response.data });
this.setState({ questions: response.data });
})
.catch(function (error) {
console.log(error);
......@@ -88,7 +87,7 @@ export default class QuestionBankUI extends Component {
axios.delete('http://localhost:5000/questions/delete/'+pid)
.then(res => console.log(res.data));
this.setState({
quantity:this.state.quantity.filter(el => el.pid !==pid)
questions:this.state.questions.filter(el => el.pid !==pid)
});
}
......@@ -144,9 +143,9 @@ export default class QuestionBankUI extends Component {
<table className="table" >
<thead>
<tr>
<th><h6>Question Text</h6></th>
<th><h6>Question Answer</h6></th>
<th><h6>Last modified by</h6></th>
<th><h6>Lesson</h6></th>
<th><h6>Question</h6></th>
<th><h6>Answer</h6></th>
<th className="col-sm-1"><h6>Action </h6></th>
</tr>
</thead>
......
......@@ -99,7 +99,7 @@ export default class QuestionLayout extends Component {
// if (this.state.item_id != null) {
axios.get('http://localhost:5000/questions/')
axios.get('http://localhost:5000/questions/lessonNo/1')
.then(response => {
//this.setState({productQuantities: response.data});
let CategoryList = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment