Commit Graph

42 Commits

Author SHA1 Message Date
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
aaf6741e93 Create safe filesystem handler 2025-07-17 12:30:57 -04:00
zurdi
8370b79a83 feat: add 'missing_from_fs' property to various schemas and update related logic for better tracking of missing files 2025-06-12 22:18:06 +00:00
zurdi
cb01b82846 feat: add 'missing' property to asset and firmware schemas for tracking missing entries 2025-06-12 12:24:30 +00:00
Georges-Antoine Assi
b6e0df7097 complete refactor of seleting saves and states 2025-03-26 18:49:12 -04:00
Georges-Antoine Assi
8750e343e5 Merge branch 'master' into misc/split-db-handler-logic-to-get-list 2024-06-30 19:24:59 -04: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
Michael Manganiello
e1bcd9cc06 misc: Use Python future annotations
Simplify annotations by using `__future__.annotations`, so there's no
need to add typing using types as strings.
2024-06-30 12:19:37 -03:00
Zurdi
dc479b289b fixes from trunk 2024-06-28 17:32:04 +02:00
Zurdi
d2fe08f525 added update_at and created_at to base model 2024-06-28 16:45:39 +02:00
Michael Manganiello
b99ededced misc: Migrate to SQLAlchemy declarative models
This change applies the guided migration process recommended by
SQLAlchemy [1], up to step 4, to have declarative ORM models that better
support Python typing.

The change was tested by running `alembic check`, which does not find
any schema changes.

Errors reported by `mypy` go down to 170, from the original 223 in the
current `master` commit.

[1] https://docs.sqlalchemy.org/en/20/changelog/whatsnew_20.html#migrating-an-existing-mapping
2024-06-25 23:03:20 -03:00
Georges-Antoine Assi
b075e93321 Merge branch 'master' into trunk-io 2024-05-24 16:47:19 -04:00
Georges-Antoine Assi
2d4d1b5ae3 improve roms loading time 2024-05-24 10:14:44 -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
dc64776e1d fixes for firmware ui 2024-05-05 15:12:55 -04:00
Georges-Antoine Assi
1a2c914045 refactor handlers out into own files 2024-05-05 12:45:56 -04:00
Georges-Antoine Assi
eca1eb1136 model and scanning 2024-05-01 15:27:16 -04:00
Georges-Antoine Assi
99e1ed4fe9 Add tables for firmware 2024-04-10 13:51:41 -04:00
Georges-Antoine Assi
c3e1f4f44c [ROMM-618] Add last logged in and last active for users 2024-04-06 15:29:40 -04:00
Georges-Antoine Assi
a21b48c42a squash migrations for 3.0 2024-02-08 15:16:24 -05:00
Georges-Antoine Assi
eb18388a81 Mega refactor of asset 2024-02-01 17:59:06 -05:00
Georges-Antoine Assi
89c16c7ec1 increase file extesnion assets 2024-01-27 13:09:28 -05:00
Georges-Antoine Assi
f7da369bcf correct saving screenshots for states 2024-01-20 22:07:02 -05:00
Georges-Antoine Assi
0ca6d74c26 Add file_name_no_ext column 2024-01-20 15:09:11 -05:00
Georges-Antoine Assi
dd4b149271 automatic state loading and saving 2024-01-19 11:20:40 -05:00
Georges-Antoine Assi
f3d44aae41 api endpoint for raw asset access 2024-01-18 09:48:57 -05:00
Zurdi
93f6cb7651 Merge branch 'feature/manage_config_from_ui' into refactor/backend 2024-01-13 02:17:19 +01:00
Zurdi
4b9e76f550 backend structure refactor 2024-01-12 23:44:27 +01:00
Georges-Antoine Assi
2b2f79cfb9 add created/updated at columns to assets 2024-01-07 09:52:34 -05:00
Georges-Antoine Assi
91d2562597 Support screenshots outside platforms 2024-01-06 17:24:51 -05:00
Georges-Antoine Assi
05da20963f remove support for bios and emulatores 2024-01-06 10:21:43 -05:00
Georges-Antoine Assi
2e9f581478 small fixes 2024-01-06 09:50:29 -05:00
Georges-Antoine Assi
678b6c2c98 Add support for emulator files related to platforms 2023-11-29 14:41:12 -05:00
Georges-Antoine Assi
8422c002c5 Support emulator folders 2023-11-26 22:43:03 -05:00
Georges-Antoine Assi
009c0f391a Switch to eager loading 2023-11-21 23:45:24 -05:00
Georges-Antoine Assi
1adad64a9e Merge uplaoded and igdb screenshots 2023-11-14 09:40:36 -05:00
Georges-Antoine Assi
a7bf12c6ed Refactor how config is stored and loaded 2023-11-14 09:14:27 -05:00
Georges-Antoine Assi
f560d03b86 Get saves and states loading 2023-11-14 00:00:33 -05:00