Skip to content

Conversation

Seono-Na
Copy link
Contributor

@Seono-Na Seono-Na commented Mar 24, 2025

관련 이슈 번호

Resolves #36

핵심 변경 사항 및 이유

  • 게시글 수정 기능 구현: 사용자가 작성한 게시글을 수정할 수 있는 기능을 추가했습니다.
  • PostForm 컴포넌트 개선: 기존의 게시글 작성 폼을 수정 기능까지 지원하도록 확장했습니다. 이로써 코드 재사용성을 높이고 유지보수를 용이하게 했습니다.

이외 기타 변경 사항

  • 에러 메시지 추가: 게시글 관련 작업 시 발생할 수 있는 다양한 에러 상황에 대한 메시지를 추가했습니다.
  • 글로벌 not-found 페이지 구현
  • UI 개선: 결과물 확인을 위한 임시 페이지들의 UI를 개선했습니다.

PR 시 참고 사항

  • PostForm 컴포넌트의 폴더명이 post-create에서 post-editor로 변경되었습니다.
  • 게시글 수정 기능 테스트를 위해서는 특정 게시글 페이지에서 수정하기 버튼을 클릭해주세요

@Seono-Na Seono-Na added type: feature 새로운 기능 & 기능적 개선 status: in-progress 현재 처리 중 labels Mar 24, 2025
@Seono-Na Seono-Na requested a review from a team March 24, 2025 12:12
@Seono-Na Seono-Na self-assigned this Mar 24, 2025
…-sample-monorepo-simple-crud into feature/post-update
Copy link
Collaborator

@choi1five choi1five left a comment

Choose a reason for hiding this comment

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

코드를 보니 코드 흐름을 직관적으로 보기 위해 수정 후 머지하면 좋을 것 같아요! 🤔

리뷰 내용 반영해주시면 감사하겠습니다! 수정 완료되면 함께 확인해봐요😊

Comment on lines 54 to 64
const updatedData: UpdatePostDTO = {
title: formData.get('title')
? validateFormField(formData.get('title'), 'title')
: undefined,
content: formData.get('content')
? validateFormField(formData.get('content'), 'content')
: undefined,
author: formData.get('author')
? validateFormField(formData.get('author'), 'author')
: undefined,
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

현재 updateData 객체를 생성하면서 값 추출과 밸리데이션이 함께 이루어지고 있는데, 객체를 생성하면서 바로 밸리데이션 검증을 진행하기보다는,

밸리데이션을 별도의 단계로 나눠서 유효성 검사를 진행하고, 문제가 없다는 것이 확인된 후에 updateData 객체를 생성하거나 다음 로직을 실행하는 흐름으로 구성하면 가독성이 더 좋아질 것 같습니다. ✨

이렇게 하면 코드 흐름이 더 직관적으로 보이고, 각 단계가 명확하게 구분되어 유지보수에도 도움이 될 것 같아요. 🛠️

이런 방향은 어떠신가요? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@choi1five 님 좋은 리뷰 감사합니다!🙏
피드백 주신 대로 밸리데이션 검증을 별도로 분리하는 방향으로 개선했습니다.

기존에는 updateData 객체를 만들면서 동시에 validateFormField를 호출했는데,
이를 별도의 유효성 검사 함수getValidatedField로 분리하여 먼저 검증을 수행한 후,
reduce를 활용해 validatedData 객체를 생성하는 방식으로 변경했습니다.

getValidatedField의 경우 공용으로 사용할 수 있어 shared/util로 분리할 수 있었지만,
아직 post 관련 부분에서만 사용하고 있고 validateFormField과 함꼐 사용하고 있기 떄문에
entities/post/lib/form-validation.ts안에 넣어두었습니다.

이렇게 수정하면서 코드의 가독성이 향상되었고, 각 단계가 명확히 구분되었습니다.🔧

혹시 더 개선할 부분이 있다면 피드백 부탁드립니다. 감사합니다! 😊

@rmkim7 rmkim7 merged commit 4f9a65e into feature-group/post Mar 30, 2025
@rmkim7 rmkim7 deleted the feature/post-update branch March 30, 2025 12:41
@github-actions github-actions bot added status: done 완료 and removed status: in-progress 현재 처리 중 labels Mar 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: done 완료 type: feature 새로운 기능 & 기능적 개선
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants