Skip to content

Commit

Permalink
feat: add new content authoring event signals
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Jul 3, 2023
1 parent 37a84a7 commit e8a9293
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ Change Log
Unreleased
----------

[8.3.0] - 2023-07-04
--------------------
Changed
~~~~~~~
* Added new XBLOCK_CREATED and XBLOCK_UPDATED events in content_authoring.
* Added new COURSE_CREATED and COURSE_UPDATED events in content_authoring.
* Added new CONTENT_LIBRARY_CREATED, CONTENT_LIBRARY_UPDATED and CONTENT_LIBRARY_DELETED events in content_authoring.
* Added new LIBRARY_BLOCK_CREATED, LIBRARY_BLOCK_UPDATED and LIBRARY_BLOCK_DELETED events in content_authoring.

[8.2.0] - 2023-06-08
--------------------
Changed
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__ = "8.2.0"
__version__ = "8.3.0"
12 changes: 12 additions & 0 deletions openedx_events/content_authoring/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
from opaque_keys.edx.keys import CourseKey, UsageKey


@attr.s(frozen=True)
class CourseData:
"""
Attributes defined for Open edX Course object.
Arguments:
course_key (str): identifier of the Course object.
"""

course_key = attr.ib(type=CourseKey)


@attr.s(frozen=True)
class CourseScheduleData:
"""
Expand Down
115 changes: 115 additions & 0 deletions openedx_events/content_authoring/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
They also must comply with the payload definition specified in
docs/decisions/0003-events-payload.rst
"""
from opaque_keys.edx.locator import LibraryLocatorV2, LibraryUsageLocatorV2

from openedx_events.content_authoring.data import (
CertificateConfigData,
CourseCatalogData,
DuplicatedXBlockData,
XBlockData,
)
from openedx_events.content_authoring.data import CourseData
from openedx_events.tooling import OpenEdxPublicSignal

# .. event_type: org.openedx.content_authoring.course.catalog_info.changed.v1
Expand All @@ -27,6 +29,27 @@
}
)

# .. event_type: org.openedx.content_authoring.xblock.created.v1
# .. event_name: XBLOCK_CREATED
# .. event_description: Fired when an XBlock is created.
# .. event_data: XBlockData
XBLOCK_CREATED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.xblock.created.v1",
data={
"xblock_info": XBlockData,
}
)

# .. event_type: org.openedx.content_authoring.xblock.updated.v1
# .. event_name: XBLOCK_UPDATED
# .. event_description: Fired when an XBlock is updated.
# .. event_data: XBlockData
XBLOCK_UPDATED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.xblock.updated.v1",
data={
"xblock_info": XBlockData,
}
)

# .. event_type: org.openedx.content_authoring.xblock.published.v1
# .. event_name: XBLOCK_PUBLISHED
Expand Down Expand Up @@ -92,3 +115,95 @@
"certificate_config": CertificateConfigData,
}
)

# .. event_type: org.openedx.content_authoring.course.created.v1
# .. event_name: COURSE_CREATED
# .. event_description: emitted when a course is created
# .. event_data: CourseData
COURSE_CREATED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.course.created.v1",
data={
"course": CourseData,
}
)

# .. event_type: org.openedx.content_authoring.course.updated.v1
# .. event_name: COURSE_UPDATED
# .. event_description: emitted when a course is created
# .. event_data: CourseData
COURSE_UPDATED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.course.updated.v1",
data={
"course": CourseData,
}
)

# .. event_type: org.openedx.content_authoring.content_library.created.v1
# .. event_name: CONTENT_LIBRARY_CREATED
# .. event_description: emitted when a content library is created
# .. event_data:
CONTENT_LIBRARY_CREATED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.content_library.created.v1",
data={
"library_key": LibraryLocatorV2,
}
)

# .. event_type: org.openedx.content_authoring.content_library.updated.v1
# .. event_name: CONTENT_LIBRARY_UPDATED
# .. event_description: emitted when a content library is updated
# .. event_data:
CONTENT_LIBRARY_UPDATED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.content_library.updated.v1",
data={
"library_key": LibraryLocatorV2,
"update_blocks": bool
}
)

# .. event_type: org.openedx.content_authoring.content_library.deleted.v1
# .. event_name: CONTENT_LIBRARY_DELETED
# .. event_description: emitted when a content library is deleted
# .. event_data:
CONTENT_LIBRARY_DELETED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.content_library.deleted.v1",
data={
"library_key": LibraryLocatorV2,
}
)

# .. event_type: org.openedx.content_authoring.library_block.created.v1
# .. event_name: LIBRARY_BLOCK_CREATED
# .. event_description: emitted when a library block is created
# .. event_data:
LIBRARY_BLOCK_CREATED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.library_block.created.v1",
data={
"library_key": LibraryLocatorV2,
"usage_key": LibraryUsageLocatorV2,
}
)

# .. event_type: org.openedx.content_authoring.library_block.updated.v1
# .. event_name: LIBRARY_BLOCK_UPDATED
# .. event_description: emitted when a library block is updated
# .. event_data:
LIBRARY_BLOCK_UPDATED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.library_block.updated.v1",
data={
"library_key": LibraryLocatorV2,
"usage_key": LibraryUsageLocatorV2,
}
)

# .. event_type: org.openedx.content_authoring.library_block.deleted.v1
# .. event_name: LIBRARY_BLOCK_DELETED
# .. event_description: emitted when a library block is deleted
# .. event_data:
LIBRARY_BLOCK_DELETED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.library_block.deleted.v1",
data={
"library_key": LibraryLocatorV2,
"usage_key": LibraryUsageLocatorV2,
}
)

0 comments on commit e8a9293

Please sign in to comment.