Skip to content

Conversation

@czmcm5
Copy link
Contributor

@czmcm5 czmcm5 commented Jun 24, 2025

개요

firebase의 projects 데이터를 조회, 저장 함수를 간단하게 추가하였습니다.

변경 사항

  • 새로운 기능 추가
  • 버그 수정
  • 리팩토링
  • 문서 수정

구현 내용

  • getProjectList: 메인홈에서 프로젝트 목록을 불러옵니다.
  • insertProjectItem: 등록 페이지에서 프로젝트를 등록합니다.

개발 후기 및 개선사항

이번 작업에서 배운 점

  • firebase 데이터 조작 방법

어려웠던 점 / 에로사항

  • insertProjectItem에서 성공 시 doc.id를 혹시 몰라 return을 주고 있지만 해당 데이터가 쓸모가 있을진 모르겠습니다.

다음에 개선하고 싶은 점

  • getProjectList에 페이징 구현이 아직 되어있지 않습니다.

팀원들과 공유하고 싶은 팁

  • (없다면 패스)

czmcm5 added 3 commits June 24, 2025 14:15
getProjectList: 메인홈에서 프로젝트 목록을 불러옵니다.
insertProjectItem: 등록 페이지에서 프로젝트를 등록합니다.
getProjectList: 메인홈에서 프로젝트 목록을 불러옵니다.
insertProjectItem: 등록 페이지에서 프로젝트를 등록합니다.
Copy link
Contributor

@tkyoun0421 tkyoun0421 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 8 to 23
export async function getProjectList(): Promise<ProjectListRes[]> {
try {
const listRef = collection(db, "projects");
const querySnapshot = await getDocs(listRef);

const posts = querySnapshot.docs.map((doc) => ({
id: doc.id,
...doc.data(),
}));

return posts as ProjectListRes[];
} catch (err) {
console.log(err);
return [];
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

요고 컨벤션에 맞게 export const getProjectList = async() => {};
방식으로 부탁드리겠습니다 🙇

Comment on lines 8 to 27
export async function insertProjectItem(
projectItem: ProjectItemInsertReq
): Promise<{ success: boolean; message: string; id?: string }> {
try {
const postsRef = collection(db, "projects");
const docRef = await addDoc(postsRef, projectItem);

return {
success: true,
message: "프로젝트가 성공적으로 등록되었습니다.",
id: docRef.id,
};
} catch (err) {
console.log(err);
return {
success: false,
message: "프로젝트 등록에 실패하였습니다.",
};
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

요기도 마찬가지로 부탁드리겠습니다 🙇

Comment on lines +9 to +14
if (res.success) {
alert(res.message);
} else {
alert(res.message);
}
};
Copy link
Contributor

@tkyoun0421 tkyoun0421 Jun 24, 2025

Choose a reason for hiding this comment

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

성공하거나 안하거나 같은 로직인걸로 보이는데 혹시 어떤 이유가 있으실까요??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

저는 이 훅에 대해 더이상 건들지 않고 민영님께 인계 할 생각이었으므로
이후에 성공 실패에 따라 다른 처리가 들어갈 수 도 있으니 그저 가시성을 위해 나눠놓았습니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

넵 답변 감사합니다 다빈님 👍👍👍

@namee-h
Copy link
Contributor

namee-h commented Jun 24, 2025

수고하셨어용 !!

@tkyoun0421 tkyoun0421 merged commit 80a17c1 into amicable-development-center:develop Jun 24, 2025
1 check passed
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.

3 participants