Skip to content

Conversation

@parkjaehak
Copy link
Collaborator

@parkjaehak parkjaehak commented Jan 29, 2025

📄 요약(Summary)

작업 히스토리 조회

✍🏼 상세(More)

  • 작업 상세 내역에 존재하는 작업 히스토리를 조회합니다.

PR Desciption

변경 사항 설명

  1. comment와 연관관계가 존재하는 attachment 조회
  2. querydsl을 사용해 댓글, 댓글첨부파일, 작업상태변경, 담당자변경에 대한 모든 taskhistory 조회
  3. 응답 매핑시 taskhistorystatus에 따라 그에 맞는 응답 객체에 매핑하여 전달

Requirements for Reviewer

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요
ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

PR Log

PR 작업하면서 고민했던 내용, 해결한 내용, 고민 중인 내용 등

새롭게 배운 것

고민 중인 사항

  1. 응답 객체가 아래와 같은 형태로 케이스마다 갈 것 같은데 details에 해당되는 부분만 응답으로 보내고 해당되지 않는 부분은 null이 아닌 아무것도 없는 형태로 보내는게 가능한지 모르겠네요. 구현상 어쩔수 없이 해당되지 않는 부분은 null이 반환됩니다.
  2. 아래 사진에서 modifiedField와 newValue는 사실상 필요가 없지 않나 생각이 듭니다. TaskHistoryType로 modifiedField를 대신할 수 있고 modifiedMember로 newValue를 대체할 수 있다고 생각이 들어서요. 이부분에 대한 의견을 듣고 싶습니다.
  3. MapStruct를 이용해 Entity를 domain으로 매핑하는 과정에서 필요로 하지 않는 부분까지 로드되는 문제가 있는 것 같습니다.
    모든 PersistenceMapper에서 domain을 매핑시 연관관계에 있는 객체를 호출하는데 이때 lazy로딩이 걸려 쿼리가 두번 나가는 것 같은데 필요한 부분만 매핑하고 실제 필요한 연관관계의 객체는 수동으로 매핑해주는 과정이 필요하지 않나라고 생각이 듭니다.

첨부 자료

{
    "histories": [
        {
            "historyId": 1,
            "date": "2025-01-12",
            "time": "14:18:00",
            "taskHistoryType": "PROCESSOR_ASSIGNED",
            "details": {
                "processorChanged": {
                    "previousProcessor": null,
                    "currentProcessor": "bac.park"
                },
                "taskStatusSwitched": null,
                "commentDetails": null,
                "commentFileDetails": null
            }
        },
        {
            "historyId": 2,
            "date": "2025-01-13",
            "time": "14:18:00",
            "taskHistoryType": "STATUS_SWITCHED",
            "details": {
                "processorChanged": null,
                "taskStatusSwitched": {
                    "taskStatus": "진행 중"
                },
                "commentDetails": null,
                "commentFileDetails": null
            }
        },
        {
            "historyId": 3,
            "date": "2025-01-13",
            "time": "14:19:00",
            "taskHistoryType": "COMMENT",
            "details": {
                "processorChanged": null,
                "taskStatusSwitched": null,
                "commentDetails": {
                    "name": "ldk.park",
                    "profileImageUrl": "https://image.png",
                    "isModified": false,
                    "comment": "일반 댓글"
                },
                "commentFileDetails": null
            }
        },
        {
            "historyId": 4,
            "date": "2025-01-13",
            "time": "14:20:00",
            "taskHistoryType": "COMMENT_FILE",
            "details": {
                "processorChanged": null,
                "taskStatusSwitched": null,
                "commentDetails": null,
                "commentFileDetails": {
                    "name": "atom.park",
                    "profileImageUrl": "https://image.png",
                    "isModified": false,
                    "fileName": "수정된 파일 이름",
                    "url": "https://수정경로8.png",
                    "size": "17MB"
                }
            }
        },
        {
            "historyId": 5,
            "date": "2025-01-14",
            "time": "09:00:00",
            "taskHistoryType": "PROCESSOR_CHANGED",
            "details": {
                "processorChanged": {
                    "previousProcessor": null,
                    "currentProcessor": "ldk.park"
                },
                "taskStatusSwitched": null,
                "commentDetails": null,
                "commentFileDetails": null
            }
        }
    ]
}

image

Requirements for Reviewer

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

✅ 체크리스트(Checklist)

  • PR 양식에 맞게 작성했습니다
  • 모든 테스트가 통과했습니다
  • 프로그램이 정상적으로 작동합니다
  • 적절한 PR 라벨을 설정했습니다
  • 불필요한 코드를 제거했습니다

🚪 이슈 번호(Issue numbers)

Closes #130

@parkjaehak parkjaehak added ✨ feature 구현·개선 사항에 관련된 내용입니다 HIGH 우선순위 상 labels Jan 29, 2025
@parkjaehak parkjaehak self-assigned this Jan 29, 2025
Copy link
Contributor

@joowojr joowojr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.modified_field는 history type으로 대체할 수 있다는 의견에는 동감합니다. 하지만 new value는 상태 전환의 경우도 있기 때문에 필요하다고 생각됩니다!

Copy link
Contributor

@joowojr joowojr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 응답 json 구조는 아래와 같이 더 유연하게 나타낼 수 있을 것 같습니다!
    comment일 경우에는 comment, commentfile 둘 중 하나가 null로 들어가게 되겠네요

아니면 프론트와 협의하에 comment와 commentfile을 합쳐서 파일첨부가 아닐 경우에는 filesize 필드를 null로 처리해도될것같아요.

{
   "historyId":1,
   "date":"2025-01-12",
   "time":"14:18:00",
   "taskHistoryType":"PROCESSOR_ASSIGNED", // UI 조건부 렌더링 및 json 파싱을 위한 값
   "details":{
      "task":{
         "modifiedValue":"processor", // 있어도 되고 없어도 될듯
         "newValue":"siena.it"
      },
      "comment":{
         "content":"댓글",
         "memberId":2,
         "profileImg": "프로필 이미지 주소"
      },
      "commentFile":{
         "content":"파일 주소",
         "fileSize": "16MB",
         "memberId":2,
         "profileImg": "프로필 이미지 주소"
      }
   }
}

Copy link
Contributor

@joowojr joowojr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 네 저도 이 부분을 어제 알게 되어서 lazy 로딩 관계의 경우에는 해당 매핑을 수동으로 처리해야할 것 같습니다..! 이 부분은 오늘 회의에서 한번 더 얘기하면 좋을것 같아요

@parkjaehak
Copy link
Collaborator Author

parkjaehak commented Jan 29, 2025

2.modified_field는 history type으로 대체할 수 있다는 의견에는 동감합니다. 하지만 new value는 상태 전환의 경우도 있기 때문에 필요하다고 생각됩니다!
image

이 부분은 제가 TaskModificationInfo의 task를 기존 taskid에서 task로 변경하여 domain 매핑시에 taskStatus를 가져올 수 있도록 설정하였고 task의 상태가 바뀔 경우 new value 대신 taskStatus의 description을 가져와 바뀐 상태를 표시해주면 되지 않을까 생각했습니다.
또한 TaskModificationInfo에 modifiedMemberId도 참조하고 있기 때문에 이를 통해 processor의 닉네임을 가져올 수 있기 때문에 dto 매핑시에 직접 가져오도록 하면 상태나 담당자가 변경될때 newValue에 값을 쓰지 않아도 된다고 판단했는데 이 부분 의견을 듣고 싶습니다.

@parkjaehak
Copy link
Collaborator Author

  1. 응답 json 구조는 아래와 같이 더 유연하게 나타낼 수 있을 것 같습니다!
    comment일 경우에는 comment, commentfile 둘 중 하나가 null로 들어가게 되겠네요

아니면 프론트와 협의하에 comment와 commentfile을 합쳐서 파일첨부가 아닐 경우에는 filesize 필드를 null로 처리해도될것같아요.

{
   "historyId":1,
   "date":"2025-01-12",
   "time":"14:18:00",
   "taskHistoryType":"PROCESSOR_ASSIGNED", // UI 조건부 렌더링 및 json 파싱을 위한 값
   "details":{
      "task":{
         "modifiedValue":"processor", // 있어도 되고 없어도 될듯
         "newValue":"siena.it"
      },
      "comment":{
         "content":"댓글",
         "memberId":2,
         "profileImg": "프로필 이미지 주소"
      },
      "commentFile":{
         "content":"파일 주소",
         "fileSize": "16MB",
         "memberId":2,
         "profileImg": "프로필 이미지 주소"
      }
   }
}

task 에 대한 부분을 하나로 합치도록 해보겠습니다.

@parkjaehak parkjaehak force-pushed the CLAP-153 branch 2 times, most recently from 0c3e1b7 to 98f794e Compare January 29, 2025 06:05
@parkjaehak
Copy link
Collaborator Author

현재 응답 구조는 아래와 같은 형태로 수정하였습니다.

{
    "histories": [
        {
            "historyId": 1,
            "date": "2025-01-12",
            "time": "14:18:00",
            "taskHistoryType": "PROCESSOR_ASSIGNED",
            "details": {
                "taskDetails": {
                    "newValue": "bac.park"
                },
                "commentDetails": null,
                "commentFileDetails": null
            }
        },
        {
            "historyId": 2,
            "date": "2025-01-13",
            "time": "14:18:00",
            "taskHistoryType": "STATUS_SWITCHED",
            "details": {
                "taskDetails": {
                    "newValue": "진행 중"
                },
                "commentDetails": null,
                "commentFileDetails": null
            }
        },
        {
            "historyId": 3,
            "date": "2025-01-13",
            "time": "14:19:00",
            "taskHistoryType": "COMMENT",
            "details": {
                "taskDetails": null,
                "commentDetails": {
                    "name": "ldk.park",
                    "profileImageUrl": "https://image.png",
                    "isModified": false,
                    "comment": "일반 댓글"
                },
                "commentFileDetails": null
            }
        },
        {
            "historyId": 4,
            "date": "2025-01-13",
            "time": "14:20:00",
            "taskHistoryType": "COMMENT_FILE",
            "details": {
                "taskDetails": null,
                "commentDetails": null,
                "commentFileDetails": {
                    "name": "atom.park",
                    "profileImageUrl": "https://image.png",
                    "isModified": false,
                    "fileName": "수정된 파일 이름",
                    "url": "https://수정경로8.png",
                    "size": "17MB"
                }
            }
        },
        {
            "historyId": 5,
            "date": "2025-01-14",
            "time": "09:00:00",
            "taskHistoryType": "PROCESSOR_CHANGED",
            "details": {
                "taskDetails": {
                    "newValue": "ldk.park"
                },
                "commentDetails": null,
                "commentFileDetails": null
            }
        }
    ]
}

@joowojr
Copy link
Contributor

joowojr commented Jan 29, 2025

현재 응답 구조는 아래와 같은 형태로 수정하였습니다.

{
    "histories": [
        {
            "historyId": 1,
            "date": "2025-01-12",
            "time": "14:18:00",
            "taskHistoryType": "PROCESSOR_ASSIGNED",
            "details": {
                "taskDetails": {
                    "newValue": "bac.park"
                },
                "commentDetails": null,
                "commentFileDetails": null
            }
        },
        {
            "historyId": 2,
            "date": "2025-01-13",
            "time": "14:18:00",
            "taskHistoryType": "STATUS_SWITCHED",
            "details": {
                "taskDetails": {
                    "newValue": "진행 중"
                },
                "commentDetails": null,
                "commentFileDetails": null
            }
        },
        {
            "historyId": 3,
            "date": "2025-01-13",
            "time": "14:19:00",
            "taskHistoryType": "COMMENT",
            "details": {
                "taskDetails": null,
                "commentDetails": {
                    "name": "ldk.park",
                    "profileImageUrl": "https://image.png",
                    "isModified": false,
                    "comment": "일반 댓글"
                },
                "commentFileDetails": null
            }
        },
        {
            "historyId": 4,
            "date": "2025-01-13",
            "time": "14:20:00",
            "taskHistoryType": "COMMENT_FILE",
            "details": {
                "taskDetails": null,
                "commentDetails": null,
                "commentFileDetails": {
                    "name": "atom.park",
                    "profileImageUrl": "https://image.png",
                    "isModified": false,
                    "fileName": "수정된 파일 이름",
                    "url": "https://수정경로8.png",
                    "size": "17MB"
                }
            }
        },
        {
            "historyId": 5,
            "date": "2025-01-14",
            "time": "09:00:00",
            "taskHistoryType": "PROCESSOR_CHANGED",
            "details": {
                "taskDetails": {
                    "newValue": "ldk.park"
                },
                "commentDetails": null,
                "commentFileDetails": null
            }
        }
    ]
}

수고하셨습니다! 회원 정보에 name만 nickname으로 수정하면 좋을것같아요:)

@parkjaehak parkjaehak merged commit 250507d into develop Jan 29, 2025
1 check passed
@parkjaehak parkjaehak deleted the CLAP-153 branch February 3, 2025 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feature 구현·개선 사항에 관련된 내용입니다 HIGH 우선순위 상

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLAP-153 작업 히스토리 내역 조회

3 participants