summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/charts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-11-12 02:02:25 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-11-12 02:02:25 +0900
commit0e4a111f81cceed275d9bec2695f6e401fb654d8 (patch)
tree40874799472fa07416f17b50a398ac33b7771905 /src/server/api/endpoints/charts
parentupdate deps (diff)
downloadsharkey-0e4a111f81cceed275d9bec2695f6e401fb654d8.tar.gz
sharkey-0e4a111f81cceed275d9bec2695f6e401fb654d8.tar.bz2
sharkey-0e4a111f81cceed275d9bec2695f6e401fb654d8.zip
refactoring
Resolve #7779
Diffstat (limited to 'src/server/api/endpoints/charts')
-rw-r--r--src/server/api/endpoints/charts/active-users.ts30
-rw-r--r--src/server/api/endpoints/charts/drive.ts30
-rw-r--r--src/server/api/endpoints/charts/federation.ts30
-rw-r--r--src/server/api/endpoints/charts/hashtag.ts34
-rw-r--r--src/server/api/endpoints/charts/instance.ts34
-rw-r--r--src/server/api/endpoints/charts/network.ts30
-rw-r--r--src/server/api/endpoints/charts/notes.ts30
-rw-r--r--src/server/api/endpoints/charts/user/drive.ts35
-rw-r--r--src/server/api/endpoints/charts/user/following.ts35
-rw-r--r--src/server/api/endpoints/charts/user/notes.ts35
-rw-r--r--src/server/api/endpoints/charts/user/reactions.ts35
-rw-r--r--src/server/api/endpoints/charts/users.ts30
12 files changed, 0 insertions, 388 deletions
diff --git a/src/server/api/endpoints/charts/active-users.ts b/src/server/api/endpoints/charts/active-users.ts
deleted file mode 100644
index c4878f7d61..0000000000
--- a/src/server/api/endpoints/charts/active-users.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import $ from 'cafy';
-import define from '../../define';
-import { convertLog } from '@/services/chart/core';
-import { activeUsersChart } from '@/services/chart/index';
-
-export const meta = {
- tags: ['charts', 'users'],
-
- params: {
- span: {
- validator: $.str.or(['day', 'hour']),
- },
-
- limit: {
- validator: $.optional.num.range(1, 500),
- default: 30,
- },
-
- offset: {
- validator: $.optional.nullable.num,
- default: null,
- },
- },
-
- res: convertLog(activeUsersChart.schema),
-};
-
-export default define(meta, async (ps) => {
- return await activeUsersChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null);
-});
diff --git a/src/server/api/endpoints/charts/drive.ts b/src/server/api/endpoints/charts/drive.ts
deleted file mode 100644
index 07bff82cf4..0000000000
--- a/src/server/api/endpoints/charts/drive.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import $ from 'cafy';
-import define from '../../define';
-import { convertLog } from '@/services/chart/core';
-import { driveChart } from '@/services/chart/index';
-
-export const meta = {
- tags: ['charts', 'drive'],
-
- params: {
- span: {
- validator: $.str.or(['day', 'hour']),
- },
-
- limit: {
- validator: $.optional.num.range(1, 500),
- default: 30,
- },
-
- offset: {
- validator: $.optional.nullable.num,
- default: null,
- },
- },
-
- res: convertLog(driveChart.schema),
-};
-
-export default define(meta, async (ps) => {
- return await driveChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null);
-});
diff --git a/src/server/api/endpoints/charts/federation.ts b/src/server/api/endpoints/charts/federation.ts
deleted file mode 100644
index 9575f9a7b7..0000000000
--- a/src/server/api/endpoints/charts/federation.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import $ from 'cafy';
-import define from '../../define';
-import { convertLog } from '@/services/chart/core';
-import { federationChart } from '@/services/chart/index';
-
-export const meta = {
- tags: ['charts'],
-
- params: {
- span: {
- validator: $.str.or(['day', 'hour']),
- },
-
- limit: {
- validator: $.optional.num.range(1, 500),
- default: 30,
- },
-
- offset: {
- validator: $.optional.nullable.num,
- default: null,
- },
- },
-
- res: convertLog(federationChart.schema),
-};
-
-export default define(meta, async (ps) => {
- return await federationChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null);
-});
diff --git a/src/server/api/endpoints/charts/hashtag.ts b/src/server/api/endpoints/charts/hashtag.ts
deleted file mode 100644
index 53dc61e51e..0000000000
--- a/src/server/api/endpoints/charts/hashtag.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import $ from 'cafy';
-import define from '../../define';
-import { convertLog } from '@/services/chart/core';
-import { hashtagChart } from '@/services/chart/index';
-
-export const meta = {
- tags: ['charts', 'hashtags'],
-
- params: {
- span: {
- validator: $.str.or(['day', 'hour']),
- },
-
- limit: {
- validator: $.optional.num.range(1, 500),
- default: 30,
- },
-
- offset: {
- validator: $.optional.nullable.num,
- default: null,
- },
-
- tag: {
- validator: $.str,
- },
- },
-
- res: convertLog(hashtagChart.schema),
-};
-
-export default define(meta, async (ps) => {
- return await hashtagChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null, ps.tag);
-});
diff --git a/src/server/api/endpoints/charts/instance.ts b/src/server/api/endpoints/charts/instance.ts
deleted file mode 100644
index 1835023188..0000000000
--- a/src/server/api/endpoints/charts/instance.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import $ from 'cafy';
-import define from '../../define';
-import { convertLog } from '@/services/chart/core';
-import { instanceChart } from '@/services/chart/index';
-
-export const meta = {
- tags: ['charts'],
-
- params: {
- span: {
- validator: $.str.or(['day', 'hour']),
- },
-
- limit: {
- validator: $.optional.num.range(1, 500),
- default: 30,
- },
-
- offset: {
- validator: $.optional.nullable.num,
- default: null,
- },
-
- host: {
- validator: $.str,
- }
- },
-
- res: convertLog(instanceChart.schema),
-};
-
-export default define(meta, async (ps) => {
- return await instanceChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null, ps.host);
-});
diff --git a/src/server/api/endpoints/charts/network.ts b/src/server/api/endpoints/charts/network.ts
deleted file mode 100644
index b524df93be..0000000000
--- a/src/server/api/endpoints/charts/network.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import $ from 'cafy';
-import define from '../../define';
-import { convertLog } from '@/services/chart/core';
-import { networkChart } from '@/services/chart/index';
-
-export const meta = {
- tags: ['charts'],
-
- params: {
- span: {
- validator: $.str.or(['day', 'hour']),
- },
-
- limit: {
- validator: $.optional.num.range(1, 500),
- default: 30,
- },
-
- offset: {
- validator: $.optional.nullable.num,
- default: null,
- },
- },
-
- res: convertLog(networkChart.schema),
-};
-
-export default define(meta, async (ps) => {
- return await networkChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null);
-});
diff --git a/src/server/api/endpoints/charts/notes.ts b/src/server/api/endpoints/charts/notes.ts
deleted file mode 100644
index 676f302939..0000000000
--- a/src/server/api/endpoints/charts/notes.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import $ from 'cafy';
-import define from '../../define';
-import { convertLog } from '@/services/chart/core';
-import { notesChart } from '@/services/chart/index';
-
-export const meta = {
- tags: ['charts', 'notes'],
-
- params: {
- span: {
- validator: $.str.or(['day', 'hour']),
- },
-
- limit: {
- validator: $.optional.num.range(1, 500),
- default: 30,
- },
-
- offset: {
- validator: $.optional.nullable.num,
- default: null,
- },
- },
-
- res: convertLog(notesChart.schema),
-};
-
-export default define(meta, async (ps) => {
- return await notesChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null);
-});
diff --git a/src/server/api/endpoints/charts/user/drive.ts b/src/server/api/endpoints/charts/user/drive.ts
deleted file mode 100644
index f2770e2df8..0000000000
--- a/src/server/api/endpoints/charts/user/drive.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import $ from 'cafy';
-import define from '../../../define';
-import { ID } from '@/misc/cafy-id';
-import { convertLog } from '@/services/chart/core';
-import { perUserDriveChart } from '@/services/chart/index';
-
-export const meta = {
- tags: ['charts', 'drive', 'users'],
-
- params: {
- span: {
- validator: $.str.or(['day', 'hour']),
- },
-
- limit: {
- validator: $.optional.num.range(1, 500),
- default: 30,
- },
-
- offset: {
- validator: $.optional.nullable.num,
- default: null,
- },
-
- userId: {
- validator: $.type(ID),
- }
- },
-
- res: convertLog(perUserDriveChart.schema),
-};
-
-export default define(meta, async (ps) => {
- return await perUserDriveChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null, ps.userId);
-});
diff --git a/src/server/api/endpoints/charts/user/following.ts b/src/server/api/endpoints/charts/user/following.ts
deleted file mode 100644
index 8c97b63e89..0000000000
--- a/src/server/api/endpoints/charts/user/following.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import $ from 'cafy';
-import define from '../../../define';
-import { ID } from '@/misc/cafy-id';
-import { convertLog } from '@/services/chart/core';
-import { perUserFollowingChart } from '@/services/chart/index';
-
-export const meta = {
- tags: ['charts', 'users', 'following'],
-
- params: {
- span: {
- validator: $.str.or(['day', 'hour']),
- },
-
- limit: {
- validator: $.optional.num.range(1, 500),
- default: 30,
- },
-
- offset: {
- validator: $.optional.nullable.num,
- default: null,
- },
-
- userId: {
- validator: $.type(ID),
- }
- },
-
- res: convertLog(perUserFollowingChart.schema),
-};
-
-export default define(meta, async (ps) => {
- return await perUserFollowingChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null, ps.userId);
-});
diff --git a/src/server/api/endpoints/charts/user/notes.ts b/src/server/api/endpoints/charts/user/notes.ts
deleted file mode 100644
index 0d5f5a8b6a..0000000000
--- a/src/server/api/endpoints/charts/user/notes.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import $ from 'cafy';
-import define from '../../../define';
-import { ID } from '@/misc/cafy-id';
-import { convertLog } from '@/services/chart/core';
-import { perUserNotesChart } from '@/services/chart/index';
-
-export const meta = {
- tags: ['charts', 'users', 'notes'],
-
- params: {
- span: {
- validator: $.str.or(['day', 'hour']),
- },
-
- limit: {
- validator: $.optional.num.range(1, 500),
- default: 30,
- },
-
- offset: {
- validator: $.optional.nullable.num,
- default: null,
- },
-
- userId: {
- validator: $.type(ID),
- }
- },
-
- res: convertLog(perUserNotesChart.schema),
-};
-
-export default define(meta, async (ps) => {
- return await perUserNotesChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null, ps.userId);
-});
diff --git a/src/server/api/endpoints/charts/user/reactions.ts b/src/server/api/endpoints/charts/user/reactions.ts
deleted file mode 100644
index 3cabe40d56..0000000000
--- a/src/server/api/endpoints/charts/user/reactions.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import $ from 'cafy';
-import define from '../../../define';
-import { ID } from '@/misc/cafy-id';
-import { convertLog } from '@/services/chart/core';
-import { perUserReactionsChart } from '@/services/chart/index';
-
-export const meta = {
- tags: ['charts', 'users', 'reactions'],
-
- params: {
- span: {
- validator: $.str.or(['day', 'hour']),
- },
-
- limit: {
- validator: $.optional.num.range(1, 500),
- default: 30,
- },
-
- offset: {
- validator: $.optional.nullable.num,
- default: null,
- },
-
- userId: {
- validator: $.type(ID),
- }
- },
-
- res: convertLog(perUserReactionsChart.schema),
-};
-
-export default define(meta, async (ps) => {
- return await perUserReactionsChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null, ps.userId);
-});
diff --git a/src/server/api/endpoints/charts/users.ts b/src/server/api/endpoints/charts/users.ts
deleted file mode 100644
index deac89b59d..0000000000
--- a/src/server/api/endpoints/charts/users.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import $ from 'cafy';
-import define from '../../define';
-import { convertLog } from '@/services/chart/core';
-import { usersChart } from '@/services/chart/index';
-
-export const meta = {
- tags: ['charts', 'users'],
-
- params: {
- span: {
- validator: $.str.or(['day', 'hour']),
- },
-
- limit: {
- validator: $.optional.num.range(1, 500),
- default: 30,
- },
-
- offset: {
- validator: $.optional.nullable.num,
- default: null,
- },
- },
-
- res: convertLog(usersChart.schema),
-};
-
-export default define(meta, async (ps) => {
- return await usersChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null);
-});