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:
Mathis HERRIOT
2026-01-29 16:49:13 +01:00
parent 001cdaff8f
commit 7c065a2fb9
3 changed files with 10 additions and 5 deletions

View File

@@ -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 &&