diff --git a/TODO.md b/TODO.md index 00b271e..06fa238 100644 --- a/TODO.md +++ b/TODO.md @@ -1,23 +1,28 @@ -# Todo list +# Todo list Leaderboards: + - [ ] ScoreSaber - [ ] BeatLeader - [ ] AccSaber? Score fetching: + - Fetch and store all scores from the websocket - Update every players scores every week so we can ensure we have every score stored. (last 20 pages?) Player data fetching: + - Update player data every hour BeatSaver data: + - API Route: "/beatsaver/maps?hashes=id1,id2, etc" - Fetch map data from their api if we haven't already cached it. Cached maps should last for a week or 2 (longer if ranked?) Routes: + - Leaderboard curve for the given Leaderboard - Player data for the given Leaderboard - Player scores for the given Leaderboard:
-add a query to add extra score data from BeatLeader (eg: per hand acc, etc) \ No newline at end of file + add a query to add extra score data from BeatLeader (eg: per hand acc, etc) diff --git a/src/route/impl/testRoute.ts b/src/route/impl/testRoute.ts index 935a53c..2e0a1e3 100644 --- a/src/route/impl/testRoute.ts +++ b/src/route/impl/testRoute.ts @@ -1,4 +1,4 @@ -import { Request, Response } from "express"; +import { NextFunction, Request, Response } from "express"; import { Route } from "../route"; export default class TestRoute extends Route { @@ -9,7 +9,7 @@ export default class TestRoute extends Route { }); } - async handle(req: Request, res: Response) { + async handle(req: Request, res: Response, next: NextFunction) { res.send("Hello World!"); } } diff --git a/src/route/route.ts b/src/route/route.ts index 1da2d68..6f1b752 100644 --- a/src/route/route.ts +++ b/src/route/route.ts @@ -1,4 +1,4 @@ -import { Request, Response } from "express"; +import { NextFunction, Request, Response } from "express"; type Method = "GET" | "POST" | "PUT" | "DELETE" | "ALL"; @@ -41,7 +41,7 @@ export abstract class Route { * @param req the request * @param res the response */ - abstract handle(req: Request, res: Response): void; + abstract handle(req: Request, res: Response, next: NextFunction): void; /** * Get the path of the route diff --git a/src/server/impl/ssrServer.ts b/src/server/impl/ssrServer.ts index 6890c7c..0873236 100644 --- a/src/server/impl/ssrServer.ts +++ b/src/server/impl/ssrServer.ts @@ -8,12 +8,4 @@ export class SsrServer extends Server { routes: [new TestRoute()], }); } - - public preInit(): void { - console.log("preInit"); - } - - public postInit(): void { - console.log("postInit"); - } } diff --git a/src/server/server.ts b/src/server/server.ts index 6dd98c9..7401ef6 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -38,10 +38,13 @@ export default class Server { if (req.method.toUpperCase() !== route.getMethod().toUpperCase()) { return next(); // Skip this method } - route.handle(req, res); + route.handle(req, res, next); }); } console.log(`Registered ${this.routes.length} routes`); + for (const route of this.routes) { + console.log(` - ${route.getMethod().toUpperCase()} ${route.getPath()}`); + } // Handle unknown routes this.server.all("*", (req, res) => {