From d82fb9d83b2ff03fd2bbffde09dbfb7ad69e00ce Mon Sep 17 00:00:00 2001 From: Alper Alkan Date: Thu, 19 Oct 2023 22:44:39 +0200 Subject: [PATCH 1/3] fix genre and query filters --- src/modules/games/games.controller.ts | 12 +++++++++++- src/modules/tags/tags.controller.ts | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/modules/games/games.controller.ts b/src/modules/games/games.controller.ts index 80e0136..87eb029 100644 --- a/src/modules/games/games.controller.ts +++ b/src/modules/games/games.controller.ts @@ -67,12 +67,20 @@ export class GamesController { }) @MinimumRole(Role.GUEST) async get(@Paginate() query: PaginateQuery): Promise> { + const relations = ["box_image"]; + if (query.filter["genres.name"]) { + relations.push("genres"); + } + if (query.filter["tags.name"]) { + relations.push("tags"); + } + return paginate(query, this.gamesRepository, { paginationType: PaginationType.TAKE_AND_SKIP, defaultLimit: 100, maxLimit: NO_PAGINATION, nullSort: "last", - relations: ["box_image"], + relations, sortableColumns: [ "id", "title", @@ -96,6 +104,8 @@ export class GamesController { average_playtime: all_filters, early_access: all_filters, type: all_filters, + "genres.name": all_filters, + "tags.name": all_filters, }, withDeleted: false, }); diff --git a/src/modules/tags/tags.controller.ts b/src/modules/tags/tags.controller.ts index 3588a48..4f663a8 100644 --- a/src/modules/tags/tags.controller.ts +++ b/src/modules/tags/tags.controller.ts @@ -46,7 +46,7 @@ export class TagsController { async getTags(@Paginate() query: PaginateQuery): Promise> { const paginatedResults = await paginate(query, this.tagRepository, { paginationType: PaginationType.TAKE_AND_SKIP, - defaultLimit: Number.MAX_SAFE_INTEGER, + defaultLimit: 100, maxLimit: NO_PAGINATION, nullSort: "last", relations: ["games"], From e376a9a52c262b1df0e07a0e711045e30df56c54 Mon Sep 17 00:00:00 2001 From: Alper Alkan Date: Thu, 19 Oct 2023 22:58:28 +0200 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c83466..46744e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # GameVault Backend Server Changelog +## 8.0.2 + +Recommended Gamevault App Version: `v1.7.0` + +### Changes + +- Fixed Bug [#268](https://github.com/Phalcode/gamevault-app/issues/268) where your games could not be filtered based on their tags and genres. +- Also made Tags API faster by limiting pages to 100 results by default. + ## 8.0.1 Recommended Gamevault App Version: `v1.7.0` From a9c2766858435775d30c1c702b6f16c718d25bdf Mon Sep 17 00:00:00 2001 From: Alper Alkan Date: Thu, 19 Oct 2023 22:59:10 +0200 Subject: [PATCH 3/3] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9e888ae..429db41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gamevault-backend", - "version": "8.0.1", + "version": "8.0.2", "description": "the self-hosted gaming platform for drm-free games", "author": "Alkan Alper, Schäfer Philip GbR / Phalcode", "private": true,