GoodDAPP icon indicating copy to clipboard operation
GoodDAPP copied to clipboard

user notifications/cms subscriptions api

Open sirpy opened this issue 5 years ago • 0 comments

Develop as external module

Data structure

subscribedFeeds: {
[id]: FeedSubscription
}
FeedSubscription: {
 info:FeedInfo,
 options:SubscriptionOptions,
 readItems: {[id]: boolean}
 lastSeen: {date:Date, item: id}
}
SubscriptionOptions: {
 notifyPublic: boolean,
 notifyPrivate: boolean
}

GunDB API

  • login(user:GunUser)
  • subscribe(feedSoul, SubscriptionOptions) - adds to user().get('subscribedFees')
  • unsubscribe(feedSoul)
  • init(onFeedItemCallback) - use gun.on to subscribe to each feed items + privateItems[user public key]
    • onFeedItemCallback(FeedInfo, FeedItem)
    • subscribe to current day record (UTC TIME) and next day record
  • update lastSeen on each new feed item
  • fetchNewItems(): Array<{feed:FeedInfo, items: Array<FeedItem>>
    • fetch all days items from lastSeen until current day (exclusive) and update lastSeen
    • returns array with new items for all subscribed feeds, items sorted by date

sirpy avatar Feb 06 '20 09:02 sirpy