Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async getAll (req, res) {
try {
const db = await sqlite.open(res.database.file, { mode: sqlite.OPEN_READONLY })
const data = await db.all(queries.pets)
data.map(async (pet) => {
pet.name = getPetName(pet)
pet.info = getPetInfo(pet)
pet.owner = getPetOwnerId(pet)
pet.greater = pet.info.indexOf('Greater') > -1
return pet
})
res.send({ data: data, update: res.database.time })
await db.close()
} catch (e) {
res.send({ error: "There was an error while querying the database" })
}
}
async getAll (req, res) {
try {
const db = await sqlite.open(res.database.file, { mode: sqlite.OPEN_READONLY })
const data = await db.all(queries.players)
data.map((player) => {
if (player.char_name) player.char_name = player.char_name.slice(1, -1)
if (player.guild_name) {
if (player.guild_name === nullValue || !player.guild_name) {
player.guild_name = ''
} else {
player.guild_name = player.guild_name.slice(1, -1)
}
}
if (player.rank === nullValue || !player.rank) player.rank = ''
})
res.send({ data: data, update: res.database.time })
await db.close()
async getAll (req, res) {
try {
const db = await sqlite.open(res.database.file, { mode: sqlite.OPEN_READONLY })
const data = await db.all(queries.pippiThespians)
data.map((pippi) => {
pippi.name = getPippiMobName(pippi)
pippi.info = getPippiMobProfession(pippi)
delete pippi.buffer
})
res.send({ data: data, update: res.database.time })
await db.close()
} catch (e) {
res.send({ error: "There was an error while querying the database" })
}
}