Remove useless endpoints
This commit is contained in:
parent
9c1492d5b4
commit
9ae75238c0
137
server.js
137
server.js
@ -45,6 +45,15 @@ new Pool({
|
|||||||
port: 5432,
|
port: 5432,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const ENDPOINTDATA=[
|
||||||
|
{
|
||||||
|
endpoint:"class",
|
||||||
|
requiredfields:["name","icon"],
|
||||||
|
optionalfields:[],
|
||||||
|
excludedfields:[] //Fields to not output in GET.
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
function CleanUp(arr,vals){
|
function CleanUp(arr,vals){
|
||||||
return arr.map((arrVal)=>{
|
return arr.map((arrVal)=>{
|
||||||
vals.forEach((val)=>{
|
vals.forEach((val)=>{
|
||||||
@ -54,134 +63,6 @@ function CleanUp(arr,vals){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get('/augment_type',(req,res)=>{
|
|
||||||
if (req.query.id) {
|
|
||||||
db.query('select * from augment_type where id=$1',[req.query.id])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else
|
|
||||||
if (req.query.name) {
|
|
||||||
db.query('select * from augment_type where name ilike $1',[req.query.name])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
res.status(300).send("Invalid query!")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/skill',(req,res)=>{
|
|
||||||
if (req.query.id) {
|
|
||||||
db.query('select * from skill where id=$1',[req.query.id])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else
|
|
||||||
if (req.query.name) {
|
|
||||||
db.query('select * from skill where name ilike $1',[req.query.name])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
res.status(300).send("Invalid query!")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/skill_type',(req,res)=>{
|
|
||||||
if (req.query.id) {
|
|
||||||
db.query('select * from skill_type where id=$1',[req.query.id])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else
|
|
||||||
if (req.query.name) {
|
|
||||||
db.query('select * from skill_type where name ilike $1',[req.query.name])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
res.status(300).send("Invalid query!")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/class',(req,res)=>{
|
|
||||||
if (req.query.id) {
|
|
||||||
db.query('select * from class where id=$1',[req.query.id])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else
|
|
||||||
if (req.query.name) {
|
|
||||||
db.query('select * from class where name ilike $1',[req.query.name])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
db.query('select * from class')
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/weapon_type',(req,res)=>{
|
|
||||||
if (req.query.id) {
|
|
||||||
db.query('select * from weapon_type where id=$1',[req.query.id])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else
|
|
||||||
if (req.query.name) {
|
|
||||||
db.query('select * from weapon_type where name ilike $1',[req.query.name])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
res.status(300).send("Invalid query!")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/weapon',(req,res)=>{
|
|
||||||
if (req.query.id) {
|
|
||||||
db.query('select * from weapon where id=$1',[req.query.id])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else
|
|
||||||
if (req.query.name) {
|
|
||||||
db.query('select * from weapon where name ilike $1',[req.query.name])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else
|
|
||||||
if (req.query.rarity) {
|
|
||||||
db.query('select * from weapon where rarity=$1',[req.query.rarity])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
res.status(300).send("Invalid query!")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/potential',(req,res)=>{
|
|
||||||
if (req.query.id) {
|
|
||||||
db.query('select * from potential where id=$1',[req.query.id])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else
|
|
||||||
if (req.query.name) {
|
|
||||||
db.query('select * from potential where name ilike $1',[req.query.name])
|
|
||||||
.then((data)=>{
|
|
||||||
res.status(200).json(data.rows)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
res.status(300).send("Invalid query!")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/data',(req,res)=>{
|
app.get('/data',(req,res)=>{
|
||||||
var finalresult = {}
|
var finalresult = {}
|
||||||
db.query('select * from potential_data inner join potential on potential_data.potential_id=potential.id')
|
db.query('select * from potential_data inner join potential on potential_data.potential_id=potential.id')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user