From 9c8d26affad32fadba91ca733fdcce8578e93db6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 23 May 2019 14:11:42 +0900 Subject: [PATCH] Resolve #4967 --- src/client/app/admin/views/logs.vue | 11 +++++++++++ src/server/api/endpoints/admin/delete-logs.ts | 13 +++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/server/api/endpoints/admin/delete-logs.ts diff --git a/src/client/app/admin/views/logs.vue b/src/client/app/admin/views/logs.vue index 5c2cfdb39..cb5431818 100644 --- a/src/client/app/admin/views/logs.vue +++ b/src/client/app/admin/views/logs.vue @@ -26,6 +26,8 @@ + + {{ $t('delete-all') }} @@ -78,6 +80,15 @@ export default Vue.extend({ }).then(logs => { this.logs = logs.reverse(); }); + }, + + deleteAll() { + this.$root.api('admin/delete-logs').then(() => { + this.$root.dialog({ + type: 'success', + splash: true + }); + }); } } }); diff --git a/src/server/api/endpoints/admin/delete-logs.ts b/src/server/api/endpoints/admin/delete-logs.ts new file mode 100644 index 000000000..26cf13c1f --- /dev/null +++ b/src/server/api/endpoints/admin/delete-logs.ts @@ -0,0 +1,13 @@ +import define from '../../define'; +import { Logs } from '../../../../models'; + +export const meta = { + tags: ['admin'], + + requireCredential: true, + requireModerator: true, +}; + +export default define(meta, async (ps) => { + await Logs.delete({}); +});