From 57be754ed2f57af14e3c311173eeb6dde62ff179 Mon Sep 17 00:00:00 2001 From: Christian Umoh Date: Sat, 1 Mar 2025 14:23:58 +0100 Subject: [PATCH 1/9] =?UTF-8?q?=1B[200~feat(comments):=20add=20threading?= =?UTF-8?q?=20support=20with=20parent=20and=20replies=20relations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/comments/entities/comments.entity.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/comments/entities/comments.entity.ts b/src/modules/comments/entities/comments.entity.ts index 1ecbf0ef7..f3d4d1fc5 100644 --- a/src/modules/comments/entities/comments.entity.ts +++ b/src/modules/comments/entities/comments.entity.ts @@ -1,4 +1,4 @@ -import { Column, Entity, ManyToOne } from 'typeorm'; +import { Column, Entity, ManyToOne, OneToMany } from 'typeorm'; import { AbstractBaseEntity } from '../../../entities/base.entity'; import { Product } from '../../products/entities/product.entity'; import { User } from '../../user/entities/user.entity'; @@ -19,4 +19,11 @@ export class Comment extends AbstractBaseEntity { @Column() model_type: string; -} + + // Threading fields for PostgreSQL + @ManyToOne(() => Comment, comment => comment.replies, { nullable: true }) + parent: Comment; + + @OneToMany(() => Comment, comment => comment.parent) + replies: Comment[]; +} \ No newline at end of file From 0b522e4868abbdc8046dc0aa465ff0c03d7aa676 Mon Sep 17 00:00:00 2001 From: Christian Umoh Date: Sat, 1 Mar 2025 14:29:13 +0100 Subject: [PATCH 2/9] feat(comments): extend CreateCommentDto with optional parentId for threading - Added `parentId` field to `CreateCommentDto` to allow specifying a parent comment for replies.\n- Applied `@IsUUID('4')` and `@IsOptional()` validations for PostgreSQL UUID compatibility and flexibility.\n- Updated Swagger `@ApiProperty` to document the new field as optional. --- src/modules/comments/dtos/create-comment.dto.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/comments/dtos/create-comment.dto.ts b/src/modules/comments/dtos/create-comment.dto.ts index c0c0e3d1d..a4fa89cb0 100644 --- a/src/modules/comments/dtos/create-comment.dto.ts +++ b/src/modules/comments/dtos/create-comment.dto.ts @@ -1,4 +1,4 @@ -import { IsString, IsNotEmpty } from 'class-validator'; +import { IsString, IsNotEmpty, IsUUID, IsOptional } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; export class CreateCommentDto { @@ -16,4 +16,12 @@ export class CreateCommentDto { @IsString() @IsNotEmpty() comment: string; -} + + @ApiProperty({ + description: 'The ID of the parent comment (optional, for replies)', + required: false + }) + @IsUUID('4') // PostgreSQL-friendly UUID v4 + @IsOptional() + parentId?: string; +} \ No newline at end of file From e2bdc82c7ab60015900598b22f8f9fc93fc5a87e Mon Sep 17 00:00:00 2001 From: Christian Umoh Date: Sat, 1 Mar 2025 14:30:37 +0100 Subject: [PATCH 3/9] feat(comments): add GET /comments/:id/thread endpoint for threading - Introduced `getCommentThread` endpoint to retrieve a comment and its nested replies.\n- Added Swagger documentation with `@ApiOperation` and `@ApiResponse` for clarity.\n- Integrates with `CommentsService.getCommentThread` to expose threading functionality via the API. --- src/modules/comments/comments.controller.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/modules/comments/comments.controller.ts b/src/modules/comments/comments.controller.ts index a0d6f48dd..494a3c5d7 100644 --- a/src/modules/comments/comments.controller.ts +++ b/src/modules/comments/comments.controller.ts @@ -8,7 +8,8 @@ import { ApiBearerAuth, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagg @ApiTags('Comments') @Controller('comments') export class CommentsController { - constructor(private readonly commentsService: CommentsService) {} + constructor(private readonly commentsService: CommentsService) { } + @Post('add') @ApiOperation({ summary: 'Create a new comment' }) @ApiResponse({ status: 201, description: 'The comment has been successfully created.', type: CommentResponseDto }) @@ -19,10 +20,18 @@ export class CommentsController { return await this.commentsService.addComment(createCommentDto, userId); } + @Get(':id') @ApiOperation({ summary: 'Get a comment' }) @ApiResponse({ status: 200, description: 'The comment has been retrieved successfully.' }) - @Get(':id') async getAComment(@Param('id') id: string): Promise { return await this.commentsService.getAComment(id); } -} + + @Get(':id/thread') + @ApiOperation({ summary: 'Get a comment thread' }) + @ApiResponse({ status: 200, description: 'The comment thread has been retrieved successfully.' }) + @ApiResponse({ status: 404, description: 'Comment not found.' }) + async getCommentThread(@Param('id') id: string): Promise { + return await this.commentsService.getCommentThread(id); + } +} \ No newline at end of file From 3d03194f7fd0a3c99051714ef78a723045a2e3bb Mon Sep 17 00:00:00 2001 From: Christian Umoh Date: Sat, 1 Mar 2025 14:31:54 +0100 Subject: [PATCH 4/9] feat(comments): implement threading logic in CommentsService - Updated `addComment` to handle `parentId`, linking replies to parent comments via the `parent` relation.\n- Added `getCommentThread` method to fetch a comment with its nested replies and user details.\n- Both methods depend on the `parent_id` column in PostgreSQL; will fail without DB migration. --- src/modules/comments/comments.service.ts | 41 +++++++++++++++++++----- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/modules/comments/comments.service.ts b/src/modules/comments/comments.service.ts index 14469c782..cc701a68f 100644 --- a/src/modules/comments/comments.service.ts +++ b/src/modules/comments/comments.service.ts @@ -6,17 +6,18 @@ import { CreateCommentDto } from './dtos/create-comment.dto'; import { CommentResponseDto } from './dtos/comment-response.dto'; import { User } from '@modules/user/entities/user.entity'; import { CustomHttpException } from '@shared/helpers/custom-http-filter'; + @Injectable() export class CommentsService { constructor( @InjectRepository(Comment) private readonly commentRepository: Repository, @InjectRepository(User) - private readonly userRepository: Repository - ) {} + private readonly userRepository: Repository, + ) { } async addComment(createCommentDto: CreateCommentDto, userId: string): Promise { - const { model_id, model_type, comment } = createCommentDto; + const { model_id, model_type, comment, parentId } = createCommentDto; if (!comment || comment.trim().length === 0) { throw new CustomHttpException('Comment cannot be empty', HttpStatus.BAD_REQUEST); @@ -27,18 +28,28 @@ export class CommentsService { throw new CustomHttpException('User not found', HttpStatus.NOT_FOUND); } - const commentedBy: string = user.first_name + ' ' + user.last_name; + let parentComment: Comment | undefined; + if (parentId) { + parentComment = await this.commentRepository.findOne({ where: { id: parentId } }); + if (!parentComment) { + throw new CustomHttpException('Parent comment not found', HttpStatus.NOT_FOUND); + } + } - const Comment = this.commentRepository.create({ + const newComment = this.commentRepository.create({ model_id, model_type, comment, + parent: parentComment, // Requires `parent_id` column in PostgreSQL }); + newComment.user = user; + + const savedComment = await this.commentRepository.save(newComment); // Will fail without DB update + const commentedBy = `${user.first_name} ${user.last_name}`; - const loadComment = await this.commentRepository.save(Comment); return { message: 'Comment added successfully!', - savedComment: loadComment, + savedComment, commentedBy, }; } @@ -53,4 +64,18 @@ export class CommentsService { data: { comment }, }; } -} + + async getCommentThread(commentId: string): Promise<{ message: string; data: Comment }> { + const comment = await this.commentRepository.findOne({ + where: { id: commentId }, + relations: ['user', 'replies', 'replies.user'], // Requires `parent_id` column in PostgreSQL + }); + if (!comment) { + throw new CustomHttpException('Comment not found', HttpStatus.NOT_FOUND); + } + return { + message: 'Comment thread retrieved successfully', + data: comment, + }; + } +} \ No newline at end of file From 20b44af236f9c623c294db4f032a7e6b48d4022e Mon Sep 17 00:00:00 2001 From: Christian Umoh Date: Sat, 1 Mar 2025 14:55:16 +0100 Subject: [PATCH 5/9] fix(comments): add parent and replies to mockComment for threading compatibility --- src/modules/products/tests/mocks/comment.mock.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/products/tests/mocks/comment.mock.ts b/src/modules/products/tests/mocks/comment.mock.ts index 53006b1b6..17f3a1ed1 100644 --- a/src/modules/products/tests/mocks/comment.mock.ts +++ b/src/modules/products/tests/mocks/comment.mock.ts @@ -11,4 +11,6 @@ export const mockComment: Comment = { product: productMock, created_at: new Date(), updated_at: new Date(), -}; + parent: null, // Top-level comment has no parent + replies: [], // No replies by default +}; \ No newline at end of file From cbfd406e04fd146698068164100b1fa6a488c2bf Mon Sep 17 00:00:00 2001 From: Christian Umoh Date: Sun, 2 Mar 2025 14:54:17 +0100 Subject: [PATCH 6/9] fix(comments): resolve merge conflicts with dev branch Merged threading feature with delete and dislike features from dev branch. Added endpoint and method alongside and . Updated Comment entity with both threading (, ) and dislike (, ) fields. --- src/modules/comments/comments.controller.ts | 22 +++++++- src/modules/comments/comments.service.ts | 51 +++++++++++++++++++ .../comments/entities/comments.entity.ts | 10 +++- 3 files changed, 79 insertions(+), 4 deletions(-) diff --git a/src/modules/comments/comments.controller.ts b/src/modules/comments/comments.controller.ts index 494a3c5d7..0b18b8716 100644 --- a/src/modules/comments/comments.controller.ts +++ b/src/modules/comments/comments.controller.ts @@ -1,4 +1,6 @@ -import { Controller, Body, Post, Request, Get, Param } from '@nestjs/common'; +import { UserPayload } from './../user/interfaces/user-payload.interface'; +import { User } from './../user/entities/user.entity'; +import { Controller, Body, Post, Request, Get, Param, Delete } from '@nestjs/common'; import { CommentsService } from './comments.service'; import { CreateCommentDto } from './dtos/create-comment.dto'; import { CommentResponseDto } from './dtos/comment-response.dto'; @@ -16,7 +18,7 @@ export class CommentsController { @ApiResponse({ status: 400, description: 'Bad Request.' }) @ApiResponse({ status: 500, description: 'Internal Server Error.' }) async addComment(@Body() createCommentDto: CreateCommentDto, @Request() req): Promise { - const { userId } = req.user; + const userId = req.user.id; return await this.commentsService.addComment(createCommentDto, userId); } @@ -34,4 +36,20 @@ export class CommentsController { async getCommentThread(@Param('id') id: string): Promise { return await this.commentsService.getCommentThread(id); } + + @Post @ApiOperation({ summary: 'Dislike a comment' }) + @ApiResponse({ status: 200, description: 'Dislike updated successfully' }) + @ApiResponse({ status: 404, description: 'Comment not found' }) + @Post(':id/dislike') + async dislikeComment(@Param('id') id: string, @Request() req) { + const userId = req.user.id; + return await this.commentsService.dislikeComment(id, userId); + } + + @ApiOperation({ summary: 'Delete a comment' }) + @ApiResponse({ status: 200, description: 'The comment has been deleted successfully.' }) + @Delete(':id/delete') + async deleteAComment(@Param('id') id: string, @Request() req): Promise { + return await this.commentsService.deleteAComment(id, req.user.id); + } } \ No newline at end of file diff --git a/src/modules/comments/comments.service.ts b/src/modules/comments/comments.service.ts index cc701a68f..036681a75 100644 --- a/src/modules/comments/comments.service.ts +++ b/src/modules/comments/comments.service.ts @@ -21,6 +21,7 @@ export class CommentsService { if (!comment || comment.trim().length === 0) { throw new CustomHttpException('Comment cannot be empty', HttpStatus.BAD_REQUEST); + carriages carriages } const user = await this.userRepository.findOne({ where: { id: userId } }); @@ -78,4 +79,54 @@ export class CommentsService { data: comment, }; } + + async deleteAComment(commentId: string, userId: string) { + const comment = await this.commentRepository.findOne({ where: { id: commentId }, relations: ['user'] }); + if (!comment) { + throw new CustomHttpException('Comment not found', HttpStatus.NOT_FOUND); + } + + const isOwner = comment.user.id === userId; + + if (!isOwner) { + throw new CustomHttpException('You are not authorized to delete this comment', HttpStatus.FORBIDDEN); + } + + await this.commentRepository.delete(comment.id); + + return { + message: 'Comment deleted successfully!', + status: HttpStatus.OK, + data: { comment }, + }; + } + + async dislikeComment(commentId: string, userId: string): Promise<{ message: string; dislikeCount: number }> { + const comment = await this.commentRepository + .createQueryBuilder('comment') + .where('comment.id = :id', { id: commentId }) + .getOne(); + + if (!comment) { + throw new CustomHttpException('Comment not found', HttpStatus.NOT_FOUND); + } + + if (!comment.dislikedBy) { + comment.dislikedBy = []; + } + + if (comment.dislikedBy.includes(userId)) { + throw new CustomHttpException('You have already disliked this comment', HttpStatus.BAD_REQUEST); + } + + comment.dislikedBy.push(userId); + comment.dislikes = comment.dislikedBy.length; + + await this.commentRepository.save(comment); + + return { + message: 'Dislike updated successfully', + dislikeCount: comment.dislikes, + }; + } } \ No newline at end of file diff --git a/src/modules/comments/entities/comments.entity.ts b/src/modules/comments/entities/comments.entity.ts index f3d4d1fc5..1760bf79c 100644 --- a/src/modules/comments/entities/comments.entity.ts +++ b/src/modules/comments/entities/comments.entity.ts @@ -14,10 +14,10 @@ export class Comment extends AbstractBaseEntity { @ManyToOne(() => User, user => user.comments, { cascade: true }) user: User; - @Column({ nullable: false }) + @Column({ nullable: true }) model_id: string; - @Column() + @Column({ nullable: true }) model_type: string; // Threading fields for PostgreSQL @@ -26,4 +26,10 @@ export class Comment extends AbstractBaseEntity { @OneToMany(() => Comment, comment => comment.parent) replies: Comment[]; + + @Column({ type: 'int', default: 0 }) // Add dislikes column + dislikes: number; + + @Column('simple-array', { nullable: true }) // Store user IDs as an array + dislikedBy: string[]; } \ No newline at end of file From 79efa05f2502e362ad581be58d262ebc3c4759b5 Mon Sep 17 00:00:00 2001 From: Christian Umoh Date: Sun, 2 Mar 2025 15:07:53 +0100 Subject: [PATCH 7/9] Merge remote changes into canonone/feat/adding-thread-to-the-comment-module Integrated updates from the remote branch to resolve a non-fast-forward push error. This merge ensures the local branch includes the latest remote state while preserving the threading feature and resolved conflicts with the delete/dislike features from dev. --- src/modules/comments/comments.controller.ts | 9 +++++---- src/modules/comments/comments.service.ts | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/modules/comments/comments.controller.ts b/src/modules/comments/comments.controller.ts index 0b18b8716..c2403c6ed 100644 --- a/src/modules/comments/comments.controller.ts +++ b/src/modules/comments/comments.controller.ts @@ -10,7 +10,7 @@ import { ApiBearerAuth, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagg @ApiTags('Comments') @Controller('comments') export class CommentsController { - constructor(private readonly commentsService: CommentsService) { } + constructor(private readonly commentsService: CommentsService) {} @Post('add') @ApiOperation({ summary: 'Create a new comment' }) @@ -37,18 +37,19 @@ export class CommentsController { return await this.commentsService.getCommentThread(id); } - @Post @ApiOperation({ summary: 'Dislike a comment' }) + @Post(':id/dislike') + @ApiOperation({ summary: 'Dislike a comment' }) @ApiResponse({ status: 200, description: 'Dislike updated successfully' }) @ApiResponse({ status: 404, description: 'Comment not found' }) - @Post(':id/dislike') async dislikeComment(@Param('id') id: string, @Request() req) { const userId = req.user.id; + // console.log('User ID:', userId); // debug (optional, can remove if not needed) return await this.commentsService.dislikeComment(id, userId); } + @Delete(':id/delete') @ApiOperation({ summary: 'Delete a comment' }) @ApiResponse({ status: 200, description: 'The comment has been deleted successfully.' }) - @Delete(':id/delete') async deleteAComment(@Param('id') id: string, @Request() req): Promise { return await this.commentsService.deleteAComment(id, req.user.id); } diff --git a/src/modules/comments/comments.service.ts b/src/modules/comments/comments.service.ts index 036681a75..19e79a3e8 100644 --- a/src/modules/comments/comments.service.ts +++ b/src/modules/comments/comments.service.ts @@ -14,14 +14,13 @@ export class CommentsService { private readonly commentRepository: Repository, @InjectRepository(User) private readonly userRepository: Repository, - ) { } + ) {} async addComment(createCommentDto: CreateCommentDto, userId: string): Promise { const { model_id, model_type, comment, parentId } = createCommentDto; if (!comment || comment.trim().length === 0) { throw new CustomHttpException('Comment cannot be empty', HttpStatus.BAD_REQUEST); - carriages carriages } const user = await this.userRepository.findOne({ where: { id: userId } }); @@ -115,10 +114,12 @@ export class CommentsService { comment.dislikedBy = []; } + // Check if the user has already disliked the comment if (comment.dislikedBy.includes(userId)) { throw new CustomHttpException('You have already disliked this comment', HttpStatus.BAD_REQUEST); } + // Add the user to the dislikedBy array and increment dislikes comment.dislikedBy.push(userId); comment.dislikes = comment.dislikedBy.length; From 9a64df0e757155892d958ddd5e807abfa05235ae Mon Sep 17 00:00:00 2001 From: Christian Umoh Date: Sun, 2 Mar 2025 15:21:21 +0100 Subject: [PATCH 8/9] Merge remote changes into canonone/feat/adding-thread-to-the-comment-module Integrated updates from the remote branch to resolve a non-fast-forward push error. This merge ensures the local branch includes the latest remote state while preserving the threading feature and resolved conflicts with the delete/dislike features from dev. --- src/modules/comments/comments.controller.ts | 8 ++++---- src/modules/comments/comments.service.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/comments/comments.controller.ts b/src/modules/comments/comments.controller.ts index c2403c6ed..9150feefd 100644 --- a/src/modules/comments/comments.controller.ts +++ b/src/modules/comments/comments.controller.ts @@ -10,7 +10,7 @@ import { ApiBearerAuth, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagg @ApiTags('Comments') @Controller('comments') export class CommentsController { - constructor(private readonly commentsService: CommentsService) {} + constructor(private readonly commentsService: CommentsService) { } @Post('add') @ApiOperation({ summary: 'Create a new comment' }) @@ -37,19 +37,19 @@ export class CommentsController { return await this.commentsService.getCommentThread(id); } - @Post(':id/dislike') @ApiOperation({ summary: 'Dislike a comment' }) @ApiResponse({ status: 200, description: 'Dislike updated successfully' }) @ApiResponse({ status: 404, description: 'Comment not found' }) + @Post(':id/dislike') async dislikeComment(@Param('id') id: string, @Request() req) { const userId = req.user.id; - // console.log('User ID:', userId); // debug (optional, can remove if not needed) + // console.log('User ID:', userId); // debug (optional) return await this.commentsService.dislikeComment(id, userId); } - @Delete(':id/delete') @ApiOperation({ summary: 'Delete a comment' }) @ApiResponse({ status: 200, description: 'The comment has been deleted successfully.' }) + @Delete(':id/delete') async deleteAComment(@Param('id') id: string, @Request() req): Promise { return await this.commentsService.deleteAComment(id, req.user.id); } diff --git a/src/modules/comments/comments.service.ts b/src/modules/comments/comments.service.ts index 19e79a3e8..328e7b8d8 100644 --- a/src/modules/comments/comments.service.ts +++ b/src/modules/comments/comments.service.ts @@ -14,7 +14,7 @@ export class CommentsService { private readonly commentRepository: Repository, @InjectRepository(User) private readonly userRepository: Repository, - ) {} + ) { } async addComment(createCommentDto: CreateCommentDto, userId: string): Promise { const { model_id, model_type, comment, parentId } = createCommentDto; From d4155071108722a4a9f48356e3e34c1aae59c4be Mon Sep 17 00:00:00 2001 From: Christian Umoh Date: Sun, 2 Mar 2025 15:30:47 +0100 Subject: [PATCH 9/9] Merge remote changes into canonone/feat/adding-thread-to-the-comment-module Integrated updates from the remote branch to resolve a non-fast-forward push error. This merge ensures the local branch includes the latest remote state while preserving the threading feature and resolved conflicts with the delete/dislike features from dev. --- src/modules/comments/comments.controller.ts | 28 ++++--------------- src/modules/comments/comments.service.ts | 3 +- .../comments/entities/comments.entity.ts | 1 + 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/modules/comments/comments.controller.ts b/src/modules/comments/comments.controller.ts index e2e5abd23..d770642a1 100644 --- a/src/modules/comments/comments.controller.ts +++ b/src/modules/comments/comments.controller.ts @@ -1,5 +1,5 @@ -import { UserPayload } from './../user/interfaces/user-payload.interface'; -import { User } from './../user/entities/user.entity'; +import { UserPayload } from '../user/interfaces/user-payload.interface'; +import { User } from '../user/entities/user.entity'; import { Controller, Body, Post, Request, Get, Param, Delete } from '@nestjs/common'; import { CommentsService } from './comments.service'; import { CreateCommentDto } from './dtos/create-comment.dto'; @@ -28,7 +28,7 @@ export class CommentsController { async getAComment(@Param('id') id: string): Promise { return await this.commentsService.getAComment(id); } - + @Get(':id/thread') @ApiOperation({ summary: 'Get a comment thread' }) @ApiResponse({ status: 200, description: 'The comment thread has been retrieved successfully.' }) @@ -43,25 +43,7 @@ export class CommentsController { @Post(':id/dislike') async dislikeComment(@Param('id') id: string, @Request() req) { const userId = req.user.id; - // console.log('User ID:', userId); // debug (optional) - return await this.commentsService.dislikeComment(id, userId); - } - - @ApiOperation({ summary: 'Delete a comment' }) - @ApiResponse({ status: 200, description: 'The comment has been deleted successfully.' }) - @Delete(':id/delete') - async deleteAComment(@Param('id') id: string, @Request() req): Promise { - return await this.commentsService.deleteAComment(id, req.user.id); - } -} - - @ApiOperation({ summary: 'Dislike a comment' }) - @ApiResponse({ status: 200, description: 'Dislike updated successfully' }) - @ApiResponse({ status: 404, description: 'Comment not found' }) - @Post(':id/dislike') - async dislikeComment(@Param('id') id: string, @Request() req) { - const userId = req.user.id; - // console.log('User ID:', userId); debug + // console.log('User ID:', userId); // debug (optional, kept for consistency) return await this.commentsService.dislikeComment(id, userId); } @@ -71,4 +53,4 @@ export class CommentsController { async deleteAComment(@Param('id') id: string, @Request() req): Promise { return await this.commentsService.deleteAComment(id, req.user.id); } -} +} \ No newline at end of file diff --git a/src/modules/comments/comments.service.ts b/src/modules/comments/comments.service.ts index 0cf7ae1f0..f61c7a4b2 100644 --- a/src/modules/comments/comments.service.ts +++ b/src/modules/comments/comments.service.ts @@ -130,4 +130,5 @@ export class CommentsService { message: 'Dislike updated successfully', dislikeCount: comment.dislikes, }; - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/src/modules/comments/entities/comments.entity.ts b/src/modules/comments/entities/comments.entity.ts index 241db86f6..bf956987f 100644 --- a/src/modules/comments/entities/comments.entity.ts +++ b/src/modules/comments/entities/comments.entity.ts @@ -33,3 +33,4 @@ export class Comment extends AbstractBaseEntity { @Column('simple-array', { nullable: true }) // Store user IDs as an array dislikedBy: string[]; +} \ No newline at end of file