Skip to content

Commit

Permalink
[SDESK-7386] Add Resource Data & Web signals (#2817)
Browse files Browse the repository at this point in the history
* Move types to type module

* Improve resources code layout

* Improve mongo code layout

* Add new functionality to signal module

* Add on_resource_registered signal

* Add resource data & web signals

* Fix some behave tests

* Update comments.on_created to async

* Add tests

* add/update docs

* fix: add deleted file to commits
  • Loading branch information
MarkLark86 authored Jan 19, 2025
1 parent 6826a5b commit ec8da4c
Show file tree
Hide file tree
Showing 33 changed files with 1,581 additions and 488 deletions.
4 changes: 2 additions & 2 deletions apps/comments/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def on_fetched(self, doc):
decode_keys(item, "mentioned_users")
decode_keys(item, "mentioned_desks")

def on_created(self, docs):
async def on_created(self, docs):
for doc in docs:
if self.notifications:
push_notification(self.notification_key, item=str(doc.get("item")))
Expand All @@ -102,7 +102,7 @@ def on_created(self, docs):

if self.notifications:
# TODO-ASYNC: Support async (see superdesk.tests.markers.requires_eve_resource_async_event)
notify_mentioned_users(docs, get_app_config("CLIENT_URL", "").rstrip("/"))
await notify_mentioned_users(docs, get_app_config("CLIENT_URL", "").rstrip("/"))
notify_mentioned_desks(docs)

def on_updated(self, updates, original):
Expand Down
2 changes: 1 addition & 1 deletion docs/core/elastic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The :attr:`get_client_async <resources.ElasticResources.get_client>` method retu

Elastic References
------------------
.. autoclass:: superdesk.core.elastic.common.ElasticResourceConfig
.. autoclass:: superdesk.core.types.ElasticResourceConfig
:member-order: bysource
:members:

Expand Down
6 changes: 3 additions & 3 deletions docs/core/mongo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ The :attr:`get_db_async <MongoResources.get_db_async>` method returns an instanc

Mongo References
----------------
.. autoclass:: superdesk.core.mongo.MongoResourceConfig
.. autoclass:: superdesk.core.types.MongoResourceConfig
:member-order: bysource
:members:

.. autoclass:: superdesk.core.mongo.MongoIndexOptions
.. autoclass:: superdesk.core.types.MongoIndexOptions
:member-order: bysource
:members:

.. autoclass:: superdesk.core.mongo.MongoIndexCollation
.. autoclass:: superdesk.core.types.MongoIndexCollation
:member-order: bysource
:members:

Expand Down
8 changes: 4 additions & 4 deletions docs/core/resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,8 @@ The :meth:`Resources.register <model.Resources.register>` method provides a way
using the :class:`ResourceConfig <model.ResourceConfig>` class to provide the resource config.

This will register the resource with MongoDB and optionally the Elasticsearch system. See
:class:`MongoResourceConfig <superdesk.core.mongo.MongoResourceConfig>` and
:class:`ElasticResourceConfig <superdesk.core.elastic.common.ElasticResourceConfig>` for MongoDB and Elastic config options.
:class:`MongoResourceConfig <superdesk.core.types.MongoResourceConfig>` and
:class:`ElasticResourceConfig <superdesk.core.types.ElasticResourceConfig>` for MongoDB and Elastic config options.

Example module::

Expand Down Expand Up @@ -599,7 +599,7 @@ You can also use the ``resources`` config from a Module to automatically registe
API References
--------------

.. autoclass:: superdesk.core.resources.model.Resources
.. autoclass:: superdesk.core.resources.resource_manager.Resources
:member-order: bysource
:members:

Expand All @@ -614,7 +614,7 @@ Resource Model
:member-order: bysource
:members: id

.. autoclass:: superdesk.core.resources.model.ResourceConfig
.. autoclass:: superdesk.core.resources.resource_config.ResourceConfig
:member-order: bysource
:members:

Expand Down
Loading

0 comments on commit ec8da4c

Please sign in to comment.