Commit Graph

72 Commits

Author SHA1 Message Date
Georges-Antoine Assi
3fcce6606c complete updating the endpoints and models 2024-12-20 22:41:56 -05:00
Georges-Antoine Assi
49c50ad810 Move hash calc for roms to bacakground task 2024-12-19 22:21:51 -05:00
Georges-Antoine Assi
cae4089ccf add email field 2024-12-09 19:57:13 -05:00
zurdi
c6039ccff4 fix: correct filter condition for retrieving collections associated with a ROM ID 2024-12-05 16:16:34 +00:00
zurdi
014427e69f fix: update ROM deletion process to remove associated collections and streamline user data updates 2024-12-05 16:08:45 +00:00
Michael Manganiello
0a4c81d5c1 misc: Retrieve roms by filename from database in bulk during scan
The scanning process could try to fetch thousands of roms from the
database, one by one, which is very inefficient, especially when only a
few new roms are added to the library, as the overhead of database calls
is very high compared to metadata API calls.

This change introduces a new method in the roms handler to retrieve roms
by their file names in bulk, which is used during the scan process to
fetch a batch of roms at once, instead of one by one.

It also avoids the `@with_details` decorator when fetching roms during
the scanning process, as those details are not needed, and they were
adding unnecessary joins and data decoding.
2024-12-02 00:00:47 -03:00
zurdi
a51dd03e1a Added full offline support and configurable logging level and API requests debug logs 2024-11-27 17:12:13 +00:00
Michael Manganiello
eba2971ffb fix: Simplify query that validates new username already exists
Instead of fetching all users and checking if the new username is present
in the list, we can directly query the database for the username.
2024-10-14 01:10:31 -03:00
Ali Scissons
5acbdfdf8b add offset parameter to get_roms endpoint 2024-10-11 23:28:30 -05:00
Georges-Antoine Assi
9b6b19eb27 Merge branch 'master' into romm-829 2024-09-03 18:58:06 -04:00
Georges-Antoine Assi
ae05c6be8c [ROMM-1154] fix setting main sibling 2024-09-01 22:11:49 -04:00
Georges-Antoine Assi
efcc2badea connect to the backend 2024-08-29 18:03:55 -04:00
Georges-Antoine Assi
e4816911d9 Better performance for large collections 2024-08-28 11:44:31 -04:00
Michael Manganiello
a85c84a7d4 misc: Use single SQLAlchemy engine and session maker
As recommended by SQLAlchemy [1], this change makes a single
instantiation of the database engine and session maker, instead of one
entity per handler.

It also uses the provided `URL` constructor to better define the
database URL structure.

[1] https://docs.sqlalchemy.org/en/20/core/connections.html#basic-usage
2024-08-21 09:56:28 -03:00
Georges-Antoine Assi
5f0577b900 more cleanup 2024-08-09 00:17:11 -04:00
Georges-Antoine Assi
1ae9cd0b5a remove unneded code 2024-08-09 00:10:31 -04:00
Georges-Antoine Assi
3a1986f453 single lines for the virtual table 2024-08-08 23:27:31 -04:00
Georges-Antoine Assi
cd54d902a7 create database view for sibling roms 2024-08-08 22:25:50 -04:00
Georges-Antoine Assi
141edf9d2e Merge pull request #1028 from rommapp/share-public-collections
Public collections
2024-07-25 22:38:21 -04:00
Georges-Antoine Assi
ad3a588631 filter collections for each user 2024-07-25 19:53:44 -04:00
Georges-Antoine Assi
92b23656aa start making collecitons public 2024-07-25 13:49:43 -04:00
Michael Manganiello
2bfc3c4c7e misc: Refactor scan process by splitting single function
This change mainly refactors the `scan_platforms` function, moving part
of its logic to `_identify_platform`, `_identify_firmware`, and
`_identify_rom`.

The logic is simpler this way, each smaller function returns `ScanStats`
that can be merged by the caller, and it simplifies future performance
improvements.
2024-07-25 10:29:46 -03:00
Zurdi
b1f5ae50e5 fixes from PR review 2024-07-06 17:25:08 +02:00
Zurdi
65589393c8 Merge remote-tracking branch 'origin/master' into feature/setup-wizard 2024-07-05 21:13:12 +02:00
Zurdi
ebaa5d6520 fixed filter roms both by platform and collection 2024-07-05 20:59:14 +02:00
Zurdi
7cdc12c7b2 fixed stats and user handler 2024-07-04 23:11:07 +02:00
zurdi
f2f202de9e add user collections to details 2024-07-04 01:25:44 +02:00
Zurdi
5126c56ba9 get collections for detailed rom info 2024-07-04 00:05:37 +02:00
Zurdi
2a7def81ac added reactivity to collections 2024-07-03 21:58:58 +02:00
zurdi
59c2a51a6f added collection cover management 2024-07-03 14:31:17 +02:00
Zurdi
23e0a064ab added update collection endpoint 2024-07-02 23:34:50 +02:00
zurdi
1d6ba70080 collections get_roms endpoint added 2024-07-02 14:31:27 +02:00
Zurdi
cc9e05f668 collections migration added 2024-07-01 23:47:15 +02:00
Georges-Antoine Assi
7530fdd576 mega refactor of pr 2024-07-01 15:12:07 -04:00
Zurdi
a937b0ddcf added publicNotes schema 2024-07-01 17:42:23 +02:00
zurdi
15f7522da5 rom db hanlder refactor to adapt to user_rom_props 2024-07-01 15:30:14 +02:00
zurdi
66e185db47 Merge branch 'master' into feature/fav_for_siblings 2024-07-01 08:34:04 +02:00
Georges-Antoine Assi
b7c2350123 Merge branch 'master' into misc/simplify-stat-query-platforms 2024-06-30 20:24:47 -04:00
Georges-Antoine Assi
bffffcc9c3 Merge pull request #969 from adamantike/fix/implement-total-filesize-stat
fix: Add implementation for total filesize statistic
2024-06-30 20:00:00 -04:00
Michael Manganiello
bc13e69a5b misc: Simplify statistics query to retrieve platforms count
Instead of counting `Platform` rows, and filtering based on a subquery
in `Rom`, we can simply count the different `platform_id` values in
`Rom`.
2024-06-30 17:55:11 -03:00
Michael Manganiello
b0f834282a fix: Add implementation for total filesize statistic
Add query that calculates total filesize statistic, currently hardcoded
to zero.
2024-06-30 17:40:48 -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
aff4bb65de add user_rom_props to get_roms 2024-06-30 13:26:50 +02:00
zurdi
4749bf84c6 atomic update user_rom_props 2024-06-30 01:50:08 +02:00
Zurdi
43cd6a8383 added main sibling per user 2024-06-29 14:09:41 +02:00
zurdi
0a0bab6730 migrated rom_notes to user_rom_props 2024-06-29 11:26:16 +02:00
Zurdi
c022e9cef7 added user_rom_props entity 2024-06-29 00:13:28 +02:00
Zurdi
7d9ce05c3c added main sibling to the front and database 2024-06-27 21:50:04 +02:00
Georges-Antoine Assi
9b62641d55 Merge branch 'master' into trunk-io 2024-05-31 18:42:43 -04:00
Georges-Antoine Assi
39437b52c8 [ROMM-886] Fix fetching all firmware 2024-05-27 21:38:31 -04:00