-
Notifications
You must be signed in to change notification settings - Fork 65
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 v2 notifications routes #1787
Merged
Merged
Conversation
This file contains 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
iamacook
changed the title
Add
Add v2 notifications routes
Jul 31, 2024
/v1/accounts/:address/notifications/devices
routes
iamacook
force-pushed
the
notifications-routes
branch
from
July 31, 2024 14:41
9851454
to
e970dc0
Compare
hectorgomezv
reviewed
Aug 2, 2024
hectorgomezv
previously approved these changes
Aug 5, 2024
hectorgomezv
approved these changes
Aug 6, 2024
DenSmolonski
pushed a commit
to Zilliqa/safe-client-gateway
that referenced
this pull request
Oct 24, 2024
Adds v2 notifications routes for upserting push notification subscriptions/getting preferences, as well as deletion routes for Safe/device subscriptions: - `POST` `/v2/register/notifications` (guarded) - `GET` `/v2/chains/:chainId/notifications/devices/:deviceUuid/safes/:safeAddress` (guarded) - `DELETE` `/v2/chains/:chainId/notifications/devices/:deviceUuid/safes/:safeAddress` - `DELETE` `/v2/chains/:chainId/notifications/devices/:deviceUuid` - Create above routes in a new `NotificationsModuleV2` with associated service and controller, tweaking the respective repository/datasource in accordance. - Add relative validation for entities: - Create `UpsertSubscriptionsDto`, located on the route level and infer the type from it. - Create `UuidSchema`. - Remove `Uuid` entity in place of `crypto.UUID`. - Add appropriate tests.
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.
Summary
This adds SiWe-guard routes for upserting push notification subscriptions/getting preferences, as well as deletion routes for Safe/device subscriptions.
POST
/v2/register/notifications
(guarded)The
cloudMessagingToken
is the Firebase Cloud Messaging token for the device being registered. A UUID can be provided for this device, or one will be returned.Subscriptions are provided per chain-specific Safe, alongside the preferences of which notification types should be subscribed-to.
Note: the given preferences overwrites existing ones if upserting a subscription.
GET
/v2/chains/:chainId/notifications/devices/:deviceUuid/safes/:safeAddress
(guarded)This returns an array of
NotificationTypes
for the respective Safe.DELETE
/v2/chains/:chainId/notifications/devices/:deviceUuid/safes/:safeAddress
This deletes the device-specific subscription for the given Safe.
DELETE
/v2/chains/:chainId/notifications/devices/:deviceUuid
This deleted the device, and therefore all subscriptions associated with it.
Changes
NotificationsModuleV2
with associated service and controller, tweaking the respective repository/datasource in accordance.UpsertSubscriptionsDto
, located on the route level and infer the type from it.UuidSchema
.Uuid
entity in place ofcrypto.UUID
.