Skip to content

Conversation

@NCookies
Copy link
Collaborator

@NCookies NCookies commented Jul 8, 2025

image

Summary by CodeRabbit

  • 신규 기능

    • 토론글 작성 및 수정 시 프로그래밍 언어를 선택할 수 있는 드롭다운이 추가되었습니다.
    • 각 토론글에 선택된 언어가 태그 형태로 표시됩니다.
  • 스타일

    • 토론글 항목에 언어 태그 스타일이 적용되었으며, 배경색, 테두리, 그림자 등 레이아웃이 개선되었습니다.
  • 버그 수정

    • 사용되지 않는 변수가 제거되어 코드가 정리되었습니다.

@NCookies NCookies self-assigned this Jul 8, 2025
@NCookies NCookies added the enhancement New feature or request label Jul 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 8, 2025

Walkthrough

이 변경사항은 토론(Discussion) 엔티티와 관련된 데이터 구조에 프로그래밍 언어 식별자(languageId)를 추가하고, 이를 프론트엔드와 백엔드 전체에 반영합니다. 토론 생성, 조회, 수정 시 언어 선택 및 표시가 가능하도록 API, DTO, 엔티티, 쿼리, 템플릿이 수정되었습니다.

Changes

파일/경로 요약 변경 내용 요약
.../application/community/dto/response/DiscussionResponse.java languageId 필드 추가, 정적 팩토리 메서드(fromEntity, from)에 languageId 반영
.../domain/community/dto/DiscussionQueryResult.java languageId 필드 및 생성자 파라미터 추가
.../domain/community/model/entity/Discussion.java getLanguageId() 게터 메서드 추가
.../infrastructure/persistence/repository/community/discussion/DiscussionQueryRepositoryImpl.java 불필요한 변수 제거, 쿼리에서 discussion.language.id 조회 및 groupBy에 추가
.../resources/templates/test-submit.html 언어 선택 드롭다운 및 태그 표시 추가, 언어 정보 API 연동, 토론 생성/수정/표시에 언어 정보 반영, CSS 및 레이아웃 일부 조정

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend
    participant Backend
    participant DB

    User->>Frontend: 토론 생성/수정 폼에서 언어 선택
    Frontend->>Backend: POST/PUT /api/discussions (languageId 포함)
    Backend->>DB: 토론 및 언어 정보 저장/갱신
    DB-->>Backend: 저장된 토론 정보 반환
    Backend-->>Frontend: 토론 응답 (languageId 포함)
    Frontend-->>User: 토론 목록에 언어 태그 표시
Loading

Suggested reviewers

  • minjee2758
  • pokerbearkr

Poem

🐰
코드는 언어를 입고 춤을 추네,
토론마다 태그가 빛나네!
드롭다운에서 언어를 골라,
새 토론에 색을 더하자.
오늘도 깡총, 변화의 발걸음—
코드와 언어, 함께 달려가네!

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/resources/templates/test-submit.html (1)

1510-1511: 댓글/대댓글 언어 ID 처리 개선 제안

댓글과 대댓글에 하드코딩된 languageId: 1을 사용하고 있습니다. 일관성을 위해 상위 토론글의 언어 ID를 상속받거나, 최소한 상수로 정의하는 것을 고려해보세요.

예시:

// 상수 정의
const DEFAULT_LANGUAGE_ID = 1;

// 또는 상위 토론글의 언어 ID 상속
const discussionItem = item.closest('.discussion-item');
const discussionLangId = getDiscussionLanguageId(discussionItem);
payload.languageId = discussionLangId || DEFAULT_LANGUAGE_ID;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 46cf80e and e9ce4cc.

📒 Files selected for processing (5)
  • src/main/java/org/ezcode/codetest/application/community/dto/response/DiscussionResponse.java (3 hunks)
  • src/main/java/org/ezcode/codetest/domain/community/dto/DiscussionQueryResult.java (3 hunks)
  • src/main/java/org/ezcode/codetest/domain/community/model/entity/Discussion.java (1 hunks)
  • src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/community/discussion/DiscussionQueryRepositoryImpl.java (1 hunks)
  • src/main/resources/templates/test-submit.html (11 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: thezz9
PR: ezcode-my/backend#114
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java:159-165
Timestamp: 2025-06-28T02:03:38.693Z
Learning: User thezz9's service (ezcode) targets Korean users exclusively ("찐 한국인밖에 안 옴"), so Korean language hardcoding in commit messages and UI elements is intentional and appropriate for their use case.
Learnt from: thezz9
PR: ezcode-my/backend#16
File: src/main/java/org/ezcode/codetest/infrastructure/persitence/repository/problem/LanguageRepositoryImpl.java:44-46
Timestamp: 2025-06-02T04:37:42.389Z
Learning: @Transactional이 적용된 Service 메서드 내에서 엔티티를 조회하고 수정하는 경우, JPA 더티 체킹이 정상적으로 작동하여 명시적인 save() 호출 없이도 데이터베이스 변경사항이 자동으로 반영됩니다.
src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/community/discussion/DiscussionQueryRepositoryImpl.java (1)
Learnt from: Kimminu7
PR: ezcode-my/backend#63
File: src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/ProblemQueryRepositoryImpl.java:24-40
Timestamp: 2025-06-14T14:33:58.372Z
Learning: ProblemController에서 ProblemSearchCondition 객체는 항상 new ProblemSearchCondition(category, difficulty)로 유효한 인스턴스를 생성해서 전달하므로, ProblemQueryRepositoryImpl의 searchByCondition 메서드에서 searchCondition 파라미터 자체에 대한 null 체크는 불필요하다. category와 difficulty 필드만 각각 null일 수 있다.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (8)
src/main/java/org/ezcode/codetest/domain/community/model/entity/Discussion.java (1)

84-86: 편의 메서드 추가가 적절합니다.

getLanguageId() 메서드가 올바르게 구현되었습니다. 기존의 getUserEmail(), getProblemId() 메서드와 일관된 패턴을 따르고 있으며, JPA 매핑에서 language 필드가 nullable=false로 설정되어 있어 null 안전성도 확보되어 있습니다.

src/main/java/org/ezcode/codetest/domain/community/dto/DiscussionQueryResult.java (1)

21-21: DTO 필드 추가가 올바르게 구현되었습니다.

languageId 필드가 적절히 추가되었습니다:

  • 필드 타입 Long이 엔티티 ID에 적합함
  • 생성자 매개변수 순서가 올바름 (problemId 다음)
  • 필드 할당이 정확함
  • 기존 필드들과 일관된 final 키워드 사용

Also applies to: 42-42, 54-54

src/main/java/org/ezcode/codetest/application/community/dto/response/DiscussionResponse.java (1)

26-27: 응답 DTO 업데이트가 완벽하게 구현되었습니다.

languageId 필드 추가가 올바르게 처리되었습니다:

  • Swagger 스키마 어노테이션이 적절히 추가됨
  • fromEntity 메서드에서 편의 메서드 getProblemId(), getLanguageId() 사용이 좋은 리팩토링임
  • from 메서드에서도 일관되게 필드가 추가됨
  • 두 팩토리 메서드 모두 새 필드를 올바르게 채움

Also applies to: 56-57, 73-73

src/main/resources/templates/test-submit.html (5)

892-924: 언어 로딩 및 선택 기능이 잘 구현되었습니다.

언어 목록을 비동기로 로드하고 전역 저장하는 구조가 적절합니다. 에러 처리도 포함되어 있어 견고합니다.


785-797: 언어 태그 스타일링이 깔끔합니다.

언어 태그의 CSS 스타일이 전체 디자인과 잘 어울리며, 적절한 여백과 색상을 사용하고 있습니다.


931-939: 언어 로딩 후 렌더링 순서가 올바릅니다.

await loadLanguages() 후에 renderDiscussionCreateBox()를 호출하는 순서가 적절하여 언어 목록이 로드된 후에 토론글 작성 박스가 렌더링됩니다.


1235-1235: 언어 태그 표시가 올바르게 구현되었습니다.

각 토론글에 언어 태그가 적절히 표시되도록 구현되었습니다.


1733-1736: 언어 목록 로딩 대기 처리가 적절합니다.

언어 목록이 로드되지 않은 경우 적절한 메시지를 표시하여 사용자 경험을 개선했습니다.

user.profileImageUrl
),
discussion.problem.id,
discussion.language.id,
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

언어 ID 필드 추가가 올바르게 구현되었습니다.

discussion.language.id가 쿼리 프로젝션에 적절히 추가되었습니다. QDiscussionQueryResult 생성자의 매개변수 순서도 올바릅니다.

AI 요약에 따르면 groupBy 절에도 discussion.language.id가 추가되어야 한다고 언급되어 있는데, 현재 diff에서는 확인되지 않습니다. 다음 스크립트로 groupBy 절이 올바르게 업데이트되었는지 확인해주세요:


🏁 Script executed:

#!/bin/bash
# groupBy 절에 discussion.language.id가 포함되어 있는지 확인
ast-grep --pattern $'groupBy(
  $$$,
  discussion.language.id,
  $$$
)'

Length of output: 72


다음 스크립트로 DiscussionQueryRepositoryImpl.java 파일 내 groupBy 절에 discussion.language.id가 포함되었는지 확인해 보겠습니다.


🏁 Script executed:

#!/bin/bash
# DiscussionQueryRepositoryImpl.java에서 groupBy 절 검색
rg "groupBy" -A5 -B2 src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/community/discussion/DiscussionQueryRepositoryImpl.java

Length of output: 685


언어 ID 필드 프로젝션은 올바르게 추가되었으나 groupBy 절에도 반영이 필요합니다.

  • 위치: src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/community/discussion/DiscussionQueryRepositoryImpl.java
    두 번째 쿼리의 groupBy 블록

변경 전:

.groupBy(
    discussion.id,
    user.id,
    user.nickname,
    user.tier,
    user.profileImageUrl,
    // …
)

변경 제안:

.groupBy(
    discussion.id,
+   discussion.language.id,
    user.id,
    user.nickname,
    user.tier,
    user.profileImageUrl,
    // …
)

이렇게 하면 프로젝션에 추가한 discussion.language.id에 대해 그룹핑도 일관되게 처리됩니다.

🤖 Prompt for AI Agents
In
src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/community/discussion/DiscussionQueryRepositoryImpl.java
at line 90, the discussion.language.id field is correctly added to the select
projection but missing from the groupBy clause in the second query. To fix this,
add discussion.language.id to the groupBy block alongside the other grouped
fields to ensure consistent grouping with the projection.

@pokerbearkr pokerbearkr merged commit 5025e44 into dev Jul 8, 2025
2 checks passed
@pokerbearkr pokerbearkr deleted the feature/discussion-language-id branch July 8, 2025 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants