Add description and icon fields to food table

master
sigonasr2 3 years ago
parent 8c396bdec2
commit 0b07386a2a
  1. 2
      ngsplanner_patch.sql
  2. 2
      ngsplanner_schema.sql
  3. 11
      ngsplanner_seed.sql
  4. 41
      server.js

@ -27,3 +27,5 @@ alter table class_skill_data alter column max_hp_decrease set data type text;
alter table class_skill_data alter column natural_pp_recovery set data type text;
alter table class_skill_data alter column pb_gauge_fortification set data type text;
alter table site_data rename column field to name;
alter table food add column description text;
alter table food add column icon text;

@ -14,6 +14,8 @@ CREATE TABLE "food_mult" (
CREATE TABLE "food" (
"id" SERIAL UNIQUE PRIMARY KEY,
"name" text,
"description" text,
"icon" text,
"potency" boolean,
"pp" boolean,
"dmg_res" boolean,

@ -1,4 +1,3 @@
delete from site_data;
delete from skill_tree_data;
delete from class_skill_data;
delete from class_skill;
@ -30,10 +29,10 @@ insert into food_mult(amount,potency,pp,dmg_res,hp,pp_consumption,pp_recovery,we
insert into food_mult(amount,potency,pp,dmg_res,hp,pp_consumption,pp_recovery,weak_point_dmg,hp_recovery)
values(1,1.05,10,1.05,1.05,1,1,1,1);
insert into food(name,potency,pp,dmg_res,hp,pp_consumption,pp_recovery,weak_point_dmg,hp_recovery,popularity,editors_choice)
values('Rich Aelio Meat',true,false,false,false,true,false,false,false,0,0);
insert into food(name,potency,pp,dmg_res,hp,pp_consumption,pp_recovery,weak_point_dmg,hp_recovery,popularity,editors_choice)
values('Light Aelio Meat',true,false,false,false,false,true,false,false,0,0);
insert into food(name,description,icon,potency,pp,dmg_res,hp,pp_consumption,pp_recovery,weak_point_dmg,hp_recovery,popularity,editors_choice)
values('Rich Aelio Meat','Meat','',true,false,false,false,true,false,false,false,0,0);
insert into food(name,description,icon,potency,pp,dmg_res,hp,pp_consumption,pp_recovery,weak_point_dmg,hp_recovery,popularity,editors_choice)
values('Light Aelio Meat','Meat','',true,false,false,false,false,true,false,false,0,0);
insert into class(name,icon) values('Hunter','/icons/UINGSClassHu.png');
insert into class(name,icon) values('Fighter','/icons/UINGSClassFi.png');
@ -281,5 +280,3 @@ insert into skill_tree_data(class_id,data,skill_data,line_color,line_width,grids
values((select id from class where name='Hunter'),'□ □ ,└□─┘□□, │ ││, │ □│, □─□┼□, □ ','','#000000',3,80,60,10,10,60);
insert into site_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.');
insert into site_data(name,data) values('h1','To please the soul');
insert into site_data(name,data) values('h2','');

@ -886,7 +886,10 @@ function submitBuild(req,res,db,send) {
return db.query('update builds set creator=$1,build_name=$2,class1=(SELECT id from class WHERE name=$3 limit 1),class2=(SELECT id from class WHERE name=$4 limit 1),last_modified=$5,data=$6 where id=$7 returning id',[req.body.creator,req.body.build_name,req.body.class1,req.body.class2,new Date(),req.body.data,req.body.id])
.then((data)=>{
if (send) {
res.status(200).send(data.rows[0])
res.status(200).json(data.rows[0])
}
if (db2) {
db2.query('update builds set creator=$1,build_name=$2,class1=(SELECT id from class WHERE name=$3 limit 1),class2=(SELECT id from class WHERE name=$4 limit 1),last_modified=$5,data=$6 where id=$7 returning id',[req.body.creator,req.body.build_name,req.body.class1,req.body.class2,new Date(),req.body.data,req.body.id])
}
})
.catch((err)=>{
@ -899,7 +902,10 @@ function submitBuild(req,res,db,send) {
return db.query('insert into builds(users_id,creator,build_name,class1,class2,created_on,last_modified,likes,data,editors_choice) values((SELECT id from users WHERE username=$1 limit 1),$2,$3,(SELECT id from class WHERE name=$4 limit 1),(SELECT id from class WHERE name=$5 limit 1),$6,$7,$8,$9,$10) returning id',[req.body.username,req.body.creator,req.body.build_name,req.body.class1,req.body.class2,new Date(),new Date(),0,req.body.data,0])
.then((data)=>{
if (send) {
res.status(200).send(data.rows[0])
res.status(200).json(data.rows[0])
}
if (db2) {
db2.query('insert into builds(users_id,creator,build_name,class1,class2,created_on,last_modified,likes,data,editors_choice,id) values((SELECT id from users WHERE username=$1 limit 1),$2,$3,(SELECT id from class WHERE name=$4 limit 1),(SELECT id from class WHERE name=$5 limit 1),$6,$7,$8,$9,$10,$11) returning id',[req.body.username,req.body.creator,req.body.build_name,req.body.class1,req.body.class2,new Date(),new Date(),0,req.body.data,0,data.rows[0].id])
}
})
.catch((err)=>{
@ -920,7 +926,10 @@ function submitBuild(req,res,db,send) {
db.query('insert into builds(users_id,creator,build_name,class1,class2,created_on,last_modified,likes,data,editors_choice) values((SELECT id from users WHERE username=$1 limit 1),$2,$3,(SELECT id from class WHERE name=$4 limit 1),(SELECT id from class WHERE name=$5 limit 1),$6,$7,$8,$9,$10) returning id',[req.body.username,req.body.creator,req.body.build_name,req.body.class1,req.body.class2,new Date(),new Date(),0,req.body.data,0])
.then((data)=>{
if (send) {
res.status(200).send(data.rows[0])
res.status(200).json(data.rows[0])
}
if (db2) {
db2.query('insert into builds(users_id,creator,build_name,class1,class2,created_on,last_modified,likes,data,editors_choice,id) values((SELECT id from users WHERE username=$1 limit 1),$2,$3,(SELECT id from class WHERE name=$4 limit 1),(SELECT id from class WHERE name=$5 limit 1),$6,$7,$8,$9,$10,$11) returning id',[req.body.username,req.body.creator,req.body.build_name,req.body.class1,req.body.class2,new Date(),new Date(),0,req.body.data,0,data.rows[0].id])
}
})
.catch((err)=>{
@ -934,16 +943,30 @@ function submitBuild(req,res,db,send) {
app.post(PREFIX+"/submitBuild",(req,res)=>{
submitBuild(req,res,db,true)
if (db2) {
submitBuild(req,res,db2,false)
}
})
app.post(PREFIX+"/test/submitBuild",(req,res)=>{
submitBuild(req,res,db,true)
if (db2) {
submitBuild(req,res,db2,false)
}
})
app.get(PREFIX+"/getBuild",(req,res)=>{
db.query('select * from builds where id=$1 limit 1',[req.query.id])
.then((data)=>{
res.status(200).json(data.rows[0])
})
.catch((err)=>{
res.status(500).send(err.message)
})
})
app.get(PREFIX+"/test/getBuild",(req,res)=>{
db2.query('select * from builds where id=$1 limit 1',[req.query.id])
.then((data)=>{
res.status(200).json(data.rows[0])
})
.catch((err)=>{
res.status(500).send(err.message)
})
})
//Generates our table schema:

Loading…
Cancel
Save