Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add event and device tracking to answers (M2-8482) #1754

Conversation

rcmerlo
Copy link
Contributor

@rcmerlo rcmerlo commented Feb 24, 2025

  • Tests for the changes have been added
  • Related documentation has been added / updated
  • For new features, QA automation engineers have been tagged
  • OSS packages added to MindLogger open source credit page

📝 Description

  • Introduced event_history_id and device_id fields in the answer schema.
  • Updated services to handle new fields, including validation for event existence.
  • Added tests for creating answers with these new fields.
  • Implemented database migrations to support the new columns.

🔗 Jira Ticket M2-8482

@rcmerlo
Copy link
Contributor Author

rcmerlo commented Feb 24, 2025

@egodoy-metalab @Phillipe-Bojorquez This PR adds new fields to /answers endpoint, we may need to update tests

@rcmerlo rcmerlo requested review from ChaconC, farmerpaul, mbanting and sultanofcardio and removed request for ChaconC and farmerpaul February 24, 2025 21:18
Copy link

github-actions bot commented Feb 24, 2025

➡️ Preview environment failed to be destroyed

Copy link

❌ E2E tests failed

Copy link
Contributor

@sultanofcardio sultanofcardio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work getting this out so quickly @rcmerlo. Unfortunately I forgot to call attention to the format of the event_history_id, so we'll need a few changes

Copy link
Contributor

@sultanofcardio sultanofcardio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing my previous comments @rcmerlo. I think we're very close, just a few other things I noticed

Copy link
Contributor

@farmerpaul farmerpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are passing with the web app PR, nice work! Just one last request.

Copy link
Contributor

@farmerpaul farmerpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, pending @sultanofcardio's last change request.

@rcmerlo rcmerlo force-pushed the M2-8482-BE-Update-answers-endpoint-to-accept-schedule-version-and-device-ID branch from d97b6ed to e62a913 Compare February 26, 2025 23:39
Copy link
Contributor

@sultanofcardio sultanofcardio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work

- Introduced `event_history_id` and `device_id` fields in the answer schema.
- Updated services to handle new fields, including validation for event existence.
- Added tests for creating answers with these new fields.
- Implemented database migrations to support the new columns.
- Bumped version of `boto3` to 1.37.*
- Updated `nh3` to use a wildcard version
- Upgraded `ddtrace` to 2.21.*
- Added new package `izulu` with version 0.5.4
- Added `device_id` as a header parameter in the API.
- Integrated `UserDeviceService` to validate `device_id`.
- Updated answer creation logic to include `device_id`.
- Removed `device_id` from the domain model.
- Enhanced tests for device ID scenarios, including invalid cases.
- Fixed a bug in schedule history retrieval by correcting variable name.

Enhance device and event validation logic

- Updated device retrieval to check both device_id and user_id.
- Enhanced event history lookup with activity or flow ID validation.
- Modified test data for consistency with new logic.
- Added SQLAlchemy case statement for conditional queries.

Refactor device and event history checks

- Updated `aio-pika` to version 9.5.5 in dependencies.
- Simplified device validation by removing user ID check from the query.
- Streamlined event history validation logic, removing complex query conditions.
- Removed unused imports and redundant methods for cleaner codebase.
- Adjusted database migration down_revision for consistency.
- Replaced `UserDeviceService` with `UserDeviceEventsHistoryCRUD` for device validation.
- Added a new method `get_device` in `UserDeviceEventsHistoryCRUD`.
- Updated logic to validate devices based on event history.
- Modified test cases to align with the new device validation approach.
- Removed unused imports and code related to the old device service.
- Added a new migration script to merge two branches.
- Defined revision identifiers for Alembic.
- Included empty upgrade and downgrade functions.
@rcmerlo rcmerlo force-pushed the M2-8482-BE-Update-answers-endpoint-to-accept-schedule-version-and-device-ID branch from e62a913 to f5b47b6 Compare February 27, 2025 14:58
@rcmerlo rcmerlo merged commit 2f87a47 into develop Feb 27, 2025
8 of 10 checks passed
@rcmerlo rcmerlo deleted the M2-8482-BE-Update-answers-endpoint-to-accept-schedule-version-and-device-ID branch February 27, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants