Skip to content

리뷰 기능 구현#124

Merged
zzzRYT merged 8 commits intodevelopfrom
feature/#112/review
Aug 5, 2025
Merged

리뷰 기능 구현#124
zzzRYT merged 8 commits intodevelopfrom
feature/#112/review

Conversation

@zzzRYT
Copy link
Contributor

@zzzRYT zzzRYT commented Aug 3, 2025

🔗 관련 이슈

#112

📝작업 내용

스크린샷 2025-08-03 220256 스크린샷 2025-08-03 220331 스크린샷 2025-08-03 220336

기능 추가

  • firebase연결: 이 부분은 전체적인 필드 정의가 필요해 보임
    • 리뷰 불러오기
    • 리뷰 작성
  • 이미지 업로드: 아마 파베 스토리지 구입 후 사용할 예정 현재는 console로 처리해 둠

앞으로 추가

  • 리뷰 수정 및 삭제
  • 리뷰 스켈레톤UI
  • 최적화
  • 별점 별 형태로 만들기

🔍 변경 사항

  • 변경 사항 1
  • 변경 사항 2
  • 변경 사항 3

💬리뷰 요구사항 (선택사항)

  • 개인적으로 getAuth를 핸들링할 수 잇는 hook이나 상태가 있으면 좋을 것 같습니다. 모든 부분에서 getAuth를 가져다 쓰면, auth.currentUser에 대한 정보로 잇는지 없는지도 판별하고 하는데, 가독성이 좀 떨어지는 느낌입니다.
  • 저번 PR에서 open Modal에 대한 상태를 하나의 hook으로 관리하자 했었는데 그거 완성되면, 여기도 동일하게 적용하겠습니다.

@zzzRYT zzzRYT self-assigned this Aug 3, 2025
@zzzRYT zzzRYT requested review from NicoDora and rhehfl as code owners August 3, 2025 13:09
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 3, 2025

Deploying p-pick-front with  Cloudflare Pages  Cloudflare Pages

Latest commit: 21720ee
Status: ✅  Deploy successful!
Preview URL: https://187c4de1.front-7g6.pages.dev
Branch Preview URL: https://feature--112-review.front-7g6.pages.dev

View logs

Comment on lines +20 to +27
const newReviewData = {
userId: userData.uid,
user: {
uid: userData.uid,
displayName: userData.displayName,
email: userData.email,
photoURL: userData.photoURL,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

이거 uid만으로 충분하지 않을까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rhehfl firebase쪽에서 uesrId를 가지고 검증을해서 최상위 경로에 하나가 존재해야 합니다 만약 그게 필요없다면 UID하나로 처리하도록 바꾸겠습니다

Copy link
Contributor

Choose a reason for hiding this comment

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

firebase 규칙 보니까 userId로만 판별해서 user객체는 필요 없을 것 같아용

Comment on lines 50 to 57
mutation.mutate({
user: auth,
contentId,
rating: newReview.rating,
contents: newReview.contents,
images: newReview.images || [],
});
setIsOpen(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

mutate 성공후 콜백으로 모달 상태를 관리하는건 어떨까요?

@rhehfl
Copy link
Contributor

rhehfl commented Aug 4, 2025

@zzzRYT 코드 확인이 늦어 죄송합니다!
지금 폰이라 자세히는 못다는데 집가면 데탑으로 다시 확인해볼게요

Comment on lines +20 to +27
const newReviewData = {
userId: userData.uid,
user: {
uid: userData.uid,
displayName: userData.displayName,
email: userData.email,
photoURL: userData.photoURL,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

firebase 규칙 보니까 userId로만 판별해서 user객체는 필요 없을 것 같아용

Comment on lines +12 to +23
onValue(
reviewRef,
snapshot => {
const reviews: ReviewResponse[] = [];
snapshot.forEach(childSnapshot => {
const childKey = childSnapshot.key;
const childData = childSnapshot.val();
reviews.push({
id: childKey,
...childData,
});
});
Copy link
Contributor

Choose a reason for hiding this comment

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

firebase를 잘 아는게 아니라 그러는데 해당 부분은 서버에서 받아와서 프론트에서 filter하는 로직인가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rhehfl 공식문서에서 realtime database에 대해서 목록값을 가져올 때, 저런식으로 가져와야한다 이렇게 적혀있어서 진행한 부분입니다.

공식문서

Comment on lines +1 to +15
export interface ReviewResponse {
id: string;
contents: string;
userId: string;
user: {
uid: string;
displayName: string;
email: string;
photoURL: string;
};
rating: number;
createdAt: string;
updatedAt: string;
images?: string[];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

요거 리뷰 리스폰스도 user를 보내지 않으면 저부분은 없애도 될것같습니다

Copy link
Contributor

Choose a reason for hiding this comment

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

아 리뷰 보여줄때 user 닉네임 등을 써야해서 이렇게 해둔건가요?
객체가 통으로 들어가서 순간 이상했네요 ㅋㅋㅋㅋ 이러면 user 전체를 저장하는게 맞는 것 같습니다
혼동드려서 죄송합니당😓

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rhehfl 늦게 답장드리네여죄송합니다.

  • 우선 user객체 내부에 들어가 있는 userId정보를 firebase에서 감지하지 못합니다. 그래서 최상단으로 userId에 대한 정보를 하나 빼 둔것이구요,
  • reivew에서 사용할 user정보를 참조해서 사용하는형식을 사용하지 못하는것 같습니다(제가 찾은 바로는 그렇습니다😂)

images: [],
});

const auth = getAuth();
Copy link
Contributor

Choose a reason for hiding this comment

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

인증상태 체크 부분 Provider로 인증 정보를 요청하여 무한 캐싱 해놓고
따로 훅을 하나 만들어서 queryClient.getQuery(유저정보) 하는 훅을 만드는건 어떨까요
zustand 안써도 메모리에 캐싱해놓고 바로바로 가져올 수 있을 것 같아요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rhehfl 저도 분리가 필요하다 생각했습니다.

무한 캐싱 나쁘지 않은 것 같네여, 다만 걱정되는 부분은, firebase 요청을 보낼 때, 네티워크탭에 아무것도 뜨지 않더군요, 이게 내부적인 로직으로 처리하는건 아닐텐데 무한캐싱을하는게 도움이 될까요?

Copy link
Contributor

Choose a reason for hiding this comment

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

@zzzRYT 데이터베이스에 대한 요청은 네트워크탭에 별도로 뜨진 않는데
getAuth를 호출하면 네트워크탭에 뜨더라구요 어느정도 효과가 있는거 아닐까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

그럼 괜찮아 보이네요 이 부분은 이미 getAuth를 사용하는 부분이 많아서 이슈 새로 파서 진행하는게 좋아보이네요

Copy link
Contributor

Choose a reason for hiding this comment

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

image

@rhehfl rhehfl mentioned this pull request Aug 5, 2025
@zzzRYT
Copy link
Contributor Author

zzzRYT commented Aug 5, 2025

@rhehfl 다른부분은 이상 없으먄 머지할까여?

@rhehfl
Copy link
Contributor

rhehfl commented Aug 5, 2025

@zzzRYT 넵 머지해주셔도 될것같습니다

@zzzRYT zzzRYT merged commit f1a6ed6 into develop Aug 5, 2025
2 checks passed
@zzzRYT zzzRYT deleted the feature/#112/review branch August 5, 2025 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants