refactor: introduce bindThis decorator to bind this automaticaly

This commit is contained in:
syuilo
2022-12-04 15:03:09 +09:00
parent e73581f715
commit bbb49457f9
199 changed files with 969 additions and 96 deletions

View File

@ -8,6 +8,7 @@ import { UserSuspendService } from '@/core/UserSuspendService.js';
import { UserFollowingService } from '@/core/UserFollowingService.js';
import { DI } from '@/di-symbols.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { bindThis } from '@/decorators.js';
export const meta = {
tags: ['admin'],
@ -79,6 +80,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
});
}
@bindThis
private async unFollowAll(follower: User) {
const followings = await this.followingsRepository.findBy({
followerId: follower.id,
@ -97,6 +99,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
}
}
@bindThis
private async readAllNotify(notifier: User) {
await this.notificationsRepository.update({
notifierId: notifier.id,