Refactor
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../get-params';
|
||||
import define from '../../define';
|
||||
import driveChart from '../../../../chart/drive';
|
||||
|
||||
export const meta = {
|
||||
@@ -25,11 +25,8 @@ export const meta = {
|
||||
}
|
||||
};
|
||||
|
||||
export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||
const stats = await driveChart.getChart(ps.span as any, ps.limit);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
}));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../get-params';
|
||||
import define from '../../define';
|
||||
import federationChart from '../../../../chart/federation';
|
||||
|
||||
export const meta = {
|
||||
@@ -25,11 +25,8 @@ export const meta = {
|
||||
}
|
||||
};
|
||||
|
||||
export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||
const stats = await federationChart.getChart(ps.span as any, ps.limit);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
}));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../get-params';
|
||||
import define from '../../define';
|
||||
import hashtagChart from '../../../../chart/hashtag';
|
||||
|
||||
export const meta = {
|
||||
@@ -32,11 +32,8 @@ export const meta = {
|
||||
}
|
||||
};
|
||||
|
||||
export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||
const stats = await hashtagChart.getChart(ps.span as any, ps.limit, ps.tag);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
}));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../get-params';
|
||||
import define from '../../define';
|
||||
import networkChart from '../../../../chart/network';
|
||||
|
||||
export const meta = {
|
||||
@@ -25,11 +25,8 @@ export const meta = {
|
||||
}
|
||||
};
|
||||
|
||||
export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||
const stats = await networkChart.getChart(ps.span as any, ps.limit);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
}));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../get-params';
|
||||
import define from '../../define';
|
||||
import notesChart from '../../../../chart/notes';
|
||||
|
||||
export const meta = {
|
||||
@@ -25,11 +25,8 @@ export const meta = {
|
||||
}
|
||||
};
|
||||
|
||||
export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||
const stats = await notesChart.getChart(ps.span as any, ps.limit);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
}));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../../get-params';
|
||||
import define from '../../../define';
|
||||
import perUserDriveChart from '../../../../../chart/per-user-drive';
|
||||
import ID, { transform } from '../../../../../misc/cafy-id';
|
||||
|
||||
@@ -35,11 +35,8 @@ export const meta = {
|
||||
}
|
||||
};
|
||||
|
||||
export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||
const stats = await perUserDriveChart.getChart(ps.span as any, ps.limit, ps.userId);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
}));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../../get-params';
|
||||
import define from '../../../define';
|
||||
import perUserFollowingChart from '../../../../../chart/per-user-following';
|
||||
import ID, { transform } from '../../../../../misc/cafy-id';
|
||||
|
||||
@@ -35,11 +35,8 @@ export const meta = {
|
||||
}
|
||||
};
|
||||
|
||||
export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||
const stats = await perUserFollowingChart.getChart(ps.span as any, ps.limit, ps.userId);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
}));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../../get-params';
|
||||
import define from '../../../define';
|
||||
import perUserNotesChart from '../../../../../chart/per-user-notes';
|
||||
import ID, { transform } from '../../../../../misc/cafy-id';
|
||||
|
||||
@@ -35,11 +35,8 @@ export const meta = {
|
||||
}
|
||||
};
|
||||
|
||||
export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||
const stats = await perUserNotesChart.getChart(ps.span as any, ps.limit, ps.userId);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
}));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../../get-params';
|
||||
import define from '../../../define';
|
||||
import perUserReactionsChart from '../../../../../chart/per-user-reactions';
|
||||
import ID, { transform } from '../../../../../misc/cafy-id';
|
||||
|
||||
@@ -35,11 +35,8 @@ export const meta = {
|
||||
}
|
||||
};
|
||||
|
||||
export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||
const stats = await perUserReactionsChart.getChart(ps.span as any, ps.limit, ps.userId);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
}));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../get-params';
|
||||
import define from '../../define';
|
||||
import usersChart from '../../../../chart/users';
|
||||
|
||||
export const meta = {
|
||||
@@ -25,11 +25,8 @@ export const meta = {
|
||||
}
|
||||
};
|
||||
|
||||
export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) return rej(psErr);
|
||||
|
||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||
const stats = await usersChart.getChart(ps.span as any, ps.limit);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
}));
|
||||
|
Reference in New Issue
Block a user