consistent return and sendStatus

This commit is contained in:
Michael C
2021-07-04 02:04:39 -04:00
parent d89b26b77d
commit 8df0c31d35
23 changed files with 112 additions and 181 deletions

View File

@@ -1,12 +1,12 @@
import {db} from '../databases/databases';
import {Request, Response} from 'express';
export async function getDaysSavedFormatted(req: Request, res: Response): Promise<void> {
export async function getDaysSavedFormatted(req: Request, res: Response): Promise<Response> {
const row = await db.prepare('get', 'SELECT SUM(("endTime" - "startTime") / 60 / 60 / 24 * "views") as "daysSaved" from "sponsorTimes" where "shadowHidden" != 1', []);
if (row !== undefined) {
//send this result
res.send({
return res.send({
daysSaved: row.daysSaved.toFixed(2),
});
}