なんかもうめっちゃ変えた
This commit is contained in:
parent
d9ab03f086
commit
b75184ec8e
946 changed files with 41219 additions and 28839 deletions
|
@ -1,7 +1,8 @@
|
|||
import { Instances, NoteReactions, Notes, Users } from '@/models/index.js';
|
||||
import define from '../define.js';
|
||||
import { } from '@/services/chart/index.js';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { IsNull } from 'typeorm';
|
||||
import { InstancesRepository, NotesRepository, UsersRepository } from '@/models/index.js';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: false,
|
||||
|
@ -51,34 +52,51 @@ export const paramDef = {
|
|||
} as const;
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async () => {
|
||||
const [
|
||||
notesCount,
|
||||
originalNotesCount,
|
||||
usersCount,
|
||||
originalUsersCount,
|
||||
reactionsCount,
|
||||
//originalReactionsCount,
|
||||
instances,
|
||||
] = await Promise.all([
|
||||
Notes.count({ cache: 3600000 }), // 1 hour
|
||||
Notes.count({ where: { userHost: IsNull() }, cache: 3600000 }),
|
||||
Users.count({ cache: 3600000 }),
|
||||
Users.count({ where: { host: IsNull() }, cache: 3600000 }),
|
||||
NoteReactions.count({ cache: 3600000 }), // 1 hour
|
||||
//NoteReactions.count({ where: { userHost: IsNull() }, cache: 3600000 }),
|
||||
Instances.count({ cache: 3600000 }),
|
||||
]);
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
constructor(
|
||||
@Inject(DI.usersRepository)
|
||||
private usersRepository: UsersRepository,
|
||||
|
||||
return {
|
||||
notesCount,
|
||||
originalNotesCount,
|
||||
usersCount,
|
||||
originalUsersCount,
|
||||
reactionsCount,
|
||||
//originalReactionsCount,
|
||||
instances,
|
||||
driveUsageLocal: 0,
|
||||
driveUsageRemote: 0,
|
||||
};
|
||||
});
|
||||
@Inject(DI.notesRepository)
|
||||
private notesRepository: NotesRepository,
|
||||
|
||||
@Inject(DI.instancesRepository)
|
||||
private instancesRepository: InstancesRepository,
|
||||
|
||||
@Inject(DI.noteReactionsRepository)
|
||||
private noteReactionsRepository: NoteReactionsRepository,
|
||||
) {
|
||||
super(meta, paramDef, async () => {
|
||||
const [
|
||||
notesCount,
|
||||
originalNotesCount,
|
||||
usersCount,
|
||||
originalUsersCount,
|
||||
reactionsCount,
|
||||
//originalReactionsCount,
|
||||
instances,
|
||||
] = await Promise.all([
|
||||
this.notesRepository.count({ cache: 3600000 }), // 1 hour
|
||||
this.notesRepository.count({ where: { userHost: IsNull() }, cache: 3600000 }),
|
||||
this.usersRepository.count({ cache: 3600000 }),
|
||||
this.usersRepository.count({ where: { host: IsNull() }, cache: 3600000 }),
|
||||
this.noteReactionsRepository.count({ cache: 3600000 }), // 1 hour
|
||||
//this.noteReactionsRepository.count({ where: { userHost: IsNull() }, cache: 3600000 }),
|
||||
this.instancesRepository.count({ cache: 3600000 }),
|
||||
]);
|
||||
|
||||
return {
|
||||
notesCount,
|
||||
originalNotesCount,
|
||||
usersCount,
|
||||
originalUsersCount,
|
||||
reactionsCount,
|
||||
//originalReactionsCount,
|
||||
instances,
|
||||
driveUsageLocal: 0,
|
||||
driveUsageRemote: 0,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue