-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description
Currently in GeoNode, resource creation, update, and related lifecycle operations are handled in different places across the codebase.
Some resource types, especially datasets, already use ResourceManager, while other resource types still implement their creation/update logic directly inside REST API views, for example DocumentViewSet.perform_create and MapViewSet.perform_create.
This makes common logic duplicated across different parts of the codebase. If something common needs to be added it should be added in different parts currently.
Create/update/delete operations on the resource should be handled by Resource Managers. REST APIs should use these classes to perform such operations, instead of performing them directly; otherwise, these operations cannot be executed outside REST API calls.
Current situation
- Datasets already use
ResourceManager, especially throughcreateandupdate - Other resource types still rely on
create/updatelogic implemented directly in REST APIs. - In some cases,
post_save()has been used as a workaround to run shared processing after creation, for exampleresourcebase_post_save(...).
Problems
- If logic stays inside API views, it cannot be reused consistently from non-API code paths
- Common logic is duplicated across different parts of the codebase
- Any shared change must currently be repeated in multiple resource-specific implementations
Goal
Introduce a centralized resource management flow so that:
- all resource types use manager-based handling
- common logic is defined once and reused
- APIs delegate to resource managers instead of implementing resource lifecycle directly
- the same behavior is available consistently from API and non-API code paths