Skip to content

Commit 77d67b0

Browse files
authored
feat: adds events related to content library containers [FC-0083] (openedx#479)
* feat: adds events related to content library containers * chore: bumps version & adds changelog
1 parent 7d02456 commit 77d67b0

7 files changed

+152
-2
lines changed

CHANGELOG.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ Change Log
1616
Unreleased
1717
__________
1818

19+
[9.20.0] - 2025-03-15
20+
---------------------
21+
22+
Added
23+
~~~~~
24+
25+
* Added new ``LIBRARY_CONTAINER_CREATED``, ``LIBRARY_CONTAINER_UPDATED`` and ``LIBRARY_CONTAINER_DELETED`` events in content_authoring.
26+
* Adds ``LibraryContainerData`` to support these events
27+
1928
[9.19.0] - 2025-03-14
2029
---------------------
2130

openedx_events/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
more information about the project.
66
"""
77

8-
__version__ = "9.19.0"
8+
__version__ = "9.20.0"

openedx_events/content_authoring/data.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class LibraryCollectionData:
218218
Data related to a library collection that has changed.
219219
220220
Attributes:
221-
library_key (LibraryLocatorV2): a key that represents a Blockstore-based content library.
221+
library_key (LibraryLocatorV2): a key that represents a content library.
222222
collection_key (str): identifies the collection within the library's learning package
223223
background (bool): indicate whether the sender doesn't want to wait for handler to finish execution,
224224
i.e., the handler can run the task in background. By default it is False.
@@ -227,3 +227,20 @@ class LibraryCollectionData:
227227
library_key = attr.ib(type=LibraryLocatorV2)
228228
collection_key = attr.ib(type=str)
229229
background = attr.ib(type=bool, default=False)
230+
231+
232+
@attr.s(frozen=True)
233+
class LibraryContainerData:
234+
"""
235+
Data related to a library container that has changed.
236+
237+
Attributes:
238+
library_key (LibraryLocatorV2): a key that represents a content library.
239+
container_key (str): identifies the container within the library's learning package (e.g. unit, section)
240+
background (bool): indicate whether the sender doesn't want to wait for handler to finish execution,
241+
i.e., the handler can run the task in background. By default it is False.
242+
"""
243+
244+
library_key = attr.ib(type=LibraryLocatorV2)
245+
container_key = attr.ib(type=str)
246+
background = attr.ib(type=bool, default=False)

openedx_events/content_authoring/signals.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
DuplicatedXBlockData,
1818
LibraryBlockData,
1919
LibraryCollectionData,
20+
LibraryContainerData,
2021
XBlockData,
2122
)
2223
from openedx_events.tooling import OpenEdxPublicSignal
@@ -277,6 +278,42 @@
277278
}
278279
)
279280

281+
# .. event_type: org.openedx.content_authoring.content_library.container.created.v1
282+
# .. event_name: LIBRARY_CONTAINER_CREATED
283+
# .. event_description: Emitted when a content library container is created.
284+
# .. event_data: LibraryContainerData
285+
# .. event_trigger_repository: openedx/edx-platform
286+
LIBRARY_CONTAINER_CREATED = OpenEdxPublicSignal(
287+
event_type="org.openedx.content_authoring.content_library.container.created.v1",
288+
data={
289+
"library_container": LibraryContainerData
290+
}
291+
)
292+
293+
# .. event_type: org.openedx.content_authoring.content_library.container.updated.v1
294+
# .. event_name: LIBRARY_CONTAINER_UPDATED
295+
# .. event_description: Emitted when when a content library container is updated.
296+
# .. event_data: LibraryContainerData
297+
# .. event_trigger_repository: openedx/edx-platform
298+
LIBRARY_CONTAINER_UPDATED = OpenEdxPublicSignal(
299+
event_type="org.openedx.content_authoring.content_library.container.updated.v1",
300+
data={
301+
"library_container": LibraryContainerData
302+
}
303+
)
304+
305+
# .. event_type: org.openedx.content_authoring.content_library.container.deleted.v1
306+
# .. event_name: LIBRARY_CONTAINER_DELETED
307+
# .. event_description: Emitted when an when a content library container is deleted.
308+
# .. event_data: LibraryContainerData
309+
# .. event_trigger_repository: openedx/edx-platform
310+
LIBRARY_CONTAINER_DELETED = OpenEdxPublicSignal(
311+
event_type="org.openedx.content_authoring.content_library.container.deleted.v1",
312+
data={
313+
"library_container": LibraryContainerData
314+
}
315+
)
316+
280317
# .. event_type: org.openedx.content_authoring.course.import.completed.v1
281318
# .. event_name: COURSE_IMPORT_COMPLETED
282319
# .. event_key_field: catalog_info.course_key
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "CloudEvent",
3+
"type": "record",
4+
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
5+
"fields": [
6+
{
7+
"name": "library_container",
8+
"type": {
9+
"name": "LibraryContainerData",
10+
"type": "record",
11+
"fields": [
12+
{
13+
"name": "library_key",
14+
"type": "string"
15+
},
16+
{
17+
"name": "container_key",
18+
"type": "string"
19+
},
20+
{
21+
"name": "background",
22+
"type": "boolean"
23+
}
24+
]
25+
}
26+
}
27+
],
28+
"namespace": "org.openedx.content_authoring.content_library.container.created.v1"
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "CloudEvent",
3+
"type": "record",
4+
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
5+
"fields": [
6+
{
7+
"name": "library_container",
8+
"type": {
9+
"name": "LibraryContainerData",
10+
"type": "record",
11+
"fields": [
12+
{
13+
"name": "library_key",
14+
"type": "string"
15+
},
16+
{
17+
"name": "container_key",
18+
"type": "string"
19+
},
20+
{
21+
"name": "background",
22+
"type": "boolean"
23+
}
24+
]
25+
}
26+
}
27+
],
28+
"namespace": "org.openedx.content_authoring.content_library.container.deleted.v1"
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "CloudEvent",
3+
"type": "record",
4+
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
5+
"fields": [
6+
{
7+
"name": "library_container",
8+
"type": {
9+
"name": "LibraryContainerData",
10+
"type": "record",
11+
"fields": [
12+
{
13+
"name": "library_key",
14+
"type": "string"
15+
},
16+
{
17+
"name": "container_key",
18+
"type": "string"
19+
},
20+
{
21+
"name": "background",
22+
"type": "boolean"
23+
}
24+
]
25+
}
26+
}
27+
],
28+
"namespace": "org.openedx.content_authoring.content_library.container.updated.v1"
29+
}

0 commit comments

Comments
 (0)