diff --git a/openedx_events/content_authoring/data.py b/openedx_events/content_authoring/data.py index e55cc871..4fc3b899 100644 --- a/openedx_events/content_authoring/data.py +++ b/openedx_events/content_authoring/data.py @@ -191,9 +191,13 @@ class ContentObjectData: object_id (str): identifier of the Content object. This represents the id of the course or library block as a string. For example: block-v1:SampleTaxonomyOrg2+STC1+2023_1+type@vertical+block@f8de78f0897049ce997777a3a31b6ea0 + + changes: list of changes made to this ContentObject, e.g. "tags", "collections", "metadata" + If list is empty, assume everything has changed. """ object_id = attr.ib(type=str) + changes = attr.ib(type=List[str], factory=list) @attr.s(frozen=True) diff --git a/openedx_events/content_authoring/signals.py b/openedx_events/content_authoring/signals.py index 2b00ea15..05366c4c 100644 --- a/openedx_events/content_authoring/signals.py +++ b/openedx_events/content_authoring/signals.py @@ -201,12 +201,13 @@ } ) -# .. event_type: org.openedx.content_authoring.content.object.tags.changed.v1 -# .. event_name: CONTENT_OBJECT_TAGS_CHANGED -# .. event_description: emitted when an object's tags are changed +# .. event_type: org.openedx.content_authoring.content.object.associations.changed.v1 +# .. event_name: CONTENT_OBJECT_ASSOCIATIONS_CHANGED +# .. event_description: emitted when an object's associations are changed. +# See content_object.changes for what changed, e.g "tags", "collections" # .. event_data: ContentObjectData -CONTENT_OBJECT_TAGS_CHANGED = OpenEdxPublicSignal( - event_type="org.openedx.content_authoring.content.object.tags.changed.v1", +CONTENT_OBJECT_ASSOCIATIONS_CHANGED = OpenEdxPublicSignal( + event_type="org.openedx.content_authoring.content.object.associations.changed.v1", data={ "content_object": ContentObjectData } diff --git a/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content+object+tags+changed+v1_schema.avsc b/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content+object+associations+changed+v1_schema.avsc similarity index 62% rename from openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content+object+tags+changed+v1_schema.avsc rename to openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content+object+associations+changed+v1_schema.avsc index e7e3c156..3dc385d3 100644 --- a/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content+object+tags+changed+v1_schema.avsc +++ b/openedx_events/event_bus/avro/tests/schemas/org+openedx+content_authoring+content+object+associations+changed+v1_schema.avsc @@ -12,10 +12,17 @@ { "name": "object_id", "type": "string" + }, + { + "name": "changes", + "type": { + "type": "array", + "items": "string" + } } ] } } ], - "namespace": "org.openedx.content_authoring.content.object.tags.changed.v1" + "namespace": "org.openedx.content_authoring.content.object.associations.changed.v1" } \ No newline at end of file diff --git a/openedx_events/event_bus/avro/tests/test_avro.py b/openedx_events/event_bus/avro/tests/test_avro.py index 4d564b27..87634067 100644 --- a/openedx_events/event_bus/avro/tests/test_avro.py +++ b/openedx_events/event_bus/avro/tests/test_avro.py @@ -108,6 +108,7 @@ def generate_test_event_data_for_data_type(data_type): # pragma: no cover LibraryLocatorV2: LibraryLocatorV2.from_string('lib:MITx:reallyhardproblems'), LibraryUsageLocatorV2: LibraryUsageLocatorV2.from_string('lb:MITx:reallyhardproblems:problem:problem1'), List[int]: [1, 2, 3], + List[str]: ["hi", "there"], datetime: datetime.now(), CCXLocator: CCXLocator(org='edx', course='DemoX', run='Demo_course', ccx='1'), UUID: uuid4(),