insertintosite_data(name,data)values('UNDER_CONSTRUCTION_TEXT','NGSplanner.com is currently under construction! Please check back after Sig yells at me enough to help finish it.');
insertintosite_data(name,data)values('UNDER_CONSTRUCTION_TEXT','NGSplanner.com is currently under construction! Please check back after Sig yells at me enough to help finish it.');
insertintosite_data(name,data)values('h1','To please the soul');
if(Number.isNaN(Number(req.body[field]))){returnfield+"=(select id from "+field.replace("_id","")+" where name=$"+(i+1)+")"}else{returnfield+"=$"+(i+1)}
if(Number.isNaN(Number(req.body[field]))){returnfield+"=(select id from "+field.replace("_id","")+" where name=$"+(i+1)+")"}else{returnfield+"=$"+(i+1)}
}}).join(",")+' where name=$'+(all_filled_fields.length+1)+' returning *',[...all_filled_fields.map((field)=>req.body[field]),req.body["name"]])
}}).join(",")+' where name=$'+(all_filled_fields.length+1)+' returning *',[...all_filled_fields.map((field)=>typeofreq.body[field]==='string'?req.body[field].trim():req.body[field]),req.body["name"]])
.then((data)=>{
.then((data)=>{
if(data.rows.length===0){
if(data.rows.length===0){
requiresInsert=true
requiresInsert=true
@ -447,7 +447,7 @@ function CreateDynamicEndpoints() {
db.query('insert into '+endpoint.endpoint+"("+all_filled_fields.join(',')+") values("+all_filled_fields.map((field,i)=>{
db.query('insert into '+endpoint.endpoint+"("+all_filled_fields.join(',')+") values("+all_filled_fields.map((field,i)=>{
if(!field.includes("_id")){return"$"+(i+1)}else{
if(!field.includes("_id")){return"$"+(i+1)}else{
if(Number.isNaN(Number(req.body[field]))){return"(select id from "+field.replace("_id","")+" where name=$"+(i+1)+")"}else{return"$"+(i+1)}
if(Number.isNaN(Number(req.body[field]))){return"(select id from "+field.replace("_id","")+" where name=$"+(i+1)+")"}else{return"$"+(i+1)}
if(Number.isNaN(Number(req.body[field]))){returnfield+"=(select id from "+field.replace("_id","")+" where name=$"+(i+1)+")"}else{returnfield+"=$"+(i+1)}
if(Number.isNaN(Number(req.body[field]))){returnfield+"=(select id from "+field.replace("_id","")+" where name=$"+(i+1)+")"}else{returnfield+"=$"+(i+1)}
}}).join(",")+' where name=$'+(all_filled_fields.length+1)+' returning *',[...all_filled_fields.map((field)=>req.body[field]),req.body["name"]])
}}).join(",")+' where name=$'+(all_filled_fields.length+1)+' returning *',[...all_filled_fields.map((field)=>typeofreq.body[field]==='string'?req.body[field].trim():req.body[field]),req.body["name"]])
.then((data)=>{
.then((data)=>{
if(data.rows.length===0){
if(data.rows.length===0){
requiresInsert=true
requiresInsert=true
@ -494,7 +494,7 @@ function CreateDynamicEndpoints() {
db.query('insert into '+endpoint.endpoint+"("+all_filled_fields.join(',')+") values("+all_filled_fields.map((field,i)=>{
db.query('insert into '+endpoint.endpoint+"("+all_filled_fields.join(',')+") values("+all_filled_fields.map((field,i)=>{
if(!field.includes("_id")){return"$"+(i+1)}else{
if(!field.includes("_id")){return"$"+(i+1)}else{
if(Number.isNaN(Number(req.body[field]))){return"(select id from "+field.replace("_id","")+" where name=$"+(i+1)+")"}else{return"$"+(i+1)}
if(Number.isNaN(Number(req.body[field]))){return"(select id from "+field.replace("_id","")+" where name=$"+(i+1)+")"}else{return"$"+(i+1)}
returndb.query('update '+endpoint.endpoint+' set '+all_filled_fields.map((field,i)=>field+"=$"+(i+1)).join(",")+" where id=$"+(all_filled_fields.length+1)+" returning *",[...all_filled_fields.map((field)=>req.body[field]),req.body.id])
returndb.query('update '+endpoint.endpoint+' set '+all_filled_fields.map((field,i)=>field+"=$"+(i+1)).join(",")+" where id=$"+(all_filled_fields.length+1)+" returning *",[...all_filled_fields.map((field)=>typeofreq.body[field]==='string'?req.body[field].trim():req.body[field]),req.body.id])
}else{
}else{
varmsg="Could not authenticate!";res.status(500).send(msg);throwmsg
varmsg="Could not authenticate!";res.status(500).send(msg);throwmsg
}
}
@ -540,7 +540,7 @@ function CreateDynamicEndpoints() {
awaitdb2.query('update '+endpoint.endpoint+' set '+all_filled_fields.map((field,i)=>field+"=$"+(i+1)).join(",")+' where name=$'+(all_filled_fields.length+1)+' returning *',[...all_filled_fields.map((field)=>req.body[field]),req.body["name"]])
awaitdb2.query('update '+endpoint.endpoint+' set '+all_filled_fields.map((field,i)=>field+"=$"+(i+1)).join(",")+' where name=$'+(all_filled_fields.length+1)+' returning *',[...all_filled_fields.map((field)=>typeofreq.body[field]==='string'?req.body[field].trim():req.body[field]),req.body["name"]])
.then((data)=>{
.then((data)=>{
if(data.rows.length===0){
if(data.rows.length===0){
requiresInsert=true
requiresInsert=true
@ -620,7 +620,7 @@ function CreateDynamicEndpoints() {
})
})
}
}
if(requiresInsert){
if(requiresInsert){
db2.query('insert into '+endpoint.endpoint+"("+all_filled_fields.join(',')+") values("+all_filled_fields.map((field,i)=>"$"+(i+1)).join(",")+") returning *",all_filled_fields.map((field)=>req.body[field]))
db2.query('insert into '+endpoint.endpoint+"("+all_filled_fields.join(',')+") values("+all_filled_fields.map((field,i)=>"$"+(i+1)).join(",")+") returning *",all_filled_fields.map((field)=>typeofreq.body[field]==='string'?req.body[field].trim():req.body[field]))
.then((data)=>{
.then((data)=>{
res.status(200).json(data.rows)
res.status(200).json(data.rows)
})
})
@ -636,14 +636,14 @@ function CreateDynamicEndpoints() {
returndb2.query('update '+endpoint.endpoint+' set '+all_filled_fields.map((field,i)=>field+"=$"+(i+1)).join(",")+" where id=$"+(all_filled_fields.length+1)+" returning *",[...all_filled_fields.map((field)=>req.body[field]),req.body.id])
returndb2.query('update '+endpoint.endpoint+' set '+all_filled_fields.map((field,i)=>field+"=$"+(i+1)).join(",")+" where id=$"+(all_filled_fields.length+1)+" returning *",[...all_filled_fields.map((field)=>typeofreq.body[field]==='string'?req.body[field].trim():req.body[field]),req.body.id])
}else{
}else{
varmsg="Could not authenticate!";res.status(500).send(msg);throwmsg
varmsg="Could not authenticate!";res.status(500).send(msg);throwmsg
}
}
@ -661,7 +661,7 @@ function CreateDynamicEndpoints() {