Commit Graph

56 Commits

Author SHA1 Message Date
Michael Manganiello
40326112bd misc: Improve API docs for Delete endpoints
Add more detailed descriptions for Delete endpoints.
2025-09-09 11:05:47 -03:00
Michael Manganiello
e4e3928d1b misc: Apply import sorting 2025-09-04 11:17:00 -03:00
Michael Manganiello
00d7815889 fix: Improve performance on asset screenshot retrieval
When retrieving the related screenshot for a `Save` or `State`, we were
retrieving a very heavy representation of the associated `Rom` object,
only to iterate through its screenshots to find the one we needed.

This change modifies the `Save` and `State` models to directly query the
`Screenshot` model, which is much faster and more efficient. The
`DBScreenshotsHandler` has been updated to include a new `filter` method
that will simplify building queries using SQLAlchemy, something we can
extend to other handlers in the future.

Fixes #1925.
2025-08-10 15:33:13 -03:00
Georges-Antoine Assi
51652d5084 make all path stuff async 2025-07-18 10:53:55 -04:00
Georges-Antoine Assi
aaf6741e93 Create safe filesystem handler 2025-07-17 12:30:57 -04:00
zurdi
0670d2a695 refactor: enhance error messages with highlighted file names and platform details 2025-05-14 16:36:03 +00:00
zurdi
44bfcaa23c fix: fixed assets path for screenshots 2025-05-14 16:28:46 +00:00
zurdi
48e3e09dd1 fix: build file path 2025-05-14 15:11:39 +00:00
zurdi
5f94440c9d Merge branch 'master' into refactor/saves-states-path 2025-05-14 13:35:28 +00:00
zurdi
6f08912fc0 refactor: remove unnecessary logging highlights and improve log messages for clarity 2025-05-09 10:25:11 +00:00
zurdi
14761c2c83 refactor: enhance logging with highlighted output for improved readability 2025-05-09 09:05:59 +00:00
Georges-Antoine Assi
d087266937 also add to states endpoint 2025-05-04 21:00:56 -04:00
zurdi
83cb0674c5 fix: include rom_id in file path building for saves and states 2025-04-25 16:54:36 +00:00
Georges-Antoine Assi
aa29f64ea2 fix assets test 2025-03-28 19:51:59 -04:00
Georges-Antoine Assi
d58691a79b always delete saves from fs + split delete dialogs 2025-03-27 23:37:42 -04:00
Georges-Antoine Assi
43f48899c9 add new endpoints to get some or all states and saves 2025-03-26 19:21:21 -04:00
Georges-Antoine Assi
c6d6a8100a wip refactor of save and state behaviour 2025-03-26 17:24:09 -04:00
Georges-Antoine Assi
7d54ef877b [HOTFIX] Remove single forward-slash endpoints 2025-02-11 13:48:24 -05:00
Michael Manganiello
70825830c4 misc: Set prefix and tags to API routers
Improve OpenAPI documentation by setting tags to each API router. Also,
set a prefix to each router to group the endpoints by their
functionality.
2025-02-09 11:31:13 -03:00
Georges-Antoine Assi
696a1c6122 Merge branch 'master' into rom-hashing-background-task 2025-01-15 21:51:23 -05:00
Michael Manganiello
865370ec13 misc: Move auth constants to separate file
This simplifies avoiding circular imports when trying to use auth
handlers.
2025-01-08 22:16:31 -03:00
Georges-Antoine Assi
3fcce6606c complete updating the endpoints and models 2024-12-20 22:41:56 -05:00
Michael Manganiello
beeb9f0c31 misc: Create enum for authorization scopes
Instead of using just strings, this change converts the scopes to a
`StrEnum`, to be compatible with places where a string is expected. This
avoids typos when using these scopes, simplifies searching for usages,
and improves type hints.

An extra change was the fix to the Firmware download endpoint, which
wasn't respecting the `DISABLE_DOWNLOAD_ENDPOINT_AUTH` flag.
2024-10-18 23:57:42 -03:00
Georges-Antoine Assi
8fc25cde99 use timezone aware datetimes 2024-09-09 10:11:46 -04:00
Georges-Antoine Assi
48ec9f39a1 create ui components and page 2024-08-29 17:43:07 -04:00
Georges-Antoine Assi
5f27c1cf39 Create new fields on rom_user 2024-08-29 15:56:01 -04:00
Michael Manganiello
8abbae4c02 misc: Make backend handle URLs with trailing slash
According to multiple FastAPI discussions [1], FastAPI only includes a
built-in mechanism to redirect requests including a trailing slash, to
its variation without slash, using a `307` status code.

This can be an issue when certain clients do not send the same headers
on the redirected request.

This change adds a custom FastAPI `APIRouter`, that registers both route
path variations (with and without trailing slash), while only marking
the path without slash for being included in the OpenAPI schema.

[1] https://github.com/fastapi/fastapi/discussions/7298
2024-08-07 00:22:21 -03:00
Michael Manganiello
8281d5679b misc: Split database handler logic to get/list entities
The current implementation for some of the database handlers, where the
same method is used to retrieve either a single entity (when an `id` is
passed), a list of entities, or `None`, makes the typing and overall
design more complex.

This change simplifies database handlers, by having two separate methods
where appropiate:

* A method that receives an `id`, and returns either an entity, or `None`.
* A method that optionally receives filters, and returns (depending on
  the current handler implementation) a list of entities, or a `Select`
  object that allows chaining more SQLAlchemy operations.
2024-06-30 13:12:48 -03:00
zurdi
eddc6456b3 fixes from trunk 2024-06-14 20:23:46 +02:00
zurdi
336f5aa76d fixed types from trunk check 2024-06-14 20:07:19 +02:00
zurdi
3c1e3b48a7 added upload/delete assets dialogs 2024-06-14 11:30:15 +02:00
zurdi
75d93ab564 fixed endpoints 2024-06-13 02:10:39 +02:00
Georges-Antoine Assi
1840390c8a finish mypy fixes 2024-05-21 21:28:17 -04:00
Georges-Antoine Assi
b2085f87a8 bunch of fixes for trunk 2024-05-21 17:10:11 -04:00
Georges-Antoine Assi
a7cf0d389a run trunk format on all files 2024-05-21 10:18:13 -04:00
Georges-Antoine Assi
2749aaee4a rename back to old names 2024-05-05 16:59:30 -04:00
Georges-Antoine Assi
9ad28f3294 more refactoring again 2024-05-05 16:32:40 -04:00
Georges-Antoine Assi
def2608c28 refactor db handlers 2024-05-05 15:46:07 -04:00
Georges-Antoine Assi
1a2c914045 refactor handlers out into own files 2024-05-05 12:45:56 -04:00
Georges-Antoine Assi
feb175f02e General fixes for filtering assets per user 2024-02-07 20:31:03 -05:00
Georges-Antoine Assi
eb18388a81 Mega refactor of asset 2024-02-01 17:59:06 -05:00
Georges-Antoine Assi
753caf1bee also delete screenshot for save/state 2024-01-25 17:20:46 -05:00
Georges-Antoine Assi
13181ec666 set emulator correctly on emulation 2024-01-25 17:07:30 -05:00
Georges-Antoine Assi
38eda35f23 refactor scan_save/state/screenshot 2024-01-25 16:48:51 -05:00
Georges-Antoine Assi
c889fbbd96 actually fix asset saving and loading 2024-01-21 20:18:48 -05:00
Georges-Antoine Assi
f7da369bcf correct saving screenshots for states 2024-01-20 22:07:02 -05:00
Georges-Antoine Assi
9fba1d1a64 get save workgin on load 2024-01-19 18:09:51 -05:00
Georges-Antoine Assi
8b18bd2949 smooth state saving 2024-01-19 12:25:10 -05:00
Georges-Antoine Assi
dd4b149271 automatic state loading and saving 2024-01-19 11:20:40 -05:00
Georges-Antoine Assi
81b5bcf9ba refactor handler names 2024-01-18 14:04:35 -05:00