-
Notifications
You must be signed in to change notification settings - Fork 68
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
feat(notifications): Update Subscription DTO to adopt common Address #549
Conversation
- Add type EMAIL to the "oneof" validation of Address DTO - Replace Channel DTO with Address DTO - Replace Channel model with Address model Signed-off-by: Felix Ting <felix@iotechsys.com>
v2/dtos/address.go
Outdated
@@ -144,3 +152,19 @@ func FromAddressModelToDTO(address models.Address) Address { | |||
} | |||
return dto | |||
} | |||
|
|||
func ToAddressModels(channelDTOs []Address) []models.Address { | |||
channelModels := make([]models.Address, len(channelDTOs)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why channelModels
and channelModels
when this is Addresses
? how about just dtos
& models
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a copy-paste mistake. Modified. 99ccf6c
return errors.NewCommonEdgeXWrapper(err) | ||
} | ||
for _, c := range request.Subscription.Channels { | ||
err = c.Validate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using Address
DTO for Channels
are MQTT
is not a valid type of channel for subscriptions? Will this validation fail appropriately
when MQTT is the type? i.e. something like MQTT is not valid type for Channel
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Thanks! Channel type check has been added. 3e070a1
Signed-off-by: Felix Ting <felix@iotechsys.com>
Signed-off-by: Felix Ting <felix@iotechsys.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR Checklist
Please check if your PR fulfills the following requirements:
If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/go-mod-core-contracts/blob/master/.github/Contributing.md.
What is the current behavior?
Issue Number: #545
What is the new behavior?
Subscription Channel is of type Address.
Close #545
Does this PR introduce a breaking change?
New Imports