Skip to content

Commit

Permalink
fix: 🎨 misc PR comment address
Browse files Browse the repository at this point in the history
added non-visibility of notification_delivery_* entities
  • Loading branch information
ignazio-bovo committed Aug 16, 2023
1 parent 96ff8b7 commit 59de8ed
Show file tree
Hide file tree
Showing 6 changed files with 265 additions and 276 deletions.
2 changes: 2 additions & 0 deletions db/migrations/2000000000000-Views.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ module.exports = class Views2000000000000 {
report: ['FALSE'],
exclusion: ['FALSE'],
session: ['FALSE'],
notification_email_delivery: ['FALSE'],
notification_in_app_delivery: ['FALSE'],
channel_verification: ['FALSE'],
channel_suspension: ['FALSE'],
user: ['FALSE'],
Expand Down
66 changes: 33 additions & 33 deletions schema/auth.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -117,41 +117,41 @@ type Account @entity {
}

type AccountNotificationPreferences {
# channel notifications: https://www.figma.com/file/zi5siPUXme0Fivq2i40XBd/My-channel?type=design&node-id=1721-82420&mode=design
channelExcludedFromAppNotificationEnabled: NotificationPreference!
videoExcludedFromAppNotificationEnabled: NotificationPreference!
videoFeaturedAsHeroNotificationEnabled: NotificationPreference!
videoFeaturedOnCategoryPageNotificationEnabled: NotificationPreference!
nftFeaturedOnMarketPlaceNotificationEnabled: NotificationPreference!
newChannelFollowerNotificationEnabled: NotificationPreference!
videoCommentCreatedNotificationEnabled: NotificationPreference!
videoLikedNotificationEnabled: NotificationPreference!
videoDislikedNotificationEnabled: NotificationPreference!
yppChannelVerifiedNotificationEnabled: NotificationPreference!
yppChannelSuspendedNotificationEnabled: NotificationPreference!
nftBoughtNotificationEnabled: NotificationPreference!
timedAuctionExpiredNotificationEnabled: NotificationPreference!
bidMadeOnNftNotificationEnabled: NotificationPreference!
royaltyReceivedNotificationEnabled: NotificationPreference!
channelPaymentReceivedNotificationEnabled: NotificationPreference!
channelReceivedFundsFromWgNotificationEnabled: NotificationPreference!
newPayoutUpdatedByCouncilNotificationEnabled: NotificationPreference!
channelFundsWithdrawnNotificationEnabled: NotificationPreference!
# channel notifications: https://www.figma.com/file/zi5siPUXme0Fivq2i40XBd/My-channel?type=design&node-id=1721-82420&mode=design:
channelExcludedFromApp: NotificationPreference!
videoExcludedFromApp: NotificationPreference!
videoFeaturedAsHero: NotificationPreference!
videoFeaturedOnCategoryPage: NotificationPreference!
nftFeaturedOnMarketPlace: NotificationPreference!
newChannelFollower: NotificationPreference!
videoCommentCreated: NotificationPreference!
videoLiked: NotificationPreference!
videoDisliked: NotificationPreference!
yppChannelVerified: NotificationPreference!
yppChannelSuspended: NotificationPreference!
nftBought: NotificationPreference!
timedAuctionExpired: NotificationPreference!
bidMadeOnNft: NotificationPreference!
royaltyReceived: NotificationPreference!
channelPaymentReceived: NotificationPreference!
channelReceivedFundsFromWg: NotificationPreference!
newPayoutUpdatedByCouncil: NotificationPreference!
channelFundsWithdrawn: NotificationPreference!

# member notifications: https://www.figma.com/file/yhZpTHdf1sxJx13uRZ71GV/Membership-profile?type=design&node-id=2977-58785&mode=design
channelCreatedNotificationEnabled: NotificationPreference!
replyToCommentNotificationEnabled: NotificationPreference!
reactionToCommentNotificationEnabled: NotificationPreference!
videoPostedNotificationEnabled: NotificationPreference!
newNftOnAuctionNotificationEnabled: NotificationPreference!
newNftOnSaleNotificationEnabled: NotificationPreference!
higherBidThanYoursMadeNotificationEnabled: NotificationPreference!
auctionWonNotificationEnabled: NotificationPreference!
auctionLostNotificationEnabled: NotificationPreference!
openAuctionBidCanBeWithdrawnNotificationEnabled: NotificationPreference!
fundsFromCouncilReceivedNotificationEnabled: NotificationPreference!
fundsToExternalWalletSentNotificationEnabled: NotificationPreference!
fundsFromWgReceivedNotificationEnabled: NotificationPreference!
channelCreated: NotificationPreference!
replyToComment: NotificationPreference!
reactionToComment: NotificationPreference!
videoPosted: NotificationPreference!
newNftOnAuction: NotificationPreference!
newNftOnSale: NotificationPreference!
higherBidThanYoursMade: NotificationPreference!
auctionWon: NotificationPreference!
auctionLost: NotificationPreference!
openAuctionBidCanBeWithdrawn: NotificationPreference!
fundsFromCouncilReceived: NotificationPreference!
fundsToExternalWalletSent: NotificationPreference!
fundsFromWgReceived: NotificationPreference!
}

type NotificationPreference {
Expand Down
129 changes: 64 additions & 65 deletions src/server-extension/resolvers/NotificationResolver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export class NotificationResolver {
})
}

// HACK: (not.v1) this is a temporary solution, refactor needed
@Mutation(() => AccountNotificationPreferencesOutput)
@UseMiddleware(AccountOnly)
async setAccountNotificationPreferences(
Expand All @@ -62,132 +61,132 @@ export class NotificationResolver {
const account = ctx.account

maybeUpdateNotificationPreference(
newPreferences.channelExcludedFromAppNotificationEnabled,
account.notificationPreferences.channelExcludedFromAppNotificationEnabled
newPreferences.channelExcludedFromApp,
account.notificationPreferences.channelExcludedFromApp
)
maybeUpdateNotificationPreference(
newPreferences.videoExcludedFromAppNotificationEnabled,
account.notificationPreferences.videoExcludedFromAppNotificationEnabled
newPreferences.videoExcludedFromApp,
account.notificationPreferences.videoExcludedFromApp
)
maybeUpdateNotificationPreference(
newPreferences.videoFeaturedAsHeroNotificationEnabled,
account.notificationPreferences.videoFeaturedAsHeroNotificationEnabled
newPreferences.videoFeaturedAsHero,
account.notificationPreferences.videoFeaturedAsHero
)
maybeUpdateNotificationPreference(
newPreferences.videoFeaturedOnCategoryPageNotificationEnabled,
account.notificationPreferences.videoFeaturedOnCategoryPageNotificationEnabled
newPreferences.videoFeaturedOnCategoryPage,
account.notificationPreferences.videoFeaturedOnCategoryPage
)
maybeUpdateNotificationPreference(
newPreferences.nftFeaturedOnMarketPlaceNotificationEnabled,
account.notificationPreferences.nftFeaturedOnMarketPlaceNotificationEnabled
newPreferences.nftFeaturedOnMarketPlace,
account.notificationPreferences.nftFeaturedOnMarketPlace
)
maybeUpdateNotificationPreference(
newPreferences.newChannelFollowerNotificationEnabled,
account.notificationPreferences.newChannelFollowerNotificationEnabled
newPreferences.newChannelFollower,
account.notificationPreferences.newChannelFollower
)
maybeUpdateNotificationPreference(
newPreferences.videoCommentCreatedNotificationEnabled,
account.notificationPreferences.videoCommentCreatedNotificationEnabled
newPreferences.videoCommentCreated,
account.notificationPreferences.videoCommentCreated
)
maybeUpdateNotificationPreference(
newPreferences.videoLikedNotificationEnabled,
account.notificationPreferences.videoLikedNotificationEnabled
newPreferences.videoLiked,
account.notificationPreferences.videoLiked
)
maybeUpdateNotificationPreference(
newPreferences.videoDislikedNotificationEnabled,
account.notificationPreferences.videoDislikedNotificationEnabled
newPreferences.videoDisliked,
account.notificationPreferences.videoDisliked
)
maybeUpdateNotificationPreference(
newPreferences.yppChannelSuspendedNotificationEnabled,
account.notificationPreferences.yppChannelSuspendedNotificationEnabled
newPreferences.yppChannelSuspended,
account.notificationPreferences.yppChannelSuspended
)
maybeUpdateNotificationPreference(
newPreferences.yppChannelVerifiedNotificationEnabled,
account.notificationPreferences.yppChannelVerifiedNotificationEnabled
newPreferences.yppChannelVerified,
account.notificationPreferences.yppChannelVerified
)
maybeUpdateNotificationPreference(
newPreferences.nftBoughtNotificationEnabled,
account.notificationPreferences.nftBoughtNotificationEnabled
newPreferences.nftBought,
account.notificationPreferences.nftBought
)
maybeUpdateNotificationPreference(
newPreferences.bidMadeOnNftNotificationEnabled,
account.notificationPreferences.bidMadeOnNftNotificationEnabled
newPreferences.bidMadeOnNft,
account.notificationPreferences.bidMadeOnNft
)
maybeUpdateNotificationPreference(
newPreferences.royaltyReceivedNotificationEnabled,
account.notificationPreferences.royaltyReceivedNotificationEnabled
newPreferences.royaltyReceived,
account.notificationPreferences.royaltyReceived
)
maybeUpdateNotificationPreference(
newPreferences.channelPaymentReceivedNotificationEnabled,
account.notificationPreferences.channelPaymentReceivedNotificationEnabled
newPreferences.channelPaymentReceived,
account.notificationPreferences.channelPaymentReceived
)
maybeUpdateNotificationPreference(
newPreferences.channelReceivedFundsFromWgNotificationEnabled,
account.notificationPreferences.channelReceivedFundsFromWgNotificationEnabled
newPreferences.channelReceivedFundsFromWg,
account.notificationPreferences.channelReceivedFundsFromWg
)
maybeUpdateNotificationPreference(
newPreferences.newPayoutUpdatedByCouncilNotificationEnabled,
account.notificationPreferences.newPayoutUpdatedByCouncilNotificationEnabled
newPreferences.newPayoutUpdatedByCouncil,
account.notificationPreferences.newPayoutUpdatedByCouncil
)
maybeUpdateNotificationPreference(
newPreferences.channelFundsWithdrawnNotificationEnabled,
account.notificationPreferences.channelFundsWithdrawnNotificationEnabled
newPreferences.channelFundsWithdrawn,
account.notificationPreferences.channelFundsWithdrawn
)
maybeUpdateNotificationPreference(
newPreferences.channelCreatedNotificationEnabled,
account.notificationPreferences.channelCreatedNotificationEnabled
newPreferences.channelCreated,
account.notificationPreferences.channelCreated
)
maybeUpdateNotificationPreference(
newPreferences.replyToCommentNotificationEnabled,
account.notificationPreferences.replyToCommentNotificationEnabled
newPreferences.replyToComment,
account.notificationPreferences.replyToComment
)
maybeUpdateNotificationPreference(
newPreferences.reactionToCommentNotificationEnabled,
account.notificationPreferences.reactionToCommentNotificationEnabled
newPreferences.reactionToComment,
account.notificationPreferences.reactionToComment
)
maybeUpdateNotificationPreference(
newPreferences.videoPostedNotificationEnabled,
account.notificationPreferences.videoPostedNotificationEnabled
newPreferences.videoPosted,
account.notificationPreferences.videoPosted
)
maybeUpdateNotificationPreference(
newPreferences.newNftOnAuctionNotificationEnabled,
account.notificationPreferences.newNftOnAuctionNotificationEnabled
newPreferences.newNftOnAuction,
account.notificationPreferences.newNftOnAuction
)
maybeUpdateNotificationPreference(
newPreferences.newNftOnSaleNotificationEnabled,
account.notificationPreferences.newNftOnSaleNotificationEnabled
newPreferences.newNftOnSale,
account.notificationPreferences.newNftOnSale
)
maybeUpdateNotificationPreference(
newPreferences.higherBidThanYoursMadeNotificationEnabled,
account.notificationPreferences.higherBidThanYoursMadeNotificationEnabled
newPreferences.higherBidThanYoursMade,
account.notificationPreferences.higherBidThanYoursMade
)
maybeUpdateNotificationPreference(
newPreferences.auctionExpiredNotificationEnabled,
account.notificationPreferences.timedAuctionExpiredNotificationEnabled
newPreferences.auctionExpired,
account.notificationPreferences.timedAuctionExpired
)
maybeUpdateNotificationPreference(
newPreferences.auctionWonNotificationEnabled,
account.notificationPreferences.auctionWonNotificationEnabled
newPreferences.auctionWon,
account.notificationPreferences.auctionWon
)
maybeUpdateNotificationPreference(
newPreferences.auctionLostNotificationEnabled,
account.notificationPreferences.auctionLostNotificationEnabled
newPreferences.auctionLost,
account.notificationPreferences.auctionLost
)
maybeUpdateNotificationPreference(
newPreferences.openAuctionBidCanBeWithdrawnNotificationEnabled,
account.notificationPreferences.openAuctionBidCanBeWithdrawnNotificationEnabled
newPreferences.openAuctionBidCanBeWithdrawn,
account.notificationPreferences.openAuctionBidCanBeWithdrawn
)
maybeUpdateNotificationPreference(
newPreferences.fundsFromCouncilReceivedNotificationEnabled,
account.notificationPreferences.fundsFromCouncilReceivedNotificationEnabled
newPreferences.fundsFromCouncilReceived,
account.notificationPreferences.fundsFromCouncilReceived
)
maybeUpdateNotificationPreference(
newPreferences.fundsToExternalWalletSentNotificationEnabled,
account.notificationPreferences.fundsToExternalWalletSentNotificationEnabled
newPreferences.fundsToExternalWalletSent,
account.notificationPreferences.fundsToExternalWalletSent
)
maybeUpdateNotificationPreference(
newPreferences.fundsFromWgReceivedNotificationEnabled,
account.notificationPreferences.fundsFromWgReceivedNotificationEnabled
newPreferences.fundsFromWgReceived,
account.notificationPreferences.fundsFromWgReceived
)
await em.save(account)

Expand Down
Loading

0 comments on commit 59de8ed

Please sign in to comment.