mirror of
https://github.com/misskey-dev/misskey
synced 2024-08-18 07:41:55 +02:00
Improve API
This commit is contained in:
parent
e50fa4762d
commit
117ab633a1
|
@ -1,4 +1,6 @@
|
||||||
|
import $ from 'cafy';
|
||||||
import Stats, { IStats } from '../../../models/stats';
|
import Stats, { IStats } from '../../../models/stats';
|
||||||
|
import getParams from '../../get-params';
|
||||||
|
|
||||||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||||
|
|
||||||
|
@ -44,11 +46,26 @@ function migrateStats(stats: IStats[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
desc: {
|
||||||
|
'ja-JP': 'インスタンスの統計を取得します。'
|
||||||
|
},
|
||||||
|
|
||||||
|
params: {
|
||||||
|
limit: $.num.optional.range(1, 100).note({
|
||||||
|
default: 30,
|
||||||
|
desc: {
|
||||||
|
'ja-JP': '最大数'
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (params: any) => new Promise(async (res, rej) => {
|
export default (params: any) => new Promise(async (res, rej) => {
|
||||||
const daysRange = 30;
|
const [ps, psErr] = getParams(meta, params);
|
||||||
const hoursRange = 30;
|
if (psErr) throw psErr;
|
||||||
|
|
||||||
|
const daysRange = ps.limit;
|
||||||
|
const hoursRange = ps.limit;
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const y = now.getFullYear();
|
const y = now.getFullYear();
|
||||||
|
|
Loading…
Reference in a new issue