paricafe/src/server/api/endpoints/notifications/mark-all-as-read.ts
syuilo b9cb6d1c10 refactor: refactoring imports
将来ESMに移行しやすいように
Related: #7658

なんかmochaが起動しなくなってるけど理由不明
すぐ直したい
2021-08-19 18:33:41 +09:00

24 lines
573 B
TypeScript

import { publishMainStream } from '@/services/stream.js';
import define from '../../define.js';
import { Notifications } from '@/models/index.js';
export const meta = {
tags: ['notifications', 'account'],
requireCredential: true as const,
kind: 'write:notifications'
};
export default define(meta, async (ps, user) => {
// Update documents
await Notifications.update({
notifieeId: user.id,
isRead: false,
}, {
isRead: true
});
// 全ての通知を読みましたよというイベントを発行
publishMainStream(user.id, 'readAllNotifications');
});