Api for dismissing (reading) notifications

AI-generated summary

The discussion revolves around creating an API to dismiss notifications in Discourse, specifically for support team members who are set to watch the first post in the support category. adopilot explains that team members often receive notifications for topics solved during their off-hours, which is undesirable. They’ve identified such notifications via a database query and manually marked them as read, but recognize that direct DB updates are unsustainable. The user is seeking a safe, production-ready solution, such as an API or a plugin, to automate the dismissal or deletion of these notifications. They also inquire about existing official plugins that handle background DB jobs, hoping to adapt one for this purpose.

Here is try of description what We are trying to solve:
We have support team of 4 members , all of them has set notification lever “Watching fist post” for support category. We want to seeped up support team by pushing them to watch and react on notification more often and more quickly. Since team members has different work hours lot of topics get open and solved during team member off work hours.
Example:

I am support member and my shift starts at :clock1030: until that there is lot of topics opened
and solved while I am off. I do not want to get notification for that kind of topic.

So we are looking for way to dismiss (“de notify”, revoke , automatically read ) notification which is triggered by Watching Firs Post and has been solved before user came to discourse.


So far we fund notification like that in db using query like this

select
     notifications.user_id
    ,notifications.topic_id
    ,notifications.id
from notifications
where read=false
and notification_type=17
and topic_id in (
select
 topic_id
from topic_custom_fields
where name='accepted_answer_post_id' and value is not null
)

We did manage to dismiss notification by updating read field through db

update notifications
set read=true
where id=XXXXXX

We know that doing db updates directly on discourse is insane and very bad.
So we are looking for some kind of API that will allow us to call dismiss of specific notification ?

If we manage to make sidekiq job for dismissing notification through db directly will be that sustainable solution for production site.

Are there any “good” plugins that doing background jobs over db so we can try to recreate one whit this tasks ?

We are more likely to delete notifications like this, since there is no Notifications - "unread only" filter
Does discourse has any “official” plugin that doing deletes inside db so we can try to learn how to delete something in db through plugin.