mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2026-02-02 15:50:44 +03:00
migrate to typescript
This commit is contained in:
committed by
Dainius Dauksevicius
parent
c462323dd5
commit
08d27265fc
13
src/routes/getDaysSavedFormatted.ts
Normal file
13
src/routes/getDaysSavedFormatted.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import {db} from '../databases/databases';
|
||||
import {Request, Response} from 'express';
|
||||
|
||||
export function getDaysSavedFormatted(req: Request, res: Response) {
|
||||
let row = 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({
|
||||
daysSaved: row.daysSaved.toFixed(2),
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user