diff --git a/invenio_config_tuw/curations/requests.py b/invenio_config_tuw/curations/requests.py index abc0625cff6e31023e726ee551243f3de5784670..7adf3fdc82ecaa256130a4b3c0b0ce305cb8b609 100644 --- a/invenio_config_tuw/curations/requests.py +++ b/invenio_config_tuw/curations/requests.py @@ -26,6 +26,15 @@ from invenio_users_resources.notifications.generators import UserRecipient from ..notifications import TUWTaskOp from .tasks import auto_review_curation_request +# Notification builders +# --------------------- +# They are used to generate notifications, and will primarily be used by the request +# actions (see below). +# Each notification builder has information about the target audience (recipients & +# recipient filters), and means to extract relevant information from the notification +# context. +# The generated notifications will be handled by the registered notification backend. + class TUWCurationRequestUploaderResubmitNotificationBuilder( CurationRequestActionNotificationBuilder @@ -52,6 +61,15 @@ class TUWCurationRequestReviewNotificationBuilder( ] +# Request actions +# --------------- +# Requests are effectively state machines, which have states and transitions. +# The transitions are modeled via the "request actions", and they perform some +# code operation on activation. +# These operations typically also include the generation of notifications via +# notification builders (see above). + + class TUWCurationResubmitAction(CurationResubmitAction): """Notify both uploader and reviewer on resubmit, and auto-review.""" @@ -97,6 +115,12 @@ class TUWCurationCreateAndSubmitAction(CurationCreateAndSubmitAction): return super().execute(identity, uow) +# Request type +# ------------ +# As mentioned above, requests are basically state machines. +# The individual pieces (e.g. request actions) are registered in the request type. + + class TUWCurationRequest(CurationRequest): """Customized curation request class with modified resubmit action."""