なんかもうめっちゃ変えた
This commit is contained in:
parent
d9ab03f086
commit
b75184ec8e
946 changed files with 41219 additions and 28839 deletions
|
@ -1,7 +1,9 @@
|
|||
import { MoreThan } from 'typeorm';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { USER_ONLINE_THRESHOLD } from '@/const.js';
|
||||
import { Users } from '@/models/index.js';
|
||||
import define from '../define.js';
|
||||
import { UsersRepository } from '@/models/index.js';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['meta'],
|
||||
|
@ -16,12 +18,20 @@ export const paramDef = {
|
|||
} as const;
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async () => {
|
||||
const count = await Users.countBy({
|
||||
lastActiveDate: MoreThan(new Date(Date.now() - USER_ONLINE_THRESHOLD)),
|
||||
});
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
constructor(
|
||||
@Inject(DI.usersRepository)
|
||||
private usersRepository: UsersRepository,
|
||||
) {
|
||||
super(meta, paramDef, async () => {
|
||||
const count = await this.usersRepository.countBy({
|
||||
lastActiveDate: MoreThan(new Date(Date.now() - USER_ONLINE_THRESHOLD)),
|
||||
});
|
||||
|
||||
return {
|
||||
count,
|
||||
};
|
||||
});
|
||||
return {
|
||||
count,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue