From af548d05ca821725eabd5a96241d3228b92186f0 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 2 Mar 2024 16:36:49 +0000 Subject: merge upstream for 2024.2.1 --- .../server/api/endpoints/notifications/flush.ts | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 packages/backend/src/server/api/endpoints/notifications/flush.ts (limited to 'packages/backend/src/server/api/endpoints/notifications/flush.ts') diff --git a/packages/backend/src/server/api/endpoints/notifications/flush.ts b/packages/backend/src/server/api/endpoints/notifications/flush.ts new file mode 100644 index 0000000000..47c0642fd1 --- /dev/null +++ b/packages/backend/src/server/api/endpoints/notifications/flush.ts @@ -0,0 +1,33 @@ +/* + * SPDX-FileCopyrightText: syuilo and misskey-project + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Injectable } from '@nestjs/common'; +import { Endpoint } from '@/server/api/endpoint-base.js'; +import { NotificationService } from '@/core/NotificationService.js'; + +export const meta = { + tags: ['notifications', 'account'], + + requireCredential: true, + + kind: 'write:notifications', +} as const; + +export const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + +@Injectable() +export default class extends Endpoint { // eslint-disable-line import/no-default-export + constructor( + private notificationService: NotificationService, + ) { + super(meta, paramDef, async (ps, me) => { + this.notificationService.flushAllNotifications(me.id); + }); + } +} -- cgit v1.2.3-freya