diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-04-14 20:38:55 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-04-14 20:38:55 +0900 |
| commit | d66e4b7ff97d512e2a2523815e2eef170456b37f (patch) | |
| tree | 59ae1a102d88b5c2c2236b734ea4a584b4f9ba46 /src/server/api/endpoints/charts | |
| parent | 10.100.0 (diff) | |
| parent | 11.0.0 (diff) | |
| download | misskey-d66e4b7ff97d512e2a2523815e2eef170456b37f.tar.gz misskey-d66e4b7ff97d512e2a2523815e2eef170456b37f.tar.bz2 misskey-d66e4b7ff97d512e2a2523815e2eef170456b37f.zip | |
Merge branch 'develop'
Diffstat (limited to 'src/server/api/endpoints/charts')
| -rw-r--r-- | src/server/api/endpoints/charts/active-users.ts | 12 | ||||
| -rw-r--r-- | src/server/api/endpoints/charts/drive.ts | 8 | ||||
| -rw-r--r-- | src/server/api/endpoints/charts/federation.ts | 12 | ||||
| -rw-r--r-- | src/server/api/endpoints/charts/hashtag.ts | 12 | ||||
| -rw-r--r-- | src/server/api/endpoints/charts/instance.ts | 12 | ||||
| -rw-r--r-- | src/server/api/endpoints/charts/network.ts | 12 | ||||
| -rw-r--r-- | src/server/api/endpoints/charts/notes.ts | 8 | ||||
| -rw-r--r-- | src/server/api/endpoints/charts/user/drive.ts | 11 | ||||
| -rw-r--r-- | src/server/api/endpoints/charts/user/following.ts | 11 | ||||
| -rw-r--r-- | src/server/api/endpoints/charts/user/notes.ts | 11 | ||||
| -rw-r--r-- | src/server/api/endpoints/charts/user/reactions.ts | 15 | ||||
| -rw-r--r-- | src/server/api/endpoints/charts/users.ts | 8 |
12 files changed, 52 insertions, 80 deletions
diff --git a/src/server/api/endpoints/charts/active-users.ts b/src/server/api/endpoints/charts/active-users.ts index 9dad942e06..f0349b17f3 100644 --- a/src/server/api/endpoints/charts/active-users.ts +++ b/src/server/api/endpoints/charts/active-users.ts @@ -1,6 +1,7 @@ import $ from 'cafy'; import define from '../../define'; -import activeUsersChart from '../../../../services/chart/active-users'; +import { convertLog } from '../../../../services/chart/core'; +import { activeUsersChart } from '../../../../services/chart'; export const meta = { stability: 'stable', @@ -28,14 +29,9 @@ export const meta = { }, }, - res: { - type: 'array', - items: { - type: 'object', - }, - }, + res: convertLog(activeUsersChart.schema), }; export default define(meta, async (ps) => { - return await activeUsersChart.getChart(ps.span as any, ps.limit); + return await activeUsersChart.getChart(ps.span as any, ps.limit!); }); diff --git a/src/server/api/endpoints/charts/drive.ts b/src/server/api/endpoints/charts/drive.ts index 6bbb266f96..ae6d894407 100644 --- a/src/server/api/endpoints/charts/drive.ts +++ b/src/server/api/endpoints/charts/drive.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; import define from '../../define'; -import driveChart, { driveLogSchema } from '../../../../services/chart/drive'; -import { convertLog } from '../../../../services/chart'; +import { convertLog } from '../../../../services/chart/core'; +import { driveChart } from '../../../../services/chart'; export const meta = { stability: 'stable', @@ -29,9 +29,9 @@ export const meta = { }, }, - res: convertLog(driveLogSchema), + res: convertLog(driveChart.schema), }; export default define(meta, async (ps) => { - return await driveChart.getChart(ps.span as any, ps.limit); + return await driveChart.getChart(ps.span as any, ps.limit!); }); diff --git a/src/server/api/endpoints/charts/federation.ts b/src/server/api/endpoints/charts/federation.ts index c7b34f1015..34e9bfee5f 100644 --- a/src/server/api/endpoints/charts/federation.ts +++ b/src/server/api/endpoints/charts/federation.ts @@ -1,6 +1,7 @@ import $ from 'cafy'; import define from '../../define'; -import federationChart from '../../../../services/chart/federation'; +import { convertLog } from '../../../../services/chart/core'; +import { federationChart } from '../../../../services/chart'; export const meta = { stability: 'stable', @@ -28,14 +29,9 @@ export const meta = { }, }, - res: { - type: 'array', - items: { - type: 'object', - }, - }, + res: convertLog(federationChart.schema), }; export default define(meta, async (ps) => { - return await federationChart.getChart(ps.span as any, ps.limit); + return await federationChart.getChart(ps.span as any, ps.limit!); }); diff --git a/src/server/api/endpoints/charts/hashtag.ts b/src/server/api/endpoints/charts/hashtag.ts index 4db6e62408..eceb0b275c 100644 --- a/src/server/api/endpoints/charts/hashtag.ts +++ b/src/server/api/endpoints/charts/hashtag.ts @@ -1,6 +1,7 @@ import $ from 'cafy'; import define from '../../define'; -import hashtagChart from '../../../../services/chart/hashtag'; +import { convertLog } from '../../../../services/chart/core'; +import { hashtagChart } from '../../../../services/chart'; export const meta = { stability: 'stable', @@ -35,14 +36,9 @@ export const meta = { }, }, - res: { - type: 'array', - items: { - type: 'object', - }, - }, + res: convertLog(hashtagChart.schema), }; export default define(meta, async (ps) => { - return await hashtagChart.getChart(ps.span as any, ps.limit, ps.tag); + return await hashtagChart.getChart(ps.span as any, ps.limit!, ps.tag); }); diff --git a/src/server/api/endpoints/charts/instance.ts b/src/server/api/endpoints/charts/instance.ts index 3fe85f086a..e99c17ae65 100644 --- a/src/server/api/endpoints/charts/instance.ts +++ b/src/server/api/endpoints/charts/instance.ts @@ -1,6 +1,7 @@ import $ from 'cafy'; import define from '../../define'; -import instanceChart from '../../../../services/chart/instance'; +import { convertLog } from '../../../../services/chart/core'; +import { instanceChart } from '../../../../services/chart'; export const meta = { stability: 'stable', @@ -36,14 +37,9 @@ export const meta = { } }, - res: { - type: 'array', - items: { - type: 'object', - }, - }, + res: convertLog(instanceChart.schema), }; export default define(meta, async (ps) => { - return await instanceChart.getChart(ps.span as any, ps.limit, ps.host); + return await instanceChart.getChart(ps.span as any, ps.limit!, ps.host); }); diff --git a/src/server/api/endpoints/charts/network.ts b/src/server/api/endpoints/charts/network.ts index 48b1d0f66f..648588fbe5 100644 --- a/src/server/api/endpoints/charts/network.ts +++ b/src/server/api/endpoints/charts/network.ts @@ -1,6 +1,7 @@ import $ from 'cafy'; import define from '../../define'; -import networkChart from '../../../../services/chart/network'; +import { convertLog } from '../../../../services/chart/core'; +import { networkChart } from '../../../../services/chart'; export const meta = { stability: 'stable', @@ -28,14 +29,9 @@ export const meta = { }, }, - res: { - type: 'array', - items: { - type: 'object', - }, - }, + res: convertLog(networkChart.schema), }; export default define(meta, async (ps) => { - return await networkChart.getChart(ps.span as any, ps.limit); + return await networkChart.getChart(ps.span as any, ps.limit!); }); diff --git a/src/server/api/endpoints/charts/notes.ts b/src/server/api/endpoints/charts/notes.ts index cc0ca8bef7..074c4978cd 100644 --- a/src/server/api/endpoints/charts/notes.ts +++ b/src/server/api/endpoints/charts/notes.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; import define from '../../define'; -import notesChart, { notesLogSchema } from '../../../../services/chart/notes'; -import { convertLog } from '../../../../services/chart'; +import { convertLog } from '../../../../services/chart/core'; +import { notesChart } from '../../../../services/chart'; export const meta = { stability: 'stable', @@ -29,9 +29,9 @@ export const meta = { }, }, - res: convertLog(notesLogSchema), + res: convertLog(notesChart.schema), }; export default define(meta, async (ps) => { - return await notesChart.getChart(ps.span as any, ps.limit); + return await notesChart.getChart(ps.span as any, ps.limit!); }); diff --git a/src/server/api/endpoints/charts/user/drive.ts b/src/server/api/endpoints/charts/user/drive.ts index 064c7c7b72..918fb62c6a 100644 --- a/src/server/api/endpoints/charts/user/drive.ts +++ b/src/server/api/endpoints/charts/user/drive.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; import define from '../../../define'; -import perUserDriveChart, { perUserDriveLogSchema } from '../../../../../services/chart/per-user-drive'; -import ID, { transform } from '../../../../../misc/cafy-id'; -import { convertLog } from '../../../../../services/chart'; +import { ID } from '../../../../../misc/cafy-id'; +import { convertLog } from '../../../../../services/chart/core'; +import { perUserDriveChart } from '../../../../../services/chart'; export const meta = { stability: 'stable', @@ -31,7 +31,6 @@ export const meta = { userId: { validator: $.type(ID), - transform: transform, desc: { 'ja-JP': '対象のユーザーのID', 'en-US': 'Target user ID' @@ -39,9 +38,9 @@ export const meta = { } }, - res: convertLog(perUserDriveLogSchema), + res: convertLog(perUserDriveChart.schema), }; export default define(meta, async (ps) => { - return await perUserDriveChart.getChart(ps.span as any, ps.limit, ps.userId); + return await perUserDriveChart.getChart(ps.span as any, ps.limit!, ps.userId); }); diff --git a/src/server/api/endpoints/charts/user/following.ts b/src/server/api/endpoints/charts/user/following.ts index f5b1355038..5d86e85d31 100644 --- a/src/server/api/endpoints/charts/user/following.ts +++ b/src/server/api/endpoints/charts/user/following.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; import define from '../../../define'; -import perUserFollowingChart, { perUserFollowingLogSchema } from '../../../../../services/chart/per-user-following'; -import ID, { transform } from '../../../../../misc/cafy-id'; -import { convertLog } from '../../../../../services/chart'; +import { ID } from '../../../../../misc/cafy-id'; +import { convertLog } from '../../../../../services/chart/core'; +import { perUserFollowingChart } from '../../../../../services/chart'; export const meta = { stability: 'stable', @@ -31,7 +31,6 @@ export const meta = { userId: { validator: $.type(ID), - transform: transform, desc: { 'ja-JP': '対象のユーザーのID', 'en-US': 'Target user ID' @@ -39,9 +38,9 @@ export const meta = { } }, - res: convertLog(perUserFollowingLogSchema), + res: convertLog(perUserFollowingChart.schema), }; export default define(meta, async (ps) => { - return await perUserFollowingChart.getChart(ps.span as any, ps.limit, ps.userId); + return await perUserFollowingChart.getChart(ps.span as any, ps.limit!, ps.userId); }); diff --git a/src/server/api/endpoints/charts/user/notes.ts b/src/server/api/endpoints/charts/user/notes.ts index 7e31978bf3..d39a20df16 100644 --- a/src/server/api/endpoints/charts/user/notes.ts +++ b/src/server/api/endpoints/charts/user/notes.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; import define from '../../../define'; -import perUserNotesChart, { perUserNotesLogSchema } from '../../../../../services/chart/per-user-notes'; -import ID, { transform } from '../../../../../misc/cafy-id'; -import { convertLog } from '../../../../../services/chart'; +import { ID } from '../../../../../misc/cafy-id'; +import { convertLog } from '../../../../../services/chart/core'; +import { perUserNotesChart } from '../../../../../services/chart'; export const meta = { stability: 'stable', @@ -31,7 +31,6 @@ export const meta = { userId: { validator: $.type(ID), - transform: transform, desc: { 'ja-JP': '対象のユーザーのID', 'en-US': 'Target user ID' @@ -39,9 +38,9 @@ export const meta = { } }, - res: convertLog(perUserNotesLogSchema), + res: convertLog(perUserNotesChart.schema), }; export default define(meta, async (ps) => { - return await perUserNotesChart.getChart(ps.span as any, ps.limit, ps.userId); + return await perUserNotesChart.getChart(ps.span as any, ps.limit!, ps.userId); }); diff --git a/src/server/api/endpoints/charts/user/reactions.ts b/src/server/api/endpoints/charts/user/reactions.ts index 51ff83f20e..5b88a1d715 100644 --- a/src/server/api/endpoints/charts/user/reactions.ts +++ b/src/server/api/endpoints/charts/user/reactions.ts @@ -1,7 +1,8 @@ import $ from 'cafy'; import define from '../../../define'; -import perUserReactionsChart from '../../../../../services/chart/per-user-reactions'; -import ID, { transform } from '../../../../../misc/cafy-id'; +import { ID } from '../../../../../misc/cafy-id'; +import { convertLog } from '../../../../../services/chart/core'; +import { perUserReactionsChart } from '../../../../../services/chart'; export const meta = { stability: 'stable', @@ -30,7 +31,6 @@ export const meta = { userId: { validator: $.type(ID), - transform: transform, desc: { 'ja-JP': '対象のユーザーのID', 'en-US': 'Target user ID' @@ -38,14 +38,9 @@ export const meta = { } }, - res: { - type: 'array', - items: { - type: 'object', - }, - }, + res: convertLog(perUserReactionsChart.schema), }; export default define(meta, async (ps) => { - return await perUserReactionsChart.getChart(ps.span as any, ps.limit, ps.userId); + return await perUserReactionsChart.getChart(ps.span as any, ps.limit!, ps.userId); }); diff --git a/src/server/api/endpoints/charts/users.ts b/src/server/api/endpoints/charts/users.ts index 9de54a630e..17de5756da 100644 --- a/src/server/api/endpoints/charts/users.ts +++ b/src/server/api/endpoints/charts/users.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; import define from '../../define'; -import usersChart, { usersLogSchema } from '../../../../services/chart/users'; -import { convertLog } from '../../../../services/chart'; +import { convertLog } from '../../../../services/chart/core'; +import { usersChart } from '../../../../services/chart'; export const meta = { stability: 'stable', @@ -29,9 +29,9 @@ export const meta = { }, }, - res: convertLog(usersLogSchema), + res: convertLog(usersChart.schema), }; export default define(meta, async (ps) => { - return await usersChart.getChart(ps.span as any, ps.limit); + return await usersChart.getChart(ps.span as any, ps.limit!); }); |