<aside> 💡 api/v1/signautre/:signatureId/comment?take=${take}&cursorId=${cursorId}
</aside>
→ 파라미터 한 개, 쿼리 두 개 필요합니다~!
[1] 초기값 cursorId = 0
/api/v1/signature/5/comment?take=5&cursorId=0
Response
{
"timestamp": "2024-02-12T18:21:21.636Z",
"code": "OK",
"success": true,
"message": "시그니처 댓글 가져오기 성공",
"data": {
"data": [
{
"_id": 2,
"content": "우와",
"parentId": 2, // (parentId == _id) 이므로 해당 댓글이 부모 댓글
"writer": {
"_id": 3,
"name": "고구마",
"is_writer": true, // 현재 로그인한 회원(id=4)은 작성자 본인
"image": null
},
"date": "2024.02.13",
"is_edited": false // 댓글 수정된적 없음
},
{
"_id": 3,
"content": "우와 답글1",
"parentId": 2, // (parentId != _id) 이므로 해당 댓글은 답글
"writer": {
"_id": 3,
"name": "고구마",
"is_writer": true,
"image": null
},
"date": "2024.02.13",
"is_edited": false
},
{
"_id": 5,
"content": "우와 답글2",
"parentId": 2,
"writer": {
"_id": 3,
"name": "고구마",
"is_writer": true,
"image": null
},
"date": "2024.02.13",
"is_edited": false
},
{
"_id": 7,
"content": "답글입니다",
"parentId": 2,
"writer": {
"_id": 4,
"name": "감자", // 로그인한 사용자(id=4)와 작성자가 일치하지 않음
"is_writer": false, // 그러므로 is_writer는 false
"image": null
},
"date": "2024.02.13",
"is_edited": false
}, // 여기까지가 부모 댓글 아이디가 2인 댓,답글들
{ // 이제 다음 부모 댓글,답글들이 출력됨
"_id": 4,
"content": "재밌네요!",
"parentId": 4,
"writer": {
"_id": 3,
"name": "고구마",
"is_writer": true,
"image": null
},
"date": "2024.02.13",
"is_edited": false
}
],
"meta": {
"take": "5",
"total": 6,
"hasNextData": true,
"cursor": 4
}
}
}