Commit 839f6f4e authored by antoine masson's avatar antoine masson
Browse files

Merge branch 'Development' into production

parents fbd66ebd bef40218
......@@ -530,6 +530,11 @@ exports.getSurveyInfo= async (req, res) => {
try {
const survey = await Survey.findById(req.userData.survey_id);
const poc = await survey.poc
if (!poc) {
return res
.status(400)
.json({ message: "Contact user is not defined" ,status: "Error"});
}
let surveygeneral = survey.general;
let languages = []
......
......@@ -180,7 +180,11 @@ exports.loginToken = async (req, res) => {
try {
const token = await Token.findOne({ token:req.body.token });
const gopt = await GlobalOptions.findById(0,{poc:1});
if (!gopt) {
return res
.status(400)
.json({ message: "Global user is not defined" ,status: "Error"});
}
if (!token) {
return res
.status(201)
......@@ -221,6 +225,11 @@ exports.accessToken = async (req, res) => {
try{
const survey = await Survey.findById(req.body.survey_id)
let spoc= await survey.poc
if (!spoc) {
return res
.status(400)
.json({ message: "Global user is not defined" ,status: "Error"});
}
let token = await Token.findOne({ token:req.body.token });
if(!survey.status && (!token || !token.test)){
return res
......
......@@ -250,7 +250,12 @@ SurveySchema.virtual('poc').get(async function() {
let poc = this.general.poc
if (this.general.poc.useglobal){
const opt = await GlobalOptions.findById(0,{poc:1});
if(opt&&opt.poc){
poc = opt.poc;
} else {
poc = null
}
}
return poc
});
......
{
"name": "api",
"version": "1.0.0",
"version": "1.1.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "1.0.0",
"version": "1.1.1",
"dependencies": {
"bcrypt": "^5.0.0",
"body-parser": "^1.19.0",
"compression": "^1.7.4",
"cookie-parser": "~1.4.4",
"cors": "^2.8.5",
"debug": "~2.6.9",
......@@ -651,6 +652,42 @@
"node": ">= 6"
}
},
"node_modules/compressible": {
"version": "2.0.18",
"resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz",
"integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==",
"dependencies": {
"mime-db": ">= 1.43.0 < 2"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/compression": {
"version": "1.7.4",
"resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz",
"integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==",
"dependencies": {
"accepts": "~1.3.5",
"bytes": "3.0.0",
"compressible": "~2.0.16",
"debug": "2.6.9",
"on-headers": "~1.0.2",
"safe-buffer": "5.1.2",
"vary": "~1.1.2"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/compression/node_modules/bytes": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
"integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
......@@ -3496,6 +3533,35 @@
"readable-stream": "^2.3.6"
}
},
"compressible": {
"version": "2.0.18",
"resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz",
"integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==",
"requires": {
"mime-db": ">= 1.43.0 < 2"
}
},
"compression": {
"version": "1.7.4",
"resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz",
"integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==",
"requires": {
"accepts": "~1.3.5",
"bytes": "3.0.0",
"compressible": "~2.0.16",
"debug": "2.6.9",
"on-headers": "~1.0.2",
"safe-buffer": "5.1.2",
"vary": "~1.1.2"
},
"dependencies": {
"bytes": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
"integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg="
}
}
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
......
{
"name": "api",
"version": "1.1.0",
"version": "1.1.2",
"description": "",
"main": "index.js",
"scripts": {
......
Supports Markdown
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