Skip to content

Commit

Permalink
Merge pull request #22 from rohit-56/BA-24
Browse files Browse the repository at this point in the history
Fix Bug in Comment Controller
  • Loading branch information
rohit-56 authored Jan 2, 2024
2 parents ff66c27 + 6a08bf2 commit 3e3aee7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
import com.example.BloggerApp.http.request.CommentRequest;
import com.example.BloggerApp.http.request.UpdateCommentRequest;
import com.example.BloggerApp.http.response.GetCommentResponse;
import com.example.BloggerApp.models.Comment;
import com.example.BloggerApp.service.impl.CommentServiceImpl;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

Expand All @@ -24,7 +23,7 @@ public class CommentController {
private CommentServiceImpl commentService;

@PostMapping("/create/blog/{blogId}")
public ResponseEntity<GetCommentResponse> addComment(@RequestBody CommentRequest commentRequest,@PathVariable("blogId") Long blogId){
public ResponseEntity<GetCommentResponse> addComment(@RequestBody CommentRequest commentRequest, @PathVariable("blogId") Long blogId){
GetCommentResponse comment = commentService.createComment(commentRequest,blogId);
return new ResponseEntity<>(comment, HttpStatus.CREATED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
import lombok.NoArgsConstructor;
import lombok.Setter;

@AllArgsConstructor
@NoArgsConstructor
@Setter

@Getter
public class CommentRequest {

@JsonProperty("content")
private String content;
public String content;
}

0 comments on commit 3e3aee7

Please sign in to comment.