feat: inject ContentsRepository into CommentsService for better integration
- Added `ContentsRepository` as a dependency to `CommentsService` and updated tests for mock setup. - Adjusted import order in relevant files to align with project standards.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
ForbiddenException,
|
||||
forwardRef,
|
||||
Inject,
|
||||
Injectable,
|
||||
NotFoundException,
|
||||
forwardRef,
|
||||
} from "@nestjs/common";
|
||||
import { ContentsRepository } from "../contents/repositories/contents.repository";
|
||||
import { EventsGateway } from "../realtime/events.gateway";
|
||||
@@ -54,9 +54,7 @@ export class CommentsService {
|
||||
|
||||
// 2. Si c'est une réponse, notifier l'auteur du commentaire parent
|
||||
if (dto.parentId) {
|
||||
const parentComment = await this.commentsRepository.findOne(
|
||||
dto.parentId,
|
||||
);
|
||||
const parentComment = await this.commentsRepository.findOne(dto.parentId);
|
||||
if (
|
||||
parentComment &&
|
||||
parentComment.userId !== userId &&
|
||||
|
||||
Reference in New Issue
Block a user