Skip to content

Commit

Permalink
Merge remote changes into canonone/feat/adding-thread-to-the-comment-…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
canonone committed Mar 2, 2025
1 parent 92d8e3b commit d415507
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 24 deletions.
28 changes: 5 additions & 23 deletions src/modules/comments/comments.controller.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -28,7 +28,7 @@ export class CommentsController {
async getAComment(@Param('id') id: string): Promise<any> {
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.' })
Expand All @@ -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<any> {
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);
}

Expand All @@ -71,4 +53,4 @@ export class CommentsController {
async deleteAComment(@Param('id') id: string, @Request() req): Promise<any> {
return await this.commentsService.deleteAComment(id, req.user.id);
}
}
}
3 changes: 2 additions & 1 deletion src/modules/comments/comments.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,5 @@ export class CommentsService {
message: 'Dislike updated successfully',
dislikeCount: comment.dislikes,
};
}
}
}
1 change: 1 addition & 0 deletions src/modules/comments/entities/comments.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ export class Comment extends AbstractBaseEntity {

@Column('simple-array', { nullable: true }) // Store user IDs as an array
dislikedBy: string[];
}

0 comments on commit d415507

Please sign in to comment.