Skip to content

Commit

Permalink
feat: Add Content Library Collections signals
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuf-musleh committed Aug 26, 2024
1 parent 0e47ee1 commit 8101eb4
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Change Log
Unreleased
----------

Added
~~~~~
* Added new ``LIBRARY_COLLECTION_CREATED``, ``LIBRARY_COLLECTION_UPDATED`` and ``LIBRARY_COLLECTION_DELETED`` events in content_authoring.

[9.12.0] - 2024-07-31
---------------------

Expand Down
2 changes: 1 addition & 1 deletion openedx_events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
more information about the project.
"""

__version__ = "9.12.0"
__version__ = "9.13.0"
14 changes: 14 additions & 0 deletions openedx_events/content_authoring/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,17 @@ class ContentObjectData:
"""

object_id = attr.ib(type=str)


@attr.s(frozen=True)
class LibraryCollectionData:
"""
Data about changed content library Collection.
Arguments:
library_key (LibraryLocatorV2): a key that represents a Blockstore-based content library.
collection_id (int): an id (pk) that represents a collection associated with the content library.
"""

library_key = attr.ib(type=LibraryLocatorV2)
collection_id = attr.ib(type=int)
34 changes: 34 additions & 0 deletions openedx_events/content_authoring/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
CourseData,
DuplicatedXBlockData,
LibraryBlockData,
LibraryCollectionData,
XBlockData,
)
from openedx_events.tooling import OpenEdxPublicSignal
Expand Down Expand Up @@ -210,3 +211,36 @@
"content_object": ContentObjectData
}
)

# .. event_type: org.openedx.content_authoring.content.library.collection.created.v1
# .. event_name: LIBRARY_COLLECTION_CREATED
# .. event_description: emitted when a content library collection is created
# .. event_data: LibraryCollectionData
LIBRARY_COLLECTION_CREATED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.content.library.collection.created.v1",
data={
"library_collection": LibraryCollectionData
}
)

# .. event_type: org.openedx.content_authoring.content.library.collection.updated.v1
# .. event_name: LIBRARY_COLLECTION_UPDATED
# .. event_description: emitted when when a content library collection is updated
# .. event_data: LibraryCollectionData
LIBRARY_COLLECTION_UPDATED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.content.library.collection.updated.v1",
data={
"library_collection": LibraryCollectionData
}
)

# .. event_type: org.openedx.content_authoring.content.library.collection.deleted.v1
# .. event_name: LIBRARY_COLLECTION_DELETED
# .. event_description: emitted when an when a content library collection is deleted
# .. event_data: LibraryCollectionData
LIBRARY_COLLECTION_DELETED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.content.library.collection.deleted.v1",
data={
"library_collection": LibraryCollectionData
}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "library_collection",
"type": {
"name": "LibraryCollectionData",
"type": "record",
"fields": [
{
"name": "library_key",
"type": "string"
},
{
"name": "collection_id",
"type": "long"
}
]
}
}
],
"namespace": "org.openedx.content_authoring.content.library.collection.created.v1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "library_collection",
"type": {
"name": "LibraryCollectionData",
"type": "record",
"fields": [
{
"name": "library_key",
"type": "string"
},
{
"name": "collection_id",
"type": "long"
}
]
}
}
],
"namespace": "org.openedx.content_authoring.content.library.collection.deleted.v1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "library_collection",
"type": {
"name": "LibraryCollectionData",
"type": "record",
"fields": [
{
"name": "library_key",
"type": "string"
},
{
"name": "collection_id",
"type": "long"
}
]
}
}
],
"namespace": "org.openedx.content_authoring.content.library.collection.updated.v1"
}

0 comments on commit 8101eb4

Please sign in to comment.