mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
feat(server): support read all notifications (#13083)
close AF-2719 #### PR Dependency Tree * **PR #13083** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added the ability to mark all notifications as read with a single action. * **Bug Fixes** * Ensured notifications marked as read are no longer shown as unread. * **Tests** * Introduced new tests to verify the functionality of marking all notifications as read. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -100,6 +100,14 @@ export class UserNotificationResolver {
|
||||
await this.service.markAsRead(me.id, notificationId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Mutation(() => Boolean, {
|
||||
description: 'mark all notifications as read',
|
||||
})
|
||||
async readAllNotifications(@CurrentUser() me: UserType) {
|
||||
await this.service.markAllAsRead(me.id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Resolver(() => NotificationObjectType)
|
||||
|
||||
@@ -399,6 +399,10 @@ export class NotificationService {
|
||||
}
|
||||
}
|
||||
|
||||
async markAllAsRead(userId: string) {
|
||||
await this.models.notification.markAllAsRead(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find notifications by user id, order by createdAt desc
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user