feat: Add search terms and products added to cart widgets#429
Open
kallilsouza wants to merge 1 commit into
Open
feat: Add search terms and products added to cart widgets#429kallilsouza wants to merge 1 commit into
kallilsouza wants to merge 1 commit into
Conversation
- Introduced tests to validate the creation of the conversations dashboard, ensuring it persists with the expected fields and associated widgets. - Added checks for handling existing dashboards and rollback behavior during widget creation failures. - Refactored the dashboard creation logic to include widget creation within a transaction.
AlanJaeger
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
CreateConversationsDashboardto provision the conversations dashboard together with its initial widgets (conversations.search_termandconversations.product_added_to_cart) inside a single atomic transaction.CONVERSATIONS_DASHBOARD_WIDGETSconstant and a private_create_widgetshelper to centralize the list of default widgets.test_conversations_dashboard_creation.pycovering the happy path, duplicate-dashboard guard, and rollback behavior when widget creation fails.Why
The new widgets will be used to inform the frontend application to render the new cards for search terms and products added to cart.
Notes
Sequence diagram
sequenceDiagram participant Caller participant UseCase as CreateConversationsDashboard participant DB as Database participant DashboardModel as Dashboard participant WidgetModel as Widget Caller->>UseCase: create_dashboard(project) UseCase->>DashboardModel: filter(project, name=CONVERSATIONS_DASHBOARD_NAME).exists() DashboardModel->>DB: SELECT DB-->>DashboardModel: result DashboardModel-->>UseCase: exists? alt Dashboard already exists UseCase-->>Caller: raise Exception else Dashboard does not exist UseCase->>DB: BEGIN transaction UseCase->>DashboardModel: create(project, config, ...) DashboardModel->>DB: INSERT dashboard DB-->>DashboardModel: dashboard DashboardModel-->>UseCase: dashboard loop for each widget in CONVERSATIONS_DASHBOARD_WIDGETS UseCase->>WidgetModel: create(dashboard, name, type, source, ...) WidgetModel->>DB: INSERT widget DB-->>WidgetModel: widget end alt Any creation fails UseCase->>DB: ROLLBACK UseCase-->>Caller: raise Exception else All succeed UseCase->>DB: COMMIT UseCase-->>Caller: dashboard end end