wip
This commit is contained in:
30
src/server/api/endpoints/notifications/read.ts
Normal file
30
src/server/api/endpoints/notifications/read.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import $ from 'cafy';
|
||||
import { ID } from '../../../../misc/cafy-id';
|
||||
import { publishMainStream } from '../../../../services/stream';
|
||||
import define from '../../define';
|
||||
import { readNotification } from '../../common/read-notification';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
'ja-JP': '通知を既読にします。',
|
||||
'en-US': 'Mark a notification as read.'
|
||||
},
|
||||
|
||||
tags: ['notifications', 'account'],
|
||||
|
||||
requireCredential: true as const,
|
||||
|
||||
params: {
|
||||
notificationIds: {
|
||||
validator: $.arr($.type(ID)),
|
||||
desc: {
|
||||
'ja-JP': '対象の通知のIDの配列',
|
||||
'en-US': 'Target notification IDs.'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
kind: 'write:notifications'
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => readNotification(user.id, ps.notificationIds));
|
37
src/server/api/endpoints/sw/unregister.ts
Normal file
37
src/server/api/endpoints/sw/unregister.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import $ from 'cafy';
|
||||
import define from '../../define';
|
||||
import { SwSubscriptions } from '../../../../models';
|
||||
|
||||
export const meta = {
|
||||
tags: ['account'],
|
||||
|
||||
requireCredential: true as const,
|
||||
|
||||
desc: {
|
||||
'ja-JP': 'Push通知の登録を削除します。',
|
||||
'en-US': 'Remove push noticfication registration'
|
||||
},
|
||||
|
||||
params: {
|
||||
endpoint: {
|
||||
validator: $.str
|
||||
},
|
||||
|
||||
all: {
|
||||
validator: $.optional.bool,
|
||||
default: false,
|
||||
desc: {
|
||||
'ja-JP': 'false(デフォルト)は、自分の登録のみが解除されます。trueを指定すると、指定したエンドポイントのすべての登録を解除します。'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
await SwSubscriptions.delete(ps.all ? {
|
||||
endpoint: ps.endpoint,
|
||||
} : {
|
||||
userId: user.id,
|
||||
endpoint: ps.endpoint,
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user