From 58d3dc87f848d07de50527ca4045fc169e8f3918 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Wed, 28 Jul 2021 09:53:40 -0500 Subject: [PATCH] Implement new schema --- ngsplanner_schema.sql | 36 ++++--- ngsplanner_seed.sql | 212 +++++++++++++++++++++--------------------- server.js | 22 ++--- 3 files changed, 141 insertions(+), 129 deletions(-) diff --git a/ngsplanner_schema.sql b/ngsplanner_schema.sql index 217edaa..bfc7b40 100644 --- a/ngsplanner_schema.sql +++ b/ngsplanner_schema.sql @@ -21,7 +21,9 @@ CREATE TABLE "food" ( "pp_consumption" boolean, "pp_recovery" boolean, "weak_point_dmg" boolean, - "hp_recovery" boolean + "hp_recovery" boolean, + "popularity" int, + "editors_choice" int ); CREATE TABLE "class" ( @@ -121,13 +123,15 @@ CREATE TABLE "armor" ( "poison_res" float, "battle_power_value" int, "pb_gauge_build" float, - "icon" text + "icon" text, + "popularity" int, + "editors_choice" int ); CREATE TABLE "augment" ( "id" SERIAL UNIQUE PRIMARY KEY, "augment_type_id" int, - "level" int, + "name" text, "variance" float, "hp" int, "pp" int, @@ -149,7 +153,9 @@ CREATE TABLE "augment" ( "panic_res" float, "poison_res" float, "battle_power_value" int, - "pb_gauge_build" float + "pb_gauge_build" float, + "popularity" int, + "editors_choice" int ); CREATE TABLE "skill" ( @@ -172,7 +178,9 @@ CREATE TABLE "skill_data" ( "pp_cost_reduction" float, "active_pp_recovery" float, "natural_pp_recovery" float, - "dmg_res" float + "dmg_res" float, + "popularity" int, + "editors_choice" int ); CREATE TABLE "skill_type" ( @@ -186,8 +194,9 @@ CREATE TABLE "users" ( "email" text UNIQUE, "password_hash" text, "created_on" timestamptz, - "role_id" int, - "avatar" text + "roles_id" int, + "avatar" text, + "editors_choice" int ); CREATE TABLE "roles" ( @@ -197,7 +206,7 @@ CREATE TABLE "roles" ( CREATE TABLE "builds" ( "id" SERIAL UNIQUE PRIMARY KEY, - "user_id" int, + "users_id" int, "creator" text, "build_name" text, "class1" int, @@ -205,13 +214,16 @@ CREATE TABLE "builds" ( "created_on" timestamptz, "last_modified" timestamptz, "likes" int, - "data" text + "data" text, + "editors_choice" int ); CREATE TABLE "weapon_existence_data" ( "id" SERIAL UNIQUE PRIMARY KEY, "weapon_type_id" int, - "weapon_id" int + "weapon_id" int, + "popularity" int, + "editors_choice" int ); CREATE TABLE "augment_type" ( @@ -234,13 +246,13 @@ ALTER TABLE "skill_data" ADD FOREIGN KEY ("skill_id") REFERENCES "skill" ("id"); ALTER TABLE "skill" ADD FOREIGN KEY ("skill_type_id") REFERENCES "skill_type" ("id"); -ALTER TABLE "builds" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("id"); +ALTER TABLE "builds" ADD FOREIGN KEY ("users_id") REFERENCES "users" ("id"); ALTER TABLE "builds" ADD FOREIGN KEY ("class1") REFERENCES "class" ("id"); ALTER TABLE "builds" ADD FOREIGN KEY ("class2") REFERENCES "class" ("id"); -ALTER TABLE "users" ADD FOREIGN KEY ("role_id") REFERENCES "roles" ("id"); +ALTER TABLE "users" ADD FOREIGN KEY ("roles_id") REFERENCES "roles" ("id"); ALTER TABLE "weapon_existence_data" ADD FOREIGN KEY ("weapon_id") REFERENCES "weapon" ("id"); diff --git a/ngsplanner_seed.sql b/ngsplanner_seed.sql index bd1d682..b10b7c6 100644 --- a/ngsplanner_seed.sql +++ b/ngsplanner_seed.sql @@ -6,10 +6,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(material,potency,pp,dmg_res,hp,pp_consumption,pp_recovery,weak_point_dmg,hp_recovery) - values('Rich Aelio Meat',true,false,false,false,true,false,false,false); -insert into food(material,potency,pp,dmg_res,hp,pp_consumption,pp_recovery,weak_point_dmg,hp_recovery) - values('Light Aelio Meat',true,false,false,false,false,true,false,false); +insert into food(material,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(material,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 class(name,icon) values('Hunter','/icons/UINGSClassHu.png'); insert into class(name,icon) values('Fighter','/icons/UINGSClassFi.png'); @@ -80,54 +80,54 @@ insert into potential_data(potential_id,level,mel_dmg,rng_dmg,tec_dmg,crit_rate, insert into potential_data(potential_id,level,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) values((select id from potential where name='Indomitable Unit'),1,1.18,1.18,1.18,0,0,0,0,0,0,1.10,0,0,0,0,0,0,10,0); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Sword'),(select id from weapon where name='Primm')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Spear'),(select id from weapon where name='Primm')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Wired Lance'),(select id from weapon where name='Primm')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Twin Dagger'),(select id from weapon where name='Primm')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Double Saber'),(select id from weapon where name='Primm')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Knuckles'),(select id from weapon where name='Primm')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Assault Rifle'),(select id from weapon where name='Primm')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Launcher'),(select id from weapon where name='Primm')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Twin Machine Guns'),(select id from weapon where name='Primm')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Rod'),(select id from weapon where name='Primm')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Talis'),(select id from weapon where name='Primm')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Wand'),(select id from weapon where name='Primm')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Sword'),(select id from weapon where name='Tzvia')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Spear'),(select id from weapon where name='Tzvia')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Wired Lance'),(select id from weapon where name='Tzvia')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Twin Dagger'),(select id from weapon where name='Tzvia')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Double Saber'),(select id from weapon where name='Tzvia')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Knuckles'),(select id from weapon where name='Tzvia')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Assault Rifle'),(select id from weapon where name='Tzvia')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Launcher'),(select id from weapon where name='Tzvia')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Twin Machine Guns'),(select id from weapon where name='Tzvia')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Rod'),(select id from weapon where name='Tzvia')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Talis'),(select id from weapon where name='Tzvia')); -insert into weapon_existence_data(weapon_type_id,weapon_id) - values((select id from weapon_type where name='Wand'),(select id from weapon where name='Tzvia')); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Sword'),(select id from weapon where name='Primm'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Spear'),(select id from weapon where name='Primm'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Wired Lance'),(select id from weapon where name='Primm'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Twin Dagger'),(select id from weapon where name='Primm'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Double Saber'),(select id from weapon where name='Primm'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Knuckles'),(select id from weapon where name='Primm'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Assault Rifle'),(select id from weapon where name='Primm'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Launcher'),(select id from weapon where name='Primm'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Twin Machine Guns'),(select id from weapon where name='Primm'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Rod'),(select id from weapon where name='Primm'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Talis'),(select id from weapon where name='Primm'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Wand'),(select id from weapon where name='Primm'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Sword'),(select id from weapon where name='Tzvia'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Spear'),(select id from weapon where name='Tzvia'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Wired Lance'),(select id from weapon where name='Tzvia'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Twin Dagger'),(select id from weapon where name='Tzvia'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Double Saber'),(select id from weapon where name='Tzvia'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Knuckles'),(select id from weapon where name='Tzvia'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Assault Rifle'),(select id from weapon where name='Tzvia'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Launcher'),(select id from weapon where name='Tzvia'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Twin Machine Guns'),(select id from weapon where name='Tzvia'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Rod'),(select id from weapon where name='Tzvia'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Talis'),(select id from weapon where name='Tzvia'),0,0); +insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice) + values((select id from weapon_type where name='Wand'),(select id from weapon where name='Tzvia'),0,0); insert into roles(name) @@ -137,15 +137,15 @@ insert into roles(name) insert into roles(name) values('Guest'); -insert into users(username,email,password_hash,created_on,role_id,avatar) +insert into users(username,email,password_hash,created_on,roles_id,avatar) values('sigonasr2','sigonasr2@gmail.com','ABCDEFG','2021-07-13 04:30+00',(select id from roles where name='Administrator'),''); -insert into users(username,email,password_hash,created_on,role_id,avatar) +insert into users(username,email,password_hash,created_on,roles_id,avatar) values('sigonasr3','sigonasr3@gmail.com','ABCDEF','2021-07-14 05:30+00',(select id from roles where name='Editor'),''); -insert into builds(user_id,creator,build_name,class1,class2,created_on,last_modified,likes,data) - values((select id from users where username='sigonasr2'),'sigonasr2','Test Build',(select id from class where name='Ranger'),(select id from class where name='Force'),'2021-07-13 04:30+00','2021-07-13 04:30+00',5,''); -insert into builds(user_id,creator,build_name,class1,class2,created_on,last_modified,likes,data) - values((select id from users where username='sigonasr3'),'sigonasr3','Test Build2',(select id from class where name='Techter'),(select id from class where name='Fighter'),'2021-07-13 06:30+00','2021-07-13 07:30+00',27,''); +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='sigonasr2'),'sigonasr2','Test Build',(select id from class where name='Ranger'),(select id from class where name='Force'),'2021-07-13 04:30+00','2021-07-13 04:30+00',5,'',0); +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='sigonasr3'),'sigonasr3','Test Build2',(select id from class where name='Techter'),(select id from class where name='Fighter'),'2021-07-13 06:30+00','2021-07-13 07:30+00',27,'',0); insert into skill_type(name) values('Weapon'); @@ -159,24 +159,24 @@ insert into skill(name,skill_type_id,icon) insert into skill(name,skill_type_id,icon) values('Fixa Termina',(select id from skill_type where name='Weapon'),'/icons/UINGSItemPresetAbility.png'); -insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res) - values((select id from skill where name='Fixa Attack'),1,0,1.02,1.02,1.02,0,0,0,0,0,0); -insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res) - values((select id from skill where name='Fixa Attack'),2,0,1.03,1.03,1.03,0,0,0,0,0,0); -insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res) - values((select id from skill where name='Fixa Attack'),3,0,1.04,1.04,1.04,0,0,0,0,0,0); -insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res) - values((select id from skill where name='Fixa Guard'),1,0,0,0,0,0,0,0,0,0,1.01); -insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res) - values((select id from skill where name='Fixa Guard'),2,0,0,0,0,0,0,0,0,0,1.02); -insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res) - values((select id from skill where name='Fixa Guard'),3,0,0,0,0,0,0,0,0,0,1.03); -insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res) - values((select id from skill where name='Fixa Termina'),1,0,0,0,0,0,1.05,0,0,0,0); -insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res) - values((select id from skill where name='Fixa Termina'),2,0,0,0,0,0,1.08,0,0,0,0); -insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res) - values((select id from skill where name='Fixa Termina'),3,0,0,0,0,0,1.10,0,0,0,0); +insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,popularity,editors_choice) + values((select id from skill where name='Fixa Attack'),1,0,1.02,1.02,1.02,0,0,0,0,0,0,0,0); +insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,popularity,editors_choice) + values((select id from skill where name='Fixa Attack'),2,0,1.03,1.03,1.03,0,0,0,0,0,0,0,0); +insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,popularity,editors_choice) + values((select id from skill where name='Fixa Attack'),3,0,1.04,1.04,1.04,0,0,0,0,0,0,0,0); +insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,popularity,editors_choice) + values((select id from skill where name='Fixa Guard'),1,0,0,0,0,0,0,0,0,0,1.01,0,0); +insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,popularity,editors_choice) + values((select id from skill where name='Fixa Guard'),2,0,0,0,0,0,0,0,0,0,1.02,0,0); +insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,popularity,editors_choice) + values((select id from skill where name='Fixa Guard'),3,0,0,0,0,0,0,0,0,0,1.03,0,0); +insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,popularity,editors_choice) + values((select id from skill where name='Fixa Termina'),1,0,0,0,0,0,1.05,0,0,0,0,0,0); +insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,popularity,editors_choice) + values((select id from skill where name='Fixa Termina'),2,0,0,0,0,0,1.08,0,0,0,0,0,0); +insert into skill_data(skill_id,level,variance,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,popularity,editors_choice) + values((select id from skill where name='Fixa Termina'),3,0,0,0,0,0,1.10,0,0,0,0,0,0); insert into augment_type(name,icon) values('Stamina',''); @@ -187,34 +187,34 @@ insert into augment_type(name,icon) insert into augment_type(name,icon) values('Precision',''); -insert into augment(augment_type_id,level,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) - values((select id from augment_type where name='Stamina'),1,0,5,0,0,0,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,3,0); -insert into augment(augment_type_id,level,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) - values((select id from augment_type where name='Stamina'),2,0,10,0,0,0,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,4,0); -insert into augment(augment_type_id,level,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) - values((select id from augment_type where name='Stamina'),3,0,15,0,0,0,0,0,0,0,0,0,0,0.09,0,0,0,0,0,0,0,5,0); -insert into augment(augment_type_id,level,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) - values((select id from augment_type where name='Spirit'),1,0,0,3,0,0,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,2,0); -insert into augment(augment_type_id,level,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) - values((select id from augment_type where name='Spirit'),2,0,0,4,0,0,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,3,0); -insert into augment(augment_type_id,level,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) - values((select id from augment_type where name='Spirit'),3,0,0,5,0,0,0,0,0,0,0,0,0,0.09,0,0,0,0,0,0,0,4,0); -insert into augment(augment_type_id,level,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) - values((select id from augment_type where name='Might'),1,0,0,0,1.01,0,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,4,0); -insert into augment(augment_type_id,level,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) - values((select id from augment_type where name='Might'),2,0,0,0,1.015,0,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,5,0); -insert into augment(augment_type_id,level,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) - values((select id from augment_type where name='Might'),3,0,0,0,1.02,0,0,0,0,0,0,0,0,0.09,0,0,0,0,0,0,0,6,0); -insert into augment(augment_type_id,level,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) - values((select id from augment_type where name='Precision'),1,0,0,0,0,1.01,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,4,0); -insert into augment(augment_type_id,level,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) - values((select id from augment_type where name='Precision'),2,0,0,0,0,1.015,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,5,0); -insert into augment(augment_type_id,level,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build) - values((select id from augment_type where name='Precision'),3,0,0,0,0,1.02,0,0,0,0,0,0,0,0.09,0,0,0,0,0,0,0,6,0); +insert into augment(augment_type_id,name,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,popularity,editors_choice) + values((select id from augment_type where name='Stamina'),1,0,5,0,0,0,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,3,0,0,0); +insert into augment(augment_type_id,name,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,popularity,editors_choice) + values((select id from augment_type where name='Stamina'),2,0,10,0,0,0,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,4,0,0,0); +insert into augment(augment_type_id,name,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,popularity,editors_choice) + values((select id from augment_type where name='Stamina'),3,0,15,0,0,0,0,0,0,0,0,0,0,0.09,0,0,0,0,0,0,0,5,0,0,0); +insert into augment(augment_type_id,name,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,popularity,editors_choice) + values((select id from augment_type where name='Spirit'),1,0,0,3,0,0,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,2,0,0,0); +insert into augment(augment_type_id,name,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,popularity,editors_choice) + values((select id from augment_type where name='Spirit'),2,0,0,4,0,0,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,3,0,0,0); +insert into augment(augment_type_id,name,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,popularity,editors_choice) + values((select id from augment_type where name='Spirit'),3,0,0,5,0,0,0,0,0,0,0,0,0,0.09,0,0,0,0,0,0,0,4,0,0,0); +insert into augment(augment_type_id,name,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,popularity,editors_choice) + values((select id from augment_type where name='Might'),1,0,0,0,1.01,0,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,4,0,0,0); +insert into augment(augment_type_id,name,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,popularity,editors_choice) + values((select id from augment_type where name='Might'),2,0,0,0,1.015,0,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,5,0,0,0); +insert into augment(augment_type_id,name,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,popularity,editors_choice) + values((select id from augment_type where name='Might'),3,0,0,0,1.02,0,0,0,0,0,0,0,0,0.09,0,0,0,0,0,0,0,6,0,0,0); +insert into augment(augment_type_id,name,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,popularity,editors_choice) + values((select id from augment_type where name='Precision'),1,0,0,0,0,1.01,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,4,0,0,0); +insert into augment(augment_type_id,name,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,popularity,editors_choice) + values((select id from augment_type where name='Precision'),2,0,0,0,0,1.015,0,0,0,0,0,0,0,0.1,0,0,0,0,0,0,0,5,0,0,0); +insert into augment(augment_type_id,name,variance,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,affix_success_rate,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,popularity,editors_choice) + values((select id from augment_type where name='Precision'),3,0,0,0,0,1.02,0,0,0,0,0,0,0,0.09,0,0,0,0,0,0,0,6,0,0,0); -insert into armor(name,rarity,level_req,def,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,icon) - values('Primm Armor',1,1,8,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,'/icons/20M6Z7t.png'); -insert into armor(name,rarity,level_req,def,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,icon) - values('Tzvia Armor',2,1,9,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,'/icons/F0t58xP.png'); -insert into armor(name,rarity,level_req,def,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,icon) - values('Theseus Armor',3,5,10,10,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.1,0,'/icons/uldt9lR.png'); \ No newline at end of file +insert into armor(name,rarity,level_req,def,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,icon,popularity,editors_choice) + values('Primm Armor',1,1,8,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,'/icons/20M6Z7t.png',0,0); +insert into armor(name,rarity,level_req,def,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,icon,popularity,editors_choice) + values('Tzvia Armor',2,1,9,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,'/icons/F0t58xP.png',0,0); +insert into armor(name,rarity,level_req,def,hp,pp,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build,icon,popularity,editors_choice) + values('Theseus Armor',3,5,10,10,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.1,0,'/icons/uldt9lR.png',0,0); \ No newline at end of file diff --git a/server.js b/server.js index 11ac700..f8e0e0e 100644 --- a/server.js +++ b/server.js @@ -73,7 +73,7 @@ const ENDPOINTDATA=[ { endpoint:"weapon_existence_data", requiredfields:["weapon_type_id","weapon_id"], - optionalfields:[], + optionalfields:["popularity","editors_choice"], excludedfields:[] //Fields to not output in GET. }, { @@ -85,7 +85,7 @@ const ENDPOINTDATA=[ { endpoint:"armor", requiredfields:["name","rarity","level_req","def"], - optionalfields:["hp","pp","mel_dmg","rng_dmg","tec_dmg","crit_rate","crit_dmg","pp_cost_reduction","active_pp_recovery","natural_pp_recovery","dmg_res","all_down_res","burn_res","freeze_res","blind_res","shock_res","panic_res","poison_res","battle_power_value","pb_gauge_build","icon"], + optionalfields:["hp","pp","mel_dmg","rng_dmg","tec_dmg","crit_rate","crit_dmg","pp_cost_reduction","active_pp_recovery","natural_pp_recovery","dmg_res","all_down_res","burn_res","freeze_res","blind_res","shock_res","panic_res","poison_res","battle_power_value","pb_gauge_build","icon","popularity","editors_choice"], excludedfields:[] //Fields to not output in GET. }, { @@ -102,8 +102,8 @@ const ENDPOINTDATA=[ }, { endpoint:"builds", - requiredfields:["user_id","creator","build_name","class1","created_on","last_modified","data"], - optionalfields:["class2","likes"], + requiredfields:["users_id","creator","build_name","class1","created_on","last_modified","data"], + optionalfields:["class2","likes","editors_choice"], excludedfields:[] //Fields to not output in GET. }, { @@ -121,13 +121,13 @@ const ENDPOINTDATA=[ { endpoint:"skill_data", requiredfields:["skill_id","level"], - optionalfields:["variance","mel_dmg","rng_dmg","tec_dmg","crit_rate","crit_dmg","pp_cost_reduction","active_pp_recovery","natural_pp_recovery","dmg_res"], + optionalfields:["variance","mel_dmg","rng_dmg","tec_dmg","crit_rate","crit_dmg","pp_cost_reduction","active_pp_recovery","natural_pp_recovery","dmg_res","popularity","editors_choice"], excludedfields:[] //Fields to not output in GET. }, { endpoint:"augment", requiredfields:["augment_type_id","level"], - optionalfields:["variance","hp","pp","mel_dmg","rng_dmg","tec_dmg","crit_rate","crit_dmg","pp_cost_reduction","active_pp_recovery","natural_pp_recovery","dmg_res","affix_success_rate","all_down_res","burn_res","freeze_res","blind_res","shock_res","panic_res","poison_res","battle_power_value","pb_gauge_build"], + optionalfields:["variance","hp","pp","mel_dmg","rng_dmg","tec_dmg","crit_rate","crit_dmg","pp_cost_reduction","active_pp_recovery","natural_pp_recovery","dmg_res","affix_success_rate","all_down_res","burn_res","freeze_res","blind_res","shock_res","panic_res","poison_res","battle_power_value","pb_gauge_build","popularity","editors_choice"], excludedfields:[] //Fields to not output in GET. }, { @@ -139,7 +139,7 @@ const ENDPOINTDATA=[ { endpoint:"food", requiredfields:["material"], - optionalfields:["potency","pp","dmg_res","hp","pp_consumption","pp_recovery","weak_point_dmg","hp_recovery"], + optionalfields:["potency","pp","dmg_res","hp","pp_consumption","pp_recovery","weak_point_dmg","hp_recovery","popularity","editors_choice"], excludedfields:[] //Fields to not output in GET. }, { @@ -156,8 +156,8 @@ const ENDPOINTDATA=[ }, { endpoint:"users", - requiredfields:["username","email","created_on","role_id"], - optionalfields:["avatar"], + requiredfields:["username","email","created_on","roles_id"], + optionalfields:["avatar","editors_choice"], excludedfields:["password_hash"] //Fields to not output in GET. } ] @@ -261,10 +261,10 @@ app.get('/data',(req,res)=>{ }) .then((data)=>{ finalresult["class_level_data"]=CleanUp(data.rows,["id","class_id","name"]) - return db.query('select *,class.name as class2 from (select *,class.name as class1 from builds inner join users on users.id=builds.user_id inner join class on class.id=builds.class1)t inner join class on class.id=t.class2') + return db.query('select *,class.name as class2 from (select *,class.name as class1 from builds inner join users on users.id=builds.users_id inner join class on class.id=builds.class1)t inner join class on class.id=t.class2') }) .then((data)=>{ - finalresult["builds"]=CleanUp(data.rows,["id","user_id","username","email","password_hash","created_on","role_id","name"]) + finalresult["builds"]=CleanUp(data.rows,["id","users_id","username","email","password_hash","created_on","roles_id","name"]) return db.query('select *,skill.name as skill_name,skill_type.name as skill_type_name from skill_data inner join skill on skill.id=skill_data.skill_id inner join skill_type on skill.skill_type_id=skill_type.id') }) .then((data)=>{