Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

댓글 조회시 대댓글 개수도 포함되도록 변경 완료 #430

Merged
merged 6 commits into from
Jul 24, 2024

Conversation

SongJaeHoonn
Copy link
Contributor

@SongJaeHoonn SongJaeHoonn commented Jul 22, 2024

Summary

#429

PageResponseDto의 새로운 생성자를 추가해, 대댓글 개수도 포함할 수 있도록 변경했습니다.

Tasks

  • PageResponseDto 생성자 추가

ETC

Screenshot

  • 기존
{
  "success": true,
  "data": {
    "currentPage": 0,
    "hasPrevious": false,
    "hasNext": false,
    "totalPages": 1,
    "totalItems": 2,
    "take": 2,
    "items": [
      {
        "id": 3,
        "isDeleted": false,
        "writerId": "202014941",
        "writerName": "송재훈",
        "writerImageUrl": "https://www.clab.page/assets/dongmin-860f3a1e.jpeg",
        "writerRoleLevel": 1,
        "content": "테스트 댓글 2",
        "children": [],
        "likes": 0,
        "hasLikeByMe": null,
        "createdAt": "2024-07-22T21:44:47.733297",
        "isOwner": true
      },
      {
        "id": 1,
        "isDeleted": false,
        "writerId": "202014941",
        "writerName": "송재훈",
        "writerImageUrl": "https://www.clab.page/assets/dongmin-860f3a1e.jpeg",
        "writerRoleLevel": 1,
        "content": "테스트 댓글 1",
        "children": [
          {
            "id": 2,
            "isDeleted": false,
            "writerId": null,
            "writerName": "깔끔한검은색물병",
            "writerImageUrl": null,
            "writerRoleLevel": null,
            "content": "테스트 대댓글 1",
            "children": [],
            "likes": 0,
            "hasLikeByMe": null,
            "createdAt": "2024-07-22T21:18:35.27189",
            "isOwner": true
          }
        ],
        "likes": 0,
        "hasLikeByMe": null,
        "createdAt": "2024-07-22T21:16:07.847747",
        "isOwner": true
      }
    ]
  }
}
  • 변경 후
    스크린샷 2024-07-22 224235

@SongJaeHoonn SongJaeHoonn added the 🔨 Refactor 코드 수정 및 개선 label Jul 22, 2024
@SongJaeHoonn SongJaeHoonn requested a review from mingmingmon July 22, 2024 13:55
@SongJaeHoonn SongJaeHoonn self-assigned this Jul 22, 2024
@SongJaeHoonn SongJaeHoonn requested a review from limehee as a code owner July 22, 2024 13:55
@SongJaeHoonn SongJaeHoonn changed the base branch from main to develop July 22, 2024 13:57
@SongJaeHoonn SongJaeHoonn linked an issue Jul 22, 2024 that may be closed by this pull request
2 tasks
@limehee
Copy link
Collaborator

limehee commented Jul 22, 2024

자식 댓글은 부모 댓글 안에만 포함되어야 하지만, 자식 댓글이 부모 댓글에 중복되는 현상이 있는 것 같습니다. 확인 부탁드립니다.

@SongJaeHoonn
Copy link
Contributor Author

자식 댓글은 부모 댓글 안에만 포함되어야 하지만, 자식 댓글이 부모 댓글에 중복되는 현상이 있는 것 같습니다. 확인 부탁드립니다.

숨어 있었던 버그를 잡아주셔서 감사합니다!
확인해본 결과 자식 댓글이 부모 댓글에 중복되어 대댓글도 부모 댓글로 조회되는 현상이 있었습니다.
따라서 확인 후 수정 완료했습니다. 확인 부탁드립니다!

  • 수정 후 결과
{
  "success": true,
  "data": {
    "currentPage": 0,
    "hasPrevious": false,
    "hasNext": false,
    "totalPages": 1,
    "totalItems": 5,
    "take": 5,
    "items": [
      {
        "id": 11,
        "isDeleted": false,
        "writerId": null,
        "writerName": "기쁜하늘색시계",
        "writerImageUrl": null,
        "writerRoleLevel": null,
        "content": "댓글 2",
        "children": [
          {
            "id": 12,
            "isDeleted": false,
            "writerId": null,
            "writerName": "공부하는하얀색책상",
            "writerImageUrl": null,
            "writerRoleLevel": null,
            "content": "대댓글 2",
            "children": [],
            "likes": 0,
            "hasLikeByMe": null,
            "createdAt": "2024-07-23T10:38:48.450882",
            "isOwner": true
          },
          {
            "id": 13,
            "isDeleted": false,
            "writerId": null,
            "writerName": "유튜브찍는핑크색SQL",
            "writerImageUrl": null,
            "writerRoleLevel": null,
            "content": "대댓글 3",
            "children": [],
            "likes": 0,
            "hasLikeByMe": null,
            "createdAt": "2024-07-23T13:24:59.878248",
            "isOwner": true
          }
        ],
        "likes": 0,
        "hasLikeByMe": null,
        "createdAt": "2024-07-23T10:37:49.658824",
        "isOwner": true
      },
      {
        "id": 9,
        "isDeleted": false,
        "writerId": null,
        "writerName": "멋진초록색책상",
        "writerImageUrl": null,
        "writerRoleLevel": null,
        "content": "댓글 1",
        "children": [
          {
            "id": 10,
            "isDeleted": false,
            "writerId": null,
            "writerName": "행복한주황색사탕",
            "writerImageUrl": null,
            "writerRoleLevel": null,
            "content": "대댓글 1",
            "children": [],
            "likes": 0,
            "hasLikeByMe": null,
            "createdAt": "2024-07-23T10:36:41.641081",
            "isOwner": true
          }
        ],
        "likes": 0,
        "hasLikeByMe": null,
        "createdAt": "2024-07-23T10:35:59.585611",
        "isOwner": true
      }
    ]
  }
}

@limehee limehee merged commit 5f5cce6 into develop Jul 24, 2024
1 check passed
@limehee limehee deleted the refactor/#429 branch July 24, 2024 11:41
@limehee limehee mentioned this pull request Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 Refactor 코드 수정 및 개선
Projects
None yet
Development

Successfully merging this pull request may close these issues.

댓글 조회시 대댓글 개수도 포함되도록 변경
3 participants