Unverified Commit 374c3cd2 authored by Kartheek Palla's avatar Kartheek Palla Committed by GitHub
Browse files

Merge pull request #268 from vaivk369/vk-4.7

issue #0 fix: get system level default config
Showing with 12 additions and 4 deletions
+12 -4
...@@ -47,35 +47,43 @@ async function read(req, response) { ...@@ -47,35 +47,43 @@ async function read(req, response) {
context_type: data.context_type, context_type: data.context_type,
status: data.status || 'Active' status: data.status || 'Active'
} }
console.log(query);
await model.formdata.findOne({ where: query }).then(async data => { await model.formdata.findOne({ where: query }).then(async data => {
if (!data) { if (!data) {
var temp = Object.assign({}, query, { channel: "*" }); var temp = Object.assign({}, query, { channel: "*" });
console.log(temp);
// find record by specified rootOrgId with channel = '*' // find record by specified rootOrgId with channel = '*'
await model.formdata.findOne({ where: temp }) return await model.formdata.findOne({ where: temp })
} else { } else {
return data; return data;
} }
}) })
.then(async data => { .then(async data => {
if (!data) { if (!data) {
var temp = Object.assign({}, query, { objecttype: "*" });
console.log(temp);
// get the default data // get the default data
return await model.formdata.findOne({ where: Object.assign({}, query, { objecttype: "*" })}) return await model.formdata.findOne({ where: temp })
} else { } else {
return data; return data;
} }
}) })
.then(async data => { .then(async data => {
if (!data) { if (!data) {
var temp = Object.assign({}, query, { channel: "*", objecttype: "*" });
console.log(temp);
// get the default data // get the default data
return await model.formdata.findOne({ where: Object.assign({}, query, { channel: "*", objecttype: "*" })}) return await model.formdata.findOne({ where: temp })
} else { } else {
return data; return data;
} }
}) })
.then(async data => { .then(async data => {
if (!data) { if (!data) {
var temp = Object.assign({}, query, { channel: "*", objecttype: "*", primarycategory: "*" });
console.log(temp);
// get the default data // get the default data
return await model.formdata.findOne({ where: Object.assign({}, query, { channel: "*", objecttype: "*", primarycategory: "*" })}) return await model.formdata.findOne({ where: temp })
} else { } else {
return data; return data;
} }
......
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