Skip to content

Comments

Feat: 모임 참여에 성공하면 DB 테이블에 사용자 정보가 입력되는 기능 구현#93

Merged
myeongheonhong merged 3 commits intodevelopfrom
feature/#144-add-user-to-collaborators
Jun 9, 2025
Merged

Feat: 모임 참여에 성공하면 DB 테이블에 사용자 정보가 입력되는 기능 구현#93
myeongheonhong merged 3 commits intodevelopfrom
feature/#144-add-user-to-collaborators

Conversation

@juyesu
Copy link
Collaborator

@juyesu juyesu commented Jun 9, 2025

PR요약

PR 타입(하나 이상의 PR 타입을 선택해주세요)

  • 기능 추가
  • 기능 삭제
  • 버그 수정
  • 스타일 관련
  • 의존성, 환경 변수, 빌드 관련 코드 업데이트

변경 사항

"모임 참여하기" 버튼을 클릭하면 달램API 모임 참가 요청과 함께, DB stroy_collaborators테이블에 사용자 정보가 등록되는
기능을 구현하였습니다.
useMatation 커스텀 훅을 사용하여, 호출 성공 시에 SOCIAL_PARTICIPANTS key를 가진 API 데이터를 refetch하도록 하였습니다.

특이 사항이라면 명헌님께서 만들어주신 createCollaborator 함수의 매개변수를 data, role 2개의 인자를 받는 기존 방식에서
하나의 객체를 받는 방식으로 변경하였습니다.
이유는 React Query의 설계상 제한으로 인해, useMutationmutationFn이 단일 인자만 받도록 강제하기 때문입니다.
즉 아래와 같이 인자를 전달하면 에러가 발생합니다.

insertNewCollaborator(
  {
    story_id: ...,
    user_id: ...,
    user_name: ...,
    joined_at: ...,
  },
  TEAM_USER_ROLE.MEMBER
);

매개변수의 변경으로 기존에 createCollaborator를 호출하던 명헌님의 코드(useCreateSocialForm.ts)도 하나의 객체로 묶어 값을 전달하도록 변경하였습니다.

@juyesu juyesu self-assigned this Jun 9, 2025
@netlify
Copy link

netlify bot commented Jun 9, 2025

Deploy Preview for we-write ready!

Name Link
🔨 Latest commit bc6d624
🔍 Latest deploy log https://app.netlify.com/projects/we-write/deploys/68468d4682a0c400080c3c17
😎 Deploy Preview https://deploy-preview-93--we-write.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

const useParticipateCollaborator = ({
socialId,
}: useParticipateCollaboratorParams) => {
const queryClient = useQueryClient();
Copy link
Contributor

Choose a reason for hiding this comment

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

queryClietn를 가져올때 getQueryClient로 가져와도 좋을거 같습니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

getQueryClient.ts 에서 선언한 함수 말씀하신걸까요?
맞다면 getQueryClient.ts는 서버 컴포넌트 환경에서 QueryClient를 생성하는 함수이고,
useQueryClient()QueryProviders에서 제공한 context로 부터 client를 가져오는 훅이라서
역할이 다른 것으로 알고 있습니다!
저도 정리하려니깐 헷갈리네요..! 혹시 제가 잘못 알고 있는 부분이 있다면 지적부탁드립니다

@myeongheonhong myeongheonhong merged commit 0bafd54 into develop Jun 9, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants