modulersYJ / ganoverflow-front

2 stars 2 forks source link

Todo,bug & 논의사항 : `Chat - sideBar`에서 파일 삭제 시, `delYn`필드를 수정해줄지 or 실제로 post를 삭제할 지 논의 #69

Closed ABizCho closed 1 year ago

ABizCho commented 1 year ago

@hongregii

현재 사이드바에서 포스트 삭제 시, 아래와 같이 사이드바 관련 데이터 (foldersWithChatpost)만 수정 및 의도된 사이드이펙트에 의해 해당 갱신된 데이터로 put 요청을 보냅니다.

즉, 실제 chatpost를 삭제하는 로직이 없습니다! 이를 구현하고자 하는데

  1. 홍래님이 기존 설계 시 필드로 마련해둔 delYn을 활용하여 해당 부울리언만 수정하도록 할까요? image

  2. 아니면 실제 chatpost를 삭제할까요?

만일 1번으로 가고자 한다면, 모든 백엔드 chatpost - get로직에서 delYn에 의해 필터링한번 해서 보내도록 해야할 것 같슴다.

현재 onClickDeleteChatpostBtn, IN SIDEBAR

  const onClickDeleteChatpostBtn = () => {

    setFoldersWithPosts([
      ...foldersWithPosts.map((folder) =>
        folder.folderId === curFolderId
          ? {
              ...folder,
              chatposts: folder.chatposts.filter(
                (chatpost) => curChatpost.chatPostId !== chatpost.chatPostId
              ),
            }
          : { ...folder }
      ),
    ]);
    curChatpost.chatPostId;
  };
hongregii commented 1 year ago

당연히 delYn 사용해야죠! WHERE 절 넣는것까지 제가 할게요~~ @ABizCho 새로운 TODO 이슈 열어서 self assign 하겠습니다!