openedx / edx-enterprise

GNU Affero General Public License v3.0
43 stars 46 forks source link

fix: don't allow saving duplicate EnterpriseCatalogQuery content_filter #2179

Closed marlonkeating closed 1 month ago

marlonkeating commented 1 month ago

Problem

Jira Ticket

The EnterpriseCatalogQuery model is synced to a corresponding CatalogQuery model in enterprise-catalog. Currently, if we save a EnterpriseCatalogQuery with a content_filter value that is a duplicate of another, and try to update the corresponding CatalogQuery, the update will fail and the two entities will be in an inconsistent state.

Solution

When saving an EnterpriseCatalogQuery model with a changed content_filter, we will now check to see if the new content_filter already exists in enterprise-catalog, and raise a ValidationError if it does, showing an error on the admin page.

image

Merge checklist:

Post merge: