[Feature/#157] - graphiql 적용 및 루트 질문 선택을 위한 관련 엔티티, resolver 추가#162
[Feature/#157] - graphiql 적용 및 루트 질문 선택을 위한 관련 엔티티, resolver 추가#162alsgud8311 merged 7 commits intodevelopmentfrom
Conversation
Summary of ChangesHello @alsgud8311, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 GraphQL 개발 환경을 개선하고 면접 질문 관리 시스템의 기반을 마련합니다. GraphiQL을 도입하여 GraphQL API의 사용 편의성을 높였으며, 질문 카테고리와 루트 질문을 위한 새로운 엔티티, 리졸버, 서비스 계층을 추가하여 질문 데이터를 체계적으로 관리할 수 있는 토대를 구축했습니다. 또한, 개발 환경을 위한 Docker Compose 설정 파일을 추가하여 서버 배포 및 관리를 간소화했습니다. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🛠️ Build SummaryStatus: ✅ SUCCESS 📋 Build Output (마지막 45줄)🤖 Generated by GitHub Actions at Fri Sep 19 08:08:51 UTC 2025 |
| console.log(Object.values(CategoryType)); | ||
| return Object.values(CategoryType) | ||
| .filter((type) => typeof type === "number") | ||
| .map((type: CategoryType) => { | ||
| const data = CATEGORY_DATA[type]; | ||
| return new Category( | ||
| type, | ||
| data.title, | ||
| data.description, | ||
| BASE_URL + data.imageUrl | ||
| ); | ||
| }); |
There was a problem hiding this comment.
이 메소드에 두 가지 문제가 있습니다.
- 디버깅용
console.log: 169번째 줄의console.log는 디버깅용 코드로 보이며, 프로덕션 코드에 포함되지 않도록 제거해야 합니다. - 치명적인 필터링 오류: 171번째 줄의
.filter((type) => typeof type === "number")로직에 오류가 있습니다.CategoryType은 문자열 enum이므로 이 필터는 항상 빈 배열을 반환하게 되어, 카테고리 목록이 전혀 표시되지 않는 버그를 유발합니다.
아래와 같이 수정하여 두 문제를 한 번에 해결하는 것을 제안합니다.
return Object.values(CategoryType).map((type: CategoryType) => {
const data = CATEGORY_DATA[type];
return new Category(
type,
data.title,
data.description,
BASE_URL + data.imageUrl
);
});| ConfigModule.forRoot({ | ||
| isGlobal: true, | ||
| envFilePath: [`.env.${process.env.NODE_ENV || "development"}`, ".env"], | ||
| envFilePath: [".env.development", ".env"], |
There was a problem hiding this comment.
환경 변수 파일 경로를 .env.development로 고정하셨네요. 이전 방식인 `.env.${process.env.NODE_ENV || "development"}`는 NODE_ENV 값에 따라 동적으로 설정 파일을 불러올 수 있어 더 유연합니다. 특별한 이유가 없다면 이전 방식으로 되돌려 다양한 환경(테스트, 프로덕션 등)에 쉽게 대응할 수 있도록 하는 것이 좋을 것 같습니다.
| envFilePath: [".env.development", ".env"], | |
| envFilePath: [`.env.${process.env.NODE_ENV || "development"}`, ".env"], |
|
|
||
| @Query(() => [RootQuestion]) | ||
| async rootQuestionByCategory( | ||
| @Args("category") category: CategoryType |
There was a problem hiding this comment.
| async findAll(): Promise<Category[]> { | ||
| return Category.getCategories(); | ||
| } | ||
|
|
||
| async findOne(type: CategoryType): Promise<Category | null> { | ||
| const categories = Category.getCategories(); | ||
| return categories.find((category) => category.type === type) || null; | ||
| } |
There was a problem hiding this comment.
findAll과 findOne 메소드가 호출될 때마다 Category.getCategories()를 호출하여 카테고리 목록을 새로 생성하고 있습니다. 카테고리 데이터는 정적이므로, 서비스가 생성될 때 한 번만 생성하여 캐싱해두면 불필요한 연산을 줄여 성능을 개선할 수 있습니다. 또한, getCategories는 동기적으로 동작하므로 async/await를 제거할 수 있습니다. 아래와 같이 수정하는 것을 고려해보세요.
private readonly categories: Category[];
constructor() {
this.categories = Category.getCategories();
}
findAll(): Category[] {
return this.categories;
}
findOne(type: CategoryType): Category | null {
return this.categories.find((category) => category.type === type) || null;
}
🛠️ Build SummaryStatus: ✅ SUCCESS 📋 Build Output (마지막 45줄)🤖 Generated by GitHub Actions at Fri Sep 19 08:12:10 UTC 2025 |
🚀 Lighthouse Report for TEST1📅 Date: 9/19/2025
📊 Performance Details
🚀 Lighthouse Report for TEST2📅 Date: 9/19/2025
📊 Performance Details
🚀 Lighthouse Report for TEST3📅 Date: 9/19/2025
📊 Performance Details
🚀 Lighthouse Report for TEST4📅 Date: 9/19/2025
📊 Performance Details
🚀 Lighthouse Report for TEST5📅 Date: 9/19/2025
📊 Performance Details
|
🛠️ Build SummaryStatus: ✅ SUCCESS 📋 Build Output (마지막 45줄)🤖 Generated by GitHub Actions at Fri Sep 19 08:16:59 UTC 2025 |
🚀 Lighthouse Report for TEST1📅 Date: 9/19/2025
📊 Performance Details
🚀 Lighthouse Report for TEST2📅 Date: 9/19/2025
📊 Performance Details
🚀 Lighthouse Report for TEST3📅 Date: 9/19/2025
📊 Performance Details
🚀 Lighthouse Report for TEST4📅 Date: 9/19/2025
📊 Performance Details
🚀 Lighthouse Report for TEST5📅 Date: 9/19/2025
📊 Performance Details
|
🚀 Lighthouse Report for TEST1📅 Date: 9/19/2025
📊 Performance Details
🚀 Lighthouse Report for TEST2📅 Date: 9/19/2025
📊 Performance Details
🚀 Lighthouse Report for TEST3📅 Date: 9/19/2025
📊 Performance Details
🚀 Lighthouse Report for TEST4📅 Date: 9/19/2025
📊 Performance Details
🚀 Lighthouse Report for TEST5📅 Date: 9/19/2025
📊 Performance Details
|
📌 개요
graphiql 적용 및 루트 질문을 선택하기 위한 테이블의 root_question, category 에 대한 엔티티와 리졸버, 비즈니스 계층을 위한 서비스 계층까지 추가하였습니다.
✅ 작업 내용
🧪 테스트
📝 참고 사항
graphiql의 경우, 별도의 의존성이 필요하지 않고 @nestjs/graphql 라이브러리에 포함되어 있어 playground가 아닌 graphiql 설정을 줌으로써 추가할 수 있었습니다.
기존 playground의 경우 유지보수가 이루어지지 않아 버그가 많아 graphiql로 변경하였습니다.
📎 관련 이슈
Closes #157