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

notification: move message definitions to nfymsg package #4027

Merged
merged 29 commits into from
Aug 2, 2024
Merged

Conversation

mastercactapus
Copy link
Member

Description:
Moves message definitions to a separate package to prevent import cycles when moving sender definitions to the nfydest.Registry (needs to point to messages, but notification pkg needs to point to nfydest)

  • No code changes aside from dropping hard-coded strings for state in favor of using the helper function for search.

- Added `Equal` method to `DestV1` for comparison.
- Consolidated `type` and `value` fields into `dest`.
- Adjusted SQL queries and methods to handle `dest`.
- Updated ContactMethod normalization and validation logic.
- Introduced destination registry for contact methods.
- Modified tests to reflect the new structure.
- Switched resolver methods for `dest` and `type` fields
- Deprecated `value` and `type` fields in schema in favor of `dest`
- Removed redundant `Dest` resolver and its related code
- Deleted `contactmethod_test` file
- Test was redundant and covered elsewhere
- Removed CompatCMToDest function
- Updated method to use obj.Dest directly for DisplayInfo
- Removed unnecessary validation logic for input fields
- Streamlined the creation of the contact method object
- Dropped dependencies on several unused packages to clean up imports
- Retrieve and use additional type information to determine support and requirement for status updates
- Simplify conditions by removing redundant checks
- Refactor hard-coded email and webhook destination types
- Improve code maintainability and reduce import cycles risk
- Ensure proper error handling for unknown field IDs and destination types.
- Fix missing return statements in Twilio SMS and Voice validation functions.
- Added stub-notifiers to Procfile variations
- Configured fake Twilio credentials for testing
- Deleted Type field and related Value field from ContactMethod
- Removed type.go file and associated logic
- Cleanup to simplify code and remove unused functionality
- Added Twilio destination type to contact methods
- Updated data generation to set Twilio SMS/Voice types
- Modified database columns and data population logic
- Added support for dynamic notification destination types.
- Refactored SQL queries to handle flexible destination types.
- Removed hardcoded 'SLACK_DM' to allow for more adaptable updates.
- Incorporated nfydest.Registry for better type management.
- Removed hard-coded destination types for contact methods
- Simplified contact method database fields
- Updated search parameters and query to use new destination fields
- Removed unused imports and validation logic
- Remove redundant SQL statement
- Delete unused `cmtype.go`
- Replace contact method types with a new enum
- Simplify and normalize destination creation
- Add validation for input values in mutations
- Eliminated unneeded `if err != nil` checks in `Channel` and `ListChannels` methods to streamline error handling.
- Added CompatCMTypeValToDest helper function
- Refactored CreateUserContactMethod to use new helper
- Simplified user search logic to use new CompatCMTypeValToDest function
- Removed redundant import statements
- Check if DestArgs length is 0 rather than just existence
- Fixed handling of CMType and CMValue to avoid null issues
- Corrected SQL queries to properly check DestArgs length
- Moved message-related types and functions to `nfymsg` subpackage for better organization.
- Introduced `compat.go` for backwards compatibility.
- Renamed and relocated message handling and status files.
- Removed redundant status definitions from the base notification package.
- Added new alert states and constants to `compat.go`
- Removed obsolete `AlertPendingNotification` type
- Standardized the use of `nfymsg` constants in `store.go`
- Cleaned up `messagetype.go` to remove redundant type definition
Correctly reference `s.Age` property and method to ensure accurate alert notification state formatting based on age.
Corrected the error message assertion to use the appropriate enum name "nfymsg.ScheduleOnCallUsers" for consistency and accuracy in test validations.
- Added enum-based LastStatus mapping
- Improved accuracy of status representation
- Consolidate status mapping logic into helper function
- Add error handling for status conversion
@github-actions github-actions bot added the size/m label Aug 1, 2024
@mastercactapus mastercactapus merged commit 54c10c7 into master Aug 2, 2024
7 checks passed
@mastercactapus mastercactapus deleted the nfymsg branch August 2, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants