This commit is contained in:
syuilo
2023-04-05 13:57:22 +09:00
parent 288cce4a22
commit a093c373c4
2 changed files with 21 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
import { Inject, Injectable } from '@nestjs/common';
import { Inject, Injectable, OnModuleInit } from '@nestjs/common';
import { ModuleRef } from '@nestjs/core';
import { IdService } from '@/core/IdService.js';
import type { User } from '@/models/entities/User.js';
import type { Blocking } from '@/models/entities/Blocking.js';
@@ -17,10 +18,13 @@ import { CacheService } from '@/core/CacheService.js';
import { UserFollowingService } from '@/core/UserFollowingService.js';
@Injectable()
export class UserBlockingService {
export class UserBlockingService implements OnModuleInit {
private logger: Logger;
private userFollowingService: UserFollowingService;
constructor(
private moduleRef: ModuleRef,
@Inject(DI.followRequestsRepository)
private followRequestsRepository: FollowRequestsRepository,
@@ -34,7 +38,6 @@ export class UserBlockingService {
private userListJoiningsRepository: UserListJoiningsRepository,
private cacheService: CacheService,
private userFollowingService: UserFollowingService,
private userEntityService: UserEntityService,
private idService: IdService,
private queueService: QueueService,
@@ -46,6 +49,10 @@ export class UserBlockingService {
this.logger = this.loggerService.getLogger('user-block');
}
onModuleInit() {
this.userFollowingService = this.moduleRef.get('UserFollowingService');
}
@bindThis
public async block(blocker: User, blockee: User) {
await Promise.all([