Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class FormApiController {
// 커서 기반 폼 목록 조회
@GetMapping("/list")
public ResponseEntity<ApiResponse<FormListResponseDTO>> getFormList(
@PathVariable long postId,
@PathVariable("postId") long postId,
@RequestParam(required = false) Long cursor,
@RequestParam(defaultValue = "10") int size,
@AuthenticationPrincipal CustomUserDetails userDetails) {
Expand All @@ -48,8 +48,8 @@ public ResponseEntity<ApiResponse<FormListResponseDTO>> getFormList(
// 해당 게시글에 제출된 신청폼 개별 조회
@GetMapping("/{formId}")
public ResponseEntity<ApiResponse<FormResponseDTO>> getFormById(
@PathVariable long postId,
@PathVariable long formId,
@PathVariable("postId") long postId,
@PathVariable("formId") long formId,
@AuthenticationPrincipal CustomUserDetails userDetails){


Expand All @@ -71,7 +71,7 @@ public ResponseEntity<ApiResponse<FormResponseDTO>> getFormById(
@PostMapping
public ResponseEntity<ApiResponse<Object>> create(
@AuthenticationPrincipal CustomUserDetails userDetails,
@PathVariable long postId,
@PathVariable("postId") long postId,
@RequestBody FormRequestDTO requestDto){

if (userDetails == null) {
Expand All @@ -95,9 +95,9 @@ public ResponseEntity<ApiResponse<Object>> create(
@PatchMapping("/{formId}/status/{status}")
public ResponseEntity<ApiResponse<Participant>> updateParticipant(
@AuthenticationPrincipal CustomUserDetails userDetails,
@PathVariable long postId,
@PathVariable long formId,
@PathVariable String status){ // ACCEPT, REFUSE
@PathVariable("postId") long postId,
@PathVariable("formId") long formId,
@PathVariable("status") String status){ // ACCEPT, REFUSE

if (userDetails == null) {
throw new IllegalArgumentException("로그인이 필요합니다.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class LikeApiController {
// 좋아요 생성 요청
@PostMapping
public ResponseEntity<ApiResponse<Object>> create(@AuthenticationPrincipal CustomUserDetails userDetails,
@PathVariable long postId){
@PathVariable("postId") long postId){

likeApiService.create(userDetails.getUsername(), postId);

Expand All @@ -36,7 +36,7 @@ public ResponseEntity<ApiResponse<Object>> create(@AuthenticationPrincipal Custo
// 해당 게시글 좋아요 삭제 요청
@DeleteMapping
public ResponseEntity<ApiResponse<Object>> delete(@AuthenticationPrincipal CustomUserDetails userDetails,
@PathVariable long postId){
@PathVariable("postId") long postId){

likeApiService.delete(userDetails.getUsername(), postId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public class PostApiController {
// 게시글 전체 조회
@GetMapping("/list")
public ResponseEntity<ApiResponse<PostListResponseDTO>> getPostList(
@RequestParam(required = false) Long cursor,
@RequestParam(required = false) Category category,
@RequestParam(defaultValue = "createdAt") String sort,
@RequestParam(defaultValue = "10") int size) {
@RequestParam(name="cursor", required = false) Long cursor,
@RequestParam(name="category", required = false) Category category,
@RequestParam(name="sort", defaultValue = "createdAt") String sort,
@RequestParam(name="size", defaultValue = "10") int size) {

List<PostListResponseDTO> posts = postApiService.getPostsByCursor(cursor, category, sort, size);

Expand Down Expand Up @@ -66,7 +66,7 @@ public ResponseEntity<ApiResponse<PostListResponseDTO>> searchPostsByKeywords(
@GetMapping("/{postId}")
public ResponseEntity<ApiResponse<PostResponseDTO>> getPostById(
@AuthenticationPrincipal CustomUserDetails userDetails,
@PathVariable long postId) {
@PathVariable("postId") long postId) {

// 로그인한 사용자면 username 전달, 아니면 null 전달
String username = userDetails != null ? userDetails.getUsername() : null;
Expand Down Expand Up @@ -113,7 +113,7 @@ public ResponseEntity<ApiResponse<Object>> create(
@PatchMapping("/{postId}")
public ResponseEntity<ApiResponse<Object>> update(
@AuthenticationPrincipal CustomUserDetails userDetails,
@PathVariable long postId,
@PathVariable("postId") long postId,
@RequestBody PostRequestDTO requestDto) {

String username = userDetails != null ? userDetails.getUsername() : null;
Expand All @@ -134,7 +134,7 @@ public ResponseEntity<ApiResponse<Object>> update(
@DeleteMapping("/{postId}")
public ResponseEntity<ApiResponse<Object>> delete(
@AuthenticationPrincipal CustomUserDetails userDetails,
@PathVariable long postId) {
@PathVariable("postId") long postId) {

String username = userDetails != null ? userDetails.getUsername() : null;
postApiService.delete(username, postId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ public class PostListResponseDTO {
private String title;
private Integer likesCount;
private LocalDateTime createdAt;
private Long userId; // 작성자 ID
}
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ private PostListResponseDTO convertToListDTO(Post post) {
post.getPostId(),
post.getTitle(),
post.getLikesCount(),
post.getCreatedAt()
post.getCreatedAt(),
post.getUser().getId()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ResponseEntity<ApiResponse<ReviewResponseDTO>> createReview(

@GetMapping("/{userId}")
public ResponseEntity<ApiResponse<ReviewResponseDTO>> getReviewsByUserId(
@PathVariable Long userId) {
@PathVariable("userId") Long userId) {

List<ReviewResponseDTO> reviewList = reviewService.getReviewsByUserId(userId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ProfileController {
private final ProfileService profileService;

@GetMapping("/{userId}")
public ResponseEntity<ApiResponse<UserProfileDTO>> getProfile(@PathVariable Long userId) {
public ResponseEntity<ApiResponse<UserProfileDTO>> getProfile(@PathVariable("userId") Long userId) {
UserProfileDTO profileDTO = profileService.getProfileById(userId);

ApiResponse<UserProfileDTO> response = ApiResponse.success(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ public static class PostDTO {
private Long id; // 게시글 ID
private String title; // 게시글 제목
private LocalDateTime createdAt; // 생성일
private Long userId; // 작성자 ID
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public MyPageDTO getFullMyPage(String username) {
.id(post.getPostId())
.title(post.getTitle())
.createdAt(post.getCreatedAt())
.userId(post.getUser().getId())
.build();
}
return null;
Expand All @@ -147,6 +148,7 @@ public MyPageDTO getFullMyPage(String username) {
.id(post.getPostId())
.title(post.getTitle())
.createdAt(post.getCreatedAt())
.userId(post.getUser().getId())
.build())
.collect(Collectors.toList());

Expand Down
Loading