Refactoring

This commit is contained in:
syuilo
2018-10-23 05:36:35 +09:00
parent c8b6b6e44f
commit 7c7f32d9a6
32 changed files with 1125 additions and 1111 deletions

View File

@ -1,10 +1,10 @@
import $ from 'cafy';
import getParams from '../../get-params';
import { driveStats } from '../../../../services/stats';
import driveChart from '../../../../chart/drive';
export const meta = {
desc: {
'ja-JP': 'ドライブの統計を取得します。'
'ja-JP': 'ドライブのチャートを取得します。'
},
params: {
@ -27,7 +27,7 @@ export default (params: any) => new Promise(async (res, rej) => {
const [ps, psErr] = getParams(meta, params);
if (psErr) throw psErr;
const stats = await driveStats.getChart(ps.span as any, ps.limit);
const stats = await driveChart.getChart(ps.span as any, ps.limit);
res(stats);
});

View File

@ -1,10 +1,10 @@
import $ from 'cafy';
import getParams from '../../get-params';
import { hashtagStats } from '../../../../services/stats';
import hashtagChart from '../../../../chart/hashtag';
export const meta = {
desc: {
'ja-JP': 'ハッシュタグごとの統計を取得します。'
'ja-JP': 'ハッシュタグごとのチャートを取得します。'
},
params: {
@ -33,7 +33,7 @@ export default (params: any) => new Promise(async (res, rej) => {
const [ps, psErr] = getParams(meta, params);
if (psErr) throw psErr;
const stats = await hashtagStats.getChart(ps.span as any, ps.limit, ps.tag);
const stats = await hashtagChart.getChart(ps.span as any, ps.limit, ps.tag);
res(stats);
});

View File

@ -1,10 +1,10 @@
import $ from 'cafy';
import getParams from '../../get-params';
import { networkStats } from '../../../../services/stats';
import networkChart from '../../../../chart/network';
export const meta = {
desc: {
'ja-JP': 'ネットワークの統計を取得します。'
'ja-JP': 'ネットワークのチャートを取得します。'
},
params: {
@ -27,7 +27,7 @@ export default (params: any) => new Promise(async (res, rej) => {
const [ps, psErr] = getParams(meta, params);
if (psErr) throw psErr;
const stats = await networkStats.getChart(ps.span as any, ps.limit);
const stats = await networkChart.getChart(ps.span as any, ps.limit);
res(stats);
});

View File

@ -1,10 +1,10 @@
import $ from 'cafy';
import getParams from '../../get-params';
import { notesStats } from '../../../../services/stats';
import notesChart from '../../../../chart/notes';
export const meta = {
desc: {
'ja-JP': '投稿の統計を取得します。'
'ja-JP': '投稿のチャートを取得します。'
},
params: {
@ -27,7 +27,7 @@ export default (params: any) => new Promise(async (res, rej) => {
const [ps, psErr] = getParams(meta, params);
if (psErr) throw psErr;
const stats = await notesStats.getChart(ps.span as any, ps.limit);
const stats = await notesChart.getChart(ps.span as any, ps.limit);
res(stats);
});

View File

@ -1,11 +1,11 @@
import $ from 'cafy';
import getParams from '../../../get-params';
import { perUserDriveStats } from '../../../../../services/stats';
import perUserDriveChart from '../../../../../chart/per-user-drive';
import ID from '../../../../../misc/cafy-id';
export const meta = {
desc: {
'ja-JP': 'ユーザーごとのドライブの統計を取得します。'
'ja-JP': 'ユーザーごとのドライブのチャートを取得します。'
},
params: {
@ -35,7 +35,7 @@ export default (params: any) => new Promise(async (res, rej) => {
const [ps, psErr] = getParams(meta, params);
if (psErr) throw psErr;
const stats = await perUserDriveStats.getChart(ps.span as any, ps.limit, ps.userId);
const stats = await perUserDriveChart.getChart(ps.span as any, ps.limit, ps.userId);
res(stats);
});

View File

@ -1,11 +1,11 @@
import $ from 'cafy';
import getParams from '../../../get-params';
import { perUserFollowingStats } from '../../../../../services/stats';
import perUserFollowingChart from '../../../../../chart/per-user-following';
import ID from '../../../../../misc/cafy-id';
export const meta = {
desc: {
'ja-JP': 'ユーザーごとのフォロー/フォロワーの統計を取得します。'
'ja-JP': 'ユーザーごとのフォロー/フォロワーのチャートを取得します。'
},
params: {
@ -35,7 +35,7 @@ export default (params: any) => new Promise(async (res, rej) => {
const [ps, psErr] = getParams(meta, params);
if (psErr) throw psErr;
const stats = await perUserFollowingStats.getChart(ps.span as any, ps.limit, ps.userId);
const stats = await perUserFollowingChart.getChart(ps.span as any, ps.limit, ps.userId);
res(stats);
});

View File

@ -1,11 +1,11 @@
import $ from 'cafy';
import getParams from '../../../get-params';
import { perUserNotesStats } from '../../../../../services/stats';
import perUserNotesChart from '../../../../../chart/per-user-notes';
import ID from '../../../../../misc/cafy-id';
export const meta = {
desc: {
'ja-JP': 'ユーザーごとの投稿の統計を取得します。'
'ja-JP': 'ユーザーごとの投稿のチャートを取得します。'
},
params: {
@ -35,7 +35,7 @@ export default (params: any) => new Promise(async (res, rej) => {
const [ps, psErr] = getParams(meta, params);
if (psErr) throw psErr;
const stats = await perUserNotesStats.getChart(ps.span as any, ps.limit, ps.userId);
const stats = await perUserNotesChart.getChart(ps.span as any, ps.limit, ps.userId);
res(stats);
});

View File

@ -1,11 +1,11 @@
import $ from 'cafy';
import getParams from '../../../get-params';
import { perUserReactionsStats } from '../../../../../services/stats';
import perUserReactionsChart from '../../../../../chart/per-user-reactions';
import ID from '../../../../../misc/cafy-id';
export const meta = {
desc: {
'ja-JP': 'ユーザーごとの被リアクション数の統計を取得します。'
'ja-JP': 'ユーザーごとの被リアクション数のチャートを取得します。'
},
params: {
@ -35,7 +35,7 @@ export default (params: any) => new Promise(async (res, rej) => {
const [ps, psErr] = getParams(meta, params);
if (psErr) throw psErr;
const stats = await perUserReactionsStats.getChart(ps.span as any, ps.limit, ps.userId);
const stats = await perUserReactionsChart.getChart(ps.span as any, ps.limit, ps.userId);
res(stats);
});

View File

@ -1,10 +1,10 @@
import $ from 'cafy';
import getParams from '../../get-params';
import { usersStats } from '../../../../services/stats';
import usersChart from '../../../../chart/users';
export const meta = {
desc: {
'ja-JP': 'ユーザーの統計を取得します。'
'ja-JP': 'ユーザーのチャートを取得します。'
},
params: {
@ -27,7 +27,7 @@ export default (params: any) => new Promise(async (res, rej) => {
const [ps, psErr] = getParams(meta, params);
if (psErr) throw psErr;
const stats = await usersStats.getChart(ps.span as any, ps.limit);
const stats = await usersChart.getChart(ps.span as any, ps.limit);
res(stats);
});