Fix eslint for /api

Oops, I didn't notice this when bulk-fixing eslint stuff in src!
This commit is contained in:
Emi Matchu 2021-05-13 01:13:21 -07:00
parent e56c5d9a9c
commit 8c8e845dc5
7 changed files with 37 additions and 20 deletions

View file

@ -105,8 +105,8 @@ async function loadWakaValuesByIdOrName() {
for (const [
itemName,
value = "",
notes = "",
marks = "",
unusedNotes = "",
unusedMarks = "",
itemId = "",
] of rows) {
const normalizedItemName = normalizeItemName(itemName);
@ -130,9 +130,11 @@ function normalizeItemName(name) {
);
}
export default async (req, res) => {
async function handleWithBeeline(req, res) {
beeline.withTrace(
{ name: "api/allWakaValues", operation_name: "api/allWakaValues" },
() => handle(req, res)
);
};
}
export default handleWithBeeline;

View file

@ -13,7 +13,7 @@ const { config } = require("../src/server");
const server = new ApolloServer(config);
const serverHandler = server.createHandler();
export default async (req, res) => {
async function handle(req, res) {
await serverHandler(req, res);
// As a sneaky trick, we require the Honeycomb trace to finish before the
@ -22,4 +22,6 @@ export default async (req, res) => {
// https://vercel.com/docs/platform/limits#streaming-responses
await beeline.flush();
res.end();
};
}
export default handle;

View file

@ -66,9 +66,11 @@ async function handle(req, res) {
return res.send(image);
}
export default async (req, res) => {
async function handleWithBeeline(req, res) {
beeline.withTrace(
{ name: "api/outfitImage", operation_name: "api/outfitImage" },
() => handle(req, res)
);
};
}
export default handleWithBeeline;

View file

@ -46,9 +46,11 @@ async function handle(req, res) {
return res.status(200).send();
}
export default async (req, res) => {
async function handleWithBeeline(req, res) {
beeline.withTrace(
{ name: "api/sendFeedback", operation_name: "api/sendFeedback" },
() => handle(req, res)
);
};
}
export default handleWithBeeline;

View file

@ -63,7 +63,7 @@ async function processImage(assetType, remoteId, size, imageData) {
const key = `${assetType}/${id1}/${id2}/${id3}/${remoteId}/${size}x${size}.png`;
await upload("impress-asset-images", key, imageData);
console.log(`Successfully uploaded ${key} to impress-asset-images`);
console.info(`Successfully uploaded ${key} to impress-asset-images`);
}
async function handle(req, res) {
@ -170,9 +170,11 @@ async function handle(req, res) {
res.status(200).send();
}
export default async (req, res) => {
async function handleWithBeeline(req, res) {
beeline.withTrace(
{ name: "api/uploadLayerImage", operation_name: "api/uploadLayerImage" },
() => handle(req, res)
);
};
}
export default handleWithBeeline;

View file

@ -71,19 +71,17 @@ export async function getValidPetPoses() {
}
async function getNumSpecies(db) {
const [rows, _] = await db.query(`SELECT count(*) FROM species`);
const [rows] = await db.query(`SELECT count(*) FROM species`);
return rows[0]["count(*)"];
}
async function getNumColors(db) {
const [rows, _] = await db.query(
`SELECT count(*) FROM colors WHERE prank = 0`
);
const [rows] = await db.query(`SELECT count(*) FROM colors WHERE prank = 0`);
return rows[0]["count(*)"];
}
async function getDistinctPetStates(db) {
const [rows, _] = await db.query(`
const [rows] = await db.query(`
SELECT DISTINCT species_id, color_id, mood_id, female, unconverted
FROM pet_states
INNER JOIN pet_types ON pet_types.id = pet_states.pet_type_id
@ -101,9 +99,11 @@ async function handle(req, res) {
res.status(200).send(buffer);
}
export default async (req, res) => {
async function handleWithBeeline(req, res) {
beeline.withTrace(
{ name: "api/validPetPoses", operation_name: "api/validPetPoses" },
() => handle(req, res)
);
};
}
export default handleWithBeeline;

View file

@ -87,6 +87,13 @@
"error"
]
}
],
"import/first": "off",
"no-unused-vars": [
"warn",
{
"varsIgnorePattern": "^unused"
}
]
}
},