Replace native sql queries with orm in top stat methods.
Fixes
Fixes #2524
Description
This pr replaces native sql queries which could be a possible reason for sql injecrion via the variable limit with orm based query.
methods affetced
- getTopGenres
- getTopLanguages
- getTopMaterials
Type of PR This PR is a [improvement].
Technicalities
Added type for the limit variable in the function args and also the return type. The ORM based queries use JOIN instead of subqueries but preserves the same result.
Tests
Screenshots
Checklist:
-
My pull request has a descriptive title (not a vague title like "Update
index.md"). -
My pull request targets the
phoenix/developbranch of the repository. - My commit messages follow best practices.
- My code follows the established code style of the repository.
- I added tests for the changes I made (if applicable).
- I added or updated documentation (if applicable).
- I tried running the project locally and verified that there are no visible errors.