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