2020-03-28 18:07:41 +09:00
|
|
|
import $ from 'cafy';
|
|
|
|
import define from '../../define';
|
|
|
|
import { createNotification } from '../../../../services/create-notification';
|
|
|
|
|
|
|
|
export const meta = {
|
2021-03-06 22:34:11 +09:00
|
|
|
desc: {
|
|
|
|
'ja-JP': '通知を作成します。'
|
|
|
|
},
|
|
|
|
|
2020-03-28 18:07:41 +09:00
|
|
|
tags: ['notifications'],
|
|
|
|
|
|
|
|
requireCredential: true as const,
|
|
|
|
|
|
|
|
kind: 'write:notifications',
|
|
|
|
|
|
|
|
params: {
|
|
|
|
body: {
|
|
|
|
validator: $.str
|
|
|
|
},
|
|
|
|
|
|
|
|
header: {
|
|
|
|
validator: $.optional.nullable.str
|
|
|
|
},
|
|
|
|
|
|
|
|
icon: {
|
|
|
|
validator: $.optional.nullable.str
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
errors: {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default define(meta, async (ps, user, token) => {
|
|
|
|
createNotification(user.id, 'app', {
|
2020-03-29 10:49:43 +09:00
|
|
|
appAccessTokenId: token ? token.id : null,
|
2020-03-28 18:07:41 +09:00
|
|
|
customBody: ps.body,
|
|
|
|
customHeader: ps.header,
|
|
|
|
customIcon: ps.icon,
|
|
|
|
});
|
|
|
|
});
|