diff --git a/GamesPassionFR.db b/GamesPassionFR.db index 2c2aa12b..42994c73 100644 Binary files a/GamesPassionFR.db and b/GamesPassionFR.db differ diff --git a/GamesPassionFR.sqbpro b/GamesPassionFR.sqbpro index bf9d2855..d3c7fb93 100644 --- a/GamesPassionFR.sqbpro +++ b/GamesPassionFR.sqbpro @@ -1 +1 @@ -
+
SELECT * FROM games_in_present
diff --git a/generateJsonFile.mjs b/generateJsonFile.mjs index e453ab2d..77b51d0e 100644 --- a/generateJsonFile.mjs +++ b/generateJsonFile.mjs @@ -11,6 +11,7 @@ const FILES = { "TESTS": "src/app/api/tests/tests.json", "PLATFORMS": "src/app/api/platforms/platforms.json", "GENRES": "src/app/api/genres/genres.json", + "PLANNING": "src/app/api/planning/planning.json" } const db = new Database(databasePath, { @@ -44,4 +45,24 @@ await writeFile( FILES.BACKLOG, JSON.stringify(backlog), "utf-8" -); \ No newline at end of file +); + +// Extract planning +const extractPlanningStmt = db.prepare("SELECT * FROM games_in_future gif INNER JOIN games g ON g.id == gif.id"); +const planning = extractPlanningStmt.all(); +await writeFile( + FILES.PLANNING, + JSON.stringify(planning), + "utf-8" +); + +// Extract games +const extractGamesList = db.prepare("SELECT * FROM games_in_present"); +const gamesList = extractGamesList.all(); +await writeFile( + FILES.GAMES, + JSON.stringify(gamesList), + "utf-8" +); + +// Extract series diff --git a/src/app/api/planning/route.ts b/src/app/api/planning/route.ts index 2dc09339..af3f02af 100644 --- a/src/app/api/planning/route.ts +++ b/src/app/api/planning/route.ts @@ -10,20 +10,10 @@ export type planningEntry = Omit (min !== undefined && max === undefined) || (max !== undefined && elem <= max); - const games = gamesData.filter(game => should_be_displayed(dateAsInteger, game.availableAt as number | undefined, game.endAt as number | undefined)) + const games = (await import("./planning.json")).default; return NextResponse.json(games.map(game => enhanceGameItem(game as BasicGame)), { headers: {