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

feat(notifications): Update Subscription DTO to adopt common Address #549

Merged
merged 3 commits into from
Mar 17, 2021

Conversation

FelixTing
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

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?

  • Yes
  • No

New Imports

  • Yes
  • No

- 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>
@@ -144,3 +152,19 @@ func FromAddressModelToDTO(address models.Address) Address {
}
return dto
}

func ToAddressModels(channelDTOs []Address) []models.Address {
channelModels := make([]models.Address, len(channelDTOs))
Copy link
Member

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

Copy link
Member Author

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()
Copy link
Member

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.

Copy link
Member Author

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>
Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

LGTM

@lenny-goodell lenny-goodell merged commit 954b5ff into edgexfoundry:master Mar 17, 2021
@FelixTing FelixTing deleted the issue-545 branch March 18, 2021 04:04
This was referenced Mar 18, 2021
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.

[V2 notifications] Update Subscription DTO and model to adopt common Address
2 participants