2022-02-27 02:07:39 +00:00
|
|
|
import define from '../define.js';
|
|
|
|
import { Instances, NoteReactions, Notes, Users } from '@/models/index.js';
|
|
|
|
import { } from '@/services/chart/index.js';
|
2017-08-12 06:17:03 +00:00
|
|
|
|
2018-11-02 04:47:44 +00:00
|
|
|
export const meta = {
|
2022-01-18 13:27:10 +00:00
|
|
|
requireCredential: false,
|
2018-11-02 04:47:44 +00:00
|
|
|
|
2019-02-23 02:20:58 +00:00
|
|
|
tags: ['meta'],
|
|
|
|
|
2019-02-24 18:30:22 +00:00
|
|
|
res: {
|
2022-01-18 13:27:10 +00:00
|
|
|
type: 'object',
|
|
|
|
optional: false, nullable: false,
|
2019-02-24 18:30:22 +00:00
|
|
|
properties: {
|
|
|
|
notesCount: {
|
2022-01-18 13:27:10 +00:00
|
|
|
type: 'number',
|
|
|
|
optional: false, nullable: false,
|
2019-02-24 18:30:22 +00:00
|
|
|
},
|
|
|
|
originalNotesCount: {
|
2022-01-18 13:27:10 +00:00
|
|
|
type: 'number',
|
|
|
|
optional: false, nullable: false,
|
2019-02-24 18:30:22 +00:00
|
|
|
},
|
|
|
|
usersCount: {
|
2022-01-18 13:27:10 +00:00
|
|
|
type: 'number',
|
|
|
|
optional: false, nullable: false,
|
2019-02-24 18:30:22 +00:00
|
|
|
},
|
|
|
|
originalUsersCount: {
|
2022-01-18 13:27:10 +00:00
|
|
|
type: 'number',
|
|
|
|
optional: false, nullable: false,
|
2019-02-24 18:30:22 +00:00
|
|
|
},
|
|
|
|
instances: {
|
2022-01-18 13:27:10 +00:00
|
|
|
type: 'number',
|
|
|
|
optional: false, nullable: false,
|
2019-02-24 18:30:22 +00:00
|
|
|
},
|
2021-03-06 13:34:11 +00:00
|
|
|
driveUsageLocal: {
|
2022-01-18 13:27:10 +00:00
|
|
|
type: 'number',
|
|
|
|
optional: false, nullable: false,
|
2021-03-06 13:34:11 +00:00
|
|
|
},
|
|
|
|
driveUsageRemote: {
|
2022-01-18 13:27:10 +00:00
|
|
|
type: 'number',
|
|
|
|
optional: false, nullable: false,
|
2021-12-09 14:58:30 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-01-18 13:27:10 +00:00
|
|
|
} as const;
|
2018-11-02 04:47:44 +00:00
|
|
|
|
2022-02-20 04:15:40 +00:00
|
|
|
export const paramDef = {
|
2022-02-19 05:05:32 +00:00
|
|
|
type: 'object',
|
|
|
|
properties: {},
|
|
|
|
required: [],
|
|
|
|
} as const;
|
|
|
|
|
2022-01-02 17:12:50 +00:00
|
|
|
// eslint-disable-next-line import/no-default-export
|
2022-02-19 05:05:32 +00:00
|
|
|
export default define(meta, paramDef, async () => {
|
2020-12-05 09:18:37 +00:00
|
|
|
const [
|
|
|
|
notesCount,
|
2019-04-23 13:35:26 +00:00
|
|
|
originalNotesCount,
|
|
|
|
usersCount,
|
|
|
|
originalUsersCount,
|
2020-12-05 09:18:37 +00:00
|
|
|
reactionsCount,
|
|
|
|
//originalReactionsCount,
|
2019-04-23 13:35:26 +00:00
|
|
|
instances,
|
|
|
|
] = await Promise.all([
|
2019-05-24 23:35:16 +00:00
|
|
|
Notes.count({ cache: 3600000 }), // 1 hour
|
|
|
|
Notes.count({ where: { userHost: null }, cache: 3600000 }),
|
|
|
|
Users.count({ cache: 3600000 }),
|
|
|
|
Users.count({ where: { host: null }, cache: 3600000 }),
|
2020-12-05 09:18:37 +00:00
|
|
|
NoteReactions.count({ cache: 3600000 }), // 1 hour
|
|
|
|
//NoteReactions.count({ where: { userHost: null }, cache: 3600000 }),
|
2022-02-12 08:33:29 +00:00
|
|
|
Instances.count({ cache: 3600000 }),
|
2019-04-07 12:50:36 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
return {
|
2019-04-23 13:35:26 +00:00
|
|
|
notesCount,
|
|
|
|
originalNotesCount,
|
|
|
|
usersCount,
|
|
|
|
originalUsersCount,
|
2020-12-05 09:18:37 +00:00
|
|
|
reactionsCount,
|
|
|
|
//originalReactionsCount,
|
2019-04-23 13:35:26 +00:00
|
|
|
instances,
|
2022-02-05 15:43:22 +00:00
|
|
|
driveUsageLocal: 0,
|
|
|
|
driveUsageRemote: 0,
|
2019-04-07 12:50:36 +00:00
|
|
|
};
|
2019-02-22 02:46:58 +00:00
|
|
|
});
|