refactoring

Resolve #7779
This commit is contained in:
syuilo
2021-11-12 02:02:25 +09:00
parent 037837b551
commit 0e4a111f81
1714 changed files with 20803 additions and 11751 deletions

View File

@@ -0,0 +1,30 @@
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);
});

View File

@@ -0,0 +1,30 @@
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);
});

View File

@@ -0,0 +1,30 @@
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);
});

View File

@@ -0,0 +1,34 @@
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);
});

View File

@@ -0,0 +1,34 @@
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);
});

View File

@@ -0,0 +1,30 @@
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);
});

View File

@@ -0,0 +1,30 @@
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);
});

View File

@@ -0,0 +1,35 @@
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);
});

View File

@@ -0,0 +1,35 @@
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);
});

View File

@@ -0,0 +1,35 @@
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);
});

View File

@@ -0,0 +1,35 @@
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);
});

View File

@@ -0,0 +1,30 @@
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);
});