Skip to content

Commit

Permalink
fix (#3) : 댓글 작성시 파라미터 바인딩 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
daehwan2yo committed Apr 11, 2022
1 parent 10eeaa1 commit c1c3bd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
@RestController
@RequiredArgsConstructor
public class CommentController {

private final CommentService commentService;

@GetMapping("/calendar/{accountId}/result/comments")
Expand All @@ -39,10 +38,10 @@ public GetCommentsByUserIdResponse getCommentsByUserId(@PathVariable("accountId"

@PostMapping("/calendar/{accountId}/result/comments/{targetDate}")
public ResponseEntity<Void> createComments(@LoginAccount Account account,
@PathVariable("accountId") Long accountId,
@PathVariable("targetDate") @DateTimeFormat(pattern = "yyyy-MM-dd")
LocalDate date,
@RequestBody CreateCommentsRequest createCommentsRequest) {
@PathVariable("accountId") Long accountId,
@PathVariable("targetDate") @DateTimeFormat(pattern = "yyyy-MM-dd")
LocalDate date,
@RequestBody CreateCommentsRequest createCommentsRequest) {
if (account.isAnonymous()) {
throw new IllegalStateException("need authenticate before write comment");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
import com.codingwasabi.howtodo.web.dailyplan.entity.DailyPlan;

public interface DailyPlanRepository extends JpaRepository<DailyPlan, Long> {
@Query("select dp from DailyPlan dp where dp.account=:accountId and dp.date=:date")
@Query("select dp from DailyPlan dp where dp.account.id=:accountId and dp.date=:date")
Optional<DailyPlan> findByAccountIdAndDate(@Param("accountId") long accountId, @Param("date") LocalDate localDate);
}

0 comments on commit c1c3bd5

Please sign in to comment.