Files
sct-overseerr/server/entity
fallenbagel df4315aaba refactor(MediaRequest): consolidate lifecycle hooks into subscriber & restrict cascade to prevent recursion (#4124)
* fix(mediarequest entity): narrow cascade to insert & remove to prevent hook recursion

Restrict cascade options on the MediaRequest→Media relation to only `insert` and `remove`to avoid
nested subscriber/AfterUpdate recursion when saving entities.

* fix(mediarequest): move methods modifying MediaRequest to its Subscriber

* fix(mediasubscriber): use event.manager for parent media updates on remove

Replace `getRepository(Media)` calls with `event.manager` in the `afterRemove` hook so that
parent-media status resets run within the same transaction/QueryRunner (important for postgresql.
Doesnt affect sqlite).

* refactor(mediasubscriber): make afterInsert and afterUpdate async and await internal operations

This should prevent unhandled promise rejections and ensure sequential execution of lifecycle
actions

---------

Co-authored-by: Gauthier <mail@gauthierth.fr>
2025-05-05 17:04:11 +09:00
..