SaadMu7ammad / subul

Subul is an API for an online charitable donation system designed to provide a seamless experience for both donors and charitable organizations. The system offers functionalities such as managing cases provided by charities, uploading used items cases by users,processing donations through a checkout system, and providing admin and charity dashboard
https://subul.me
MIT License
1 stars 1 forks source link

Adding Notifications :bell: #61

Closed SaadMu7ammad closed 3 months ago

SaadMu7ammad commented 11 months ago

does notification needs a table ?

SaadMu7ammad commented 11 months ago

i hope any one respond https://web.facebook.com/groups/nodejs.egypt/permalink/6571677816287501/?mibextid=oMANbw

SaadMu7ammad commented 11 months ago

notification table needs to be created

SaifLotfi commented 7 months ago

GetAllNotifications :heavy_check_mark: : :



SendNotification :hourglass: :



SaifLotfi commented 7 months ago

Adding An Expiry date for documents to be deleted after is easily done using TTL index , but if the expiry date differs between documents , it may be a challenge ..

Further Reading : Cron Jobs :heavy_check_mark: - Node-cron : seams easy and interesting ✔️

Update : Did that using setTimeInterval , but is this a good approach ?

SaifLotfi commented 7 months ago

Adding global notifications : this could be done by adding a new attribute in the Notifications schema "isGlobal" .. but what about the required "receiver" attribute ?

SaifLotfi commented 5 months ago

Notifications should have a title only (notifications don't have a body)

SaadMu7ammad commented 5 months ago

Notifications should have a title only (notifications don't have a body)

also i think must be a ref id to both case id so when the normal user click on the notification it goes him to the case he clicked

or as a charity also go to the usedItem user contribute and the same with blood donation

dont forget the fundraising needs a notification request

user also want to be notified with cases with type campiagns and that differ from the fundraising

try to brain storm to full the whole corner cases about that

SaifLotfi commented 4 months ago

we should add 2 more properties to the notification schema

  1. Sender (User or Charity) // I don't think we need that
  2. Resource : type: [case - usedItem] - Id Note : User has a contributions array that contains fundraising requests ,used item booking requests Fundraising is only a Case There is 0 information about blood donations stored in the DB => so we should point to the caseId
SaifLotfi commented 4 months ago

Added : deleteOutdatedNotifications function that is fired every time user fetches the notifications

SaifLotfi commented 4 months ago

GetAllNotifications ✔️ : :

  • [x] adding pagination

  • [x] sorting by date

  • [x] filter by X (read - !read)

  • [x] DeleteNotification

  • [x] MarkNotificationAsRead

SendNotification ⌛ :

  • [x] check if the charity or the user are stored in the DB

  • [x] Delete Old Notifications

  • [ ] Adding Global Notifications 🤔

  • [x] Adding Types Following the Pattern

  • [x] Implementing the Dao

  • [x] the automatic createdAt & updatedAt attributes

  • [x] linking the notification with a case/blood request / fundraising request ..

  • [x] fix filtering by read

  • [x] fix findOneAndDelete

  • [x] fix the timestamp issue with typescript

  • [ ] fix the population problem

TODO :

SaifLotfi commented 4 months ago

New Structure : Global Notifications : make only one instance in the DB then link the it to the user by making an attribute : notifications { notificationId , read }

is this better than the current structure ? will this joins reduce the performance ? will the notifications array explode the user document ? what to do if all the users deleted their link to the notification ? will it require a complex query to delete unused notifications ?