diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cef5f79e..ce5724e5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,15 @@ Change Log Unreleased __________ +[9.20.0] - 2025-03-15 +--------------------- + +Added +~~~~~ + +* Added new ``LIBRARY_CONTAINER_CREATED``, ``LIBRARY_CONTAINER_UPDATED`` and ``LIBRARY_CONTAINER_DELETED`` events in content_authoring. +* Adds ``LibraryContainerData`` to support these events + [9.19.0] - 2025-03-14 --------------------- diff --git a/openedx_events/__init__.py b/openedx_events/__init__.py index 0f5e2b97..d03641ae 100644 --- a/openedx_events/__init__.py +++ b/openedx_events/__init__.py @@ -5,4 +5,4 @@ more information about the project. """ -__version__ = "9.19.0" +__version__ = "9.20.0" diff --git a/openedx_events/content_authoring/data.py b/openedx_events/content_authoring/data.py index 8e0be317..3f13887b 100644 --- a/openedx_events/content_authoring/data.py +++ b/openedx_events/content_authoring/data.py @@ -218,7 +218,7 @@ class LibraryCollectionData: Data related to a library collection that has changed. Attributes: - library_key (LibraryLocatorV2): a key that represents a Blockstore-based content library. + library_key (LibraryLocatorV2): a key that represents a content library. collection_key (str): identifies the collection within the library's learning package background (bool): indicate whether the sender doesn't want to wait for handler to finish execution, i.e., the handler can run the task in background. By default it is False. @@ -227,3 +227,20 @@ class LibraryCollectionData: library_key = attr.ib(type=LibraryLocatorV2) collection_key = attr.ib(type=str) background = attr.ib(type=bool, default=False) + + +@attr.s(frozen=True) +class LibraryContainerData: + """ + Data related to a library container that has changed. + + Attributes: + library_key (LibraryLocatorV2): a key that represents a content library. + container_key (str): identifies the container within the library's learning package (e.g. unit, section) + background (bool): indicate whether the sender doesn't want to wait for handler to finish execution, + i.e., the handler can run the task in background. By default it is False. + """ + + library_key = attr.ib(type=LibraryLocatorV2) + container_key = attr.ib(type=str) + background = attr.ib(type=bool, default=False) diff --git a/openedx_events/content_authoring/signals.py b/openedx_events/content_authoring/signals.py index cd01375d..c063a9b1 100644 --- a/openedx_events/content_authoring/signals.py +++ b/openedx_events/content_authoring/signals.py @@ -17,6 +17,7 @@ DuplicatedXBlockData, LibraryBlockData, LibraryCollectionData, + LibraryContainerData, XBlockData, ) from openedx_events.tooling import OpenEdxPublicSignal @@ -277,6 +278,42 @@ } ) +# .. event_type: org.openedx.content_authoring.content_library.container.created.v1 +# .. event_name: LIBRARY_CONTAINER_CREATED +# .. event_description: Emitted when a content library container is created. +# .. event_data: LibraryContainerData +# .. event_trigger_repository: openedx/edx-platform +LIBRARY_CONTAINER_CREATED = OpenEdxPublicSignal( + event_type="org.openedx.content_authoring.content_library.container.created.v1", + data={ + "library_container": LibraryContainerData + } +) + +# .. event_type: org.openedx.content_authoring.content_library.container.updated.v1 +# .. event_name: LIBRARY_CONTAINER_UPDATED +# .. event_description: Emitted when when a content library container is updated. +# .. event_data: LibraryContainerData +# .. event_trigger_repository: openedx/edx-platform +LIBRARY_CONTAINER_UPDATED = OpenEdxPublicSignal( + event_type="org.openedx.content_authoring.content_library.container.updated.v1", + data={ + "library_container": LibraryContainerData + } +) + +# .. event_type: org.openedx.content_authoring.content_library.container.deleted.v1 +# .. event_name: LIBRARY_CONTAINER_DELETED +# .. event_description: Emitted when an when a content library container is deleted. +# .. event_data: LibraryContainerData +# .. event_trigger_repository: openedx/edx-platform +LIBRARY_CONTAINER_DELETED = OpenEdxPublicSignal( + event_type="org.openedx.content_authoring.content_library.container.deleted.v1", + data={ + "library_container": LibraryContainerData + } +) + # .. event_type: org.openedx.content_authoring.course.import.completed.v1 # .. event_name: COURSE_IMPORT_COMPLETED # .. event_key_field: catalog_info.course_key diff --git a/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content_library+container+created+v1_schema.avsc b/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content_library+container+created+v1_schema.avsc new file mode 100644 index 00000000..ef16b300 --- /dev/null +++ b/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content_library+container+created+v1_schema.avsc @@ -0,0 +1,29 @@ +{ + "name": "CloudEvent", + "type": "record", + "doc": "Avro Event Format for CloudEvents created with openedx_events/schema", + "fields": [ + { + "name": "library_container", + "type": { + "name": "LibraryContainerData", + "type": "record", + "fields": [ + { + "name": "library_key", + "type": "string" + }, + { + "name": "container_key", + "type": "string" + }, + { + "name": "background", + "type": "boolean" + } + ] + } + } + ], + "namespace": "org.openedx.content_authoring.content_library.container.created.v1" +} diff --git a/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content_library+container+deleted+v1_schema.avsc b/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content_library+container+deleted+v1_schema.avsc new file mode 100644 index 00000000..5218e795 --- /dev/null +++ b/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content_library+container+deleted+v1_schema.avsc @@ -0,0 +1,29 @@ +{ + "name": "CloudEvent", + "type": "record", + "doc": "Avro Event Format for CloudEvents created with openedx_events/schema", + "fields": [ + { + "name": "library_container", + "type": { + "name": "LibraryContainerData", + "type": "record", + "fields": [ + { + "name": "library_key", + "type": "string" + }, + { + "name": "container_key", + "type": "string" + }, + { + "name": "background", + "type": "boolean" + } + ] + } + } + ], + "namespace": "org.openedx.content_authoring.content_library.container.deleted.v1" +} diff --git a/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content_library+container+updated+v1_schema.avsc b/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content_library+container+updated+v1_schema.avsc new file mode 100644 index 00000000..231e57ee --- /dev/null +++ b/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content_library+container+updated+v1_schema.avsc @@ -0,0 +1,29 @@ +{ + "name": "CloudEvent", + "type": "record", + "doc": "Avro Event Format for CloudEvents created with openedx_events/schema", + "fields": [ + { + "name": "library_container", + "type": { + "name": "LibraryContainerData", + "type": "record", + "fields": [ + { + "name": "library_key", + "type": "string" + }, + { + "name": "container_key", + "type": "string" + }, + { + "name": "background", + "type": "boolean" + } + ] + } + } + ], + "namespace": "org.openedx.content_authoring.content_library.container.updated.v1" +}