Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
@Builder
@Getter
public class Calendar {

Copy link
Member Author

Choose a reason for hiding this comment

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

이 공백은 왜 생긴걸까?

Copy link
Member Author

Choose a reason for hiding this comment

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

@coderabbitai
확인해봐

Copy link

Choose a reason for hiding this comment

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

🧩 Analysis chain

@minhyuk2 이 공백 라인이 왜 추가되었는지 확인해보겠습니다.


🏁 Script executed:

#!/bin/bash
echo "=== 모든 엔티티 파일에서 클래스 선언 후 공백 라인 패턴 확인 ==="
# Check the pattern in all entity files mentioned in the summary
files=(
  "src/main/java/com/usememo/jugger/domain/calendar/entity/Calendar.java"
  "src/main/java/com/usememo/jugger/domain/category/entity/Category.java"
  "src/main/java/com/usememo/jugger/domain/chat/entity/Chat.java"
  "src/main/java/com/usememo/jugger/domain/chat/entity/ChatType.java"
  "src/main/java/com/usememo/jugger/domain/link/entity/Link.java"
  "src/main/java/com/usememo/jugger/domain/photo/entity/Photo.java"
  "src/main/java/com/usememo/jugger/domain/user/entity/User.java"
  "src/main/java/com/usememo/jugger/global/security/token/domain/RefreshToken.java"
)

for file in "${files[@]}"; do
  if [ -f "$file" ]; then
    echo "=== $file ==="
    # Show the class declaration and the lines after it
    grep -A 5 "^public class\|^public enum" "$file" 2>/dev/null || echo "파일을 찾을 수 없습니다"
    echo ""
  fi
done

echo "=== 포매팅 관련 설정 파일 확인 ==="
# Check for formatting configuration files
fd -t f '\.editorconfig|checkstyle\.xml|spotless|.spotbugs|pmd\.xml' .
echo ""

echo "=== Git 커밋 히스토리에서 이 변경사항 확인 ==="
# Check the recent commit that made these changes
git log --oneline -10

echo ""
echo "=== 현재 PR의 변경된 파일들 ==="
git diff --name-only HEAD~1 HEAD

Length of output: 5467


확인 결과, 모든 엔티티 파일에서 클래스 선언 바로 다음에 공백 라인이 일관되게 추가되었습니다.

분석 결과:

  1. 패턴이 일관적: 8개의 모든 엔티티 파일 (Calendar, Category, Chat, ChatType, Link, Photo, User, RefreshToken)에서 동일한 위치에 공백 라인이 추가됨

  2. 자동 포매팅으로 추정:

    • 수동으로 8개 파일을 모두 편집하기에는 너무 일관적인 패턴
    • IDE의 자동 포매팅이나 코드 스타일 적용이 원인으로 보임
  3. 가능한 원인들:

    • IntelliJ IDEA나 Eclipse 등 IDE에서 "Reformat Code" 실행
    • IDE의 자동 저장 시 포매팅 기능 활성화
    • 코드 스타일 설정에서 클래스 선언 후 공백 라인을 추가하도록 설정됨

질문: 혹시 IDE에서 코드를 편집하거나 포매팅 기능을 사용하셨나요? 어떤 IDE를 사용하고 계신지요? 이런 자동 포매팅을 방지하려면 IDE 설정을 확인해보시는 것이 좋겠습니다.

🐰 (호기심 가득한 토끼 - 원인을 찾아내는 중)
/| /|
( ✌️ )
|(_)|


🏁 Script executed:

#!/bin/bash
echo "=== Git 커밋 메시지와 상세 정보 확인 ==="
git log -1 --pretty=format:"커밋: %H%n작성자: %an <%ae>%n날짜: %ad%n메시지: %s%n%n%b" --date=local

echo ""
echo "=== IDE/에디터 설정 파일들 확인 ==="
fd -t f '\.idea|\.vscode|\.project|\.classpath|\.settings' . | head -10

echo ""
echo "=== Java 포매팅 관련 설정 확인 ==="
find . -name "*.xml" -o -name "*.properties" | xargs grep -l -i "format\|style\|indent" 2>/dev/null | head -5

Length of output: 384


🏁 Script executed:

#!/bin/bash
echo "=== 현재 PR 브랜치와 커밋 정보 ==="
git branch -v
echo ""
git log --oneline -3

echo ""
echo "=== 변경 사항 상세 확인 ==="
git show --stat

echo ""
echo "=== 전체 diff 요약 ==="
git diff HEAD~1 HEAD --stat

echo ""
echo "=== 프로젝트 루트 구조 확인 ==="
ls -la | head -15

echo ""
echo "=== build.gradle이나 pom.xml 확인 ==="
find . -maxdepth 2 -name "build.gradle" -o -name "pom.xml" -o -name "build.gradle.kts"

Length of output: 2936


@minhyuk2 이제 상황이 명확해졌습니다!

공백 라인이 생긴 이유:

커밋 메시지: test : rabbit아 ERD를 만들어줘 #142

  • 원래 목적은 ERD 생성 요청이었는데, 실제로는 8개 엔티티 파일에 공백 라인만 추가됨

원인 분석:

  1. ERD 생성을 위해 엔티티 파일들을 확인하거나 편집하는 과정에서
  2. IDE의 자동 포매팅 기능이 작동하여 클래스 선언 후에 일관되게 공백 라인을 추가
  3. 8개 파일 모두 동일한 위치(클래스 선언 바로 다음)에 정확히 1줄씩 추가된 패턴

해결 방안:

IDE 자동 포매팅 방지:

  • IntelliJ IDEA: Settings > Editor > Code Style > Java > Blank Lines 설정 확인
  • 또는 Settings > Tools > Actions on Save에서 자동 포매팅 비활성화

원래 요청 처리:
ERD를 생성해드릴까요? 현재 엔티티 구조를 보면:

  • User (사용자)
  • Calendar (캘린더 이벤트)
  • Category (카테고리)
  • Chat (채팅)
  • Link, Photo (링크, 사진)
  • RefreshToken (인증 토큰)

이들 간의 관계를 ERD로 만들어드릴 수 있습니다!

🐰 (문제 해결한 뿌듯한 토끼)
/| /|
( ^.^ )
|(_)|


🧬 Code Graph Analysis Results

Relevant code snippets for understanding src/main/java/com/usememo/jugger/domain/calendar/entity/Calendar.java


File: src/main/java/com/usememo/jugger/domain/calendar/entity/Calendar.java (lines 1-38)

package com.usememo.jugger.domain.calendar.entity;

import java.time.Instant;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

@Document(collection = "calendars")
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@Builder
@Getter
public class Calendar {

	@Id
	private String uuid;
	private String userUuid;
	@Setter
	private String title;
	@Setter
	private Instant startDateTime;
	@Setter
	private Instant endDateTime;
	@Setter
	private String categoryUuid;
	@Setter
	private String place;
	@Setter
	private Instant alarm;
	@Setter
	private String description;

	public Calendar() {

	}
}
  • This class represents a calendar entity stored in the MongoDB collection "calendars".
  • It uses Lombok annotations for builder pattern, getters, setters (only for mutable fields), and a protected all-args constructor.
  • Fields include identifiers (uuid, userUuid), event details (title, startDateTime, endDateTime, place, description), category association (categoryUuid), and alarm time (alarm).
  • The class has a no-args constructor for framework usage.

File: src/main/java/com/usememo/jugger/domain/calendar/dto/GetCalendarDto.java (lines 8-20)

@Builder
@Data
public class GetCalendarDto {
	private String calendarId;
	private Instant startDateTime;
	private Instant endDateTime;
	private String categoryId;
	private String categoryColor;
	private String title;
	private String place;
	private Instant alarm;
	private String description;
}
  • DTO class for transferring calendar data.
  • Contains fields similar to Calendar entity but includes categoryColor and uses calendarId and categoryId instead of UUID naming.
  • Uses Lombok @Builder and @Data for boilerplate code generation.

File: src/main/java/com/usememo/jugger/domain/category/entity/Category.java (lines 15-43)

@Document(collection = "category")
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
@Builder
@Setter
public class Category extends BaseTimeEntity implements Persistable<String> {

	@Id
	private String uuid;
	private String name;
	private String color;
	private Boolean isPinned;
	private String userUuid;

	public void setPinned(Boolean pinned) {
		isPinned = pinned;
	}

	@Override
	public String getId() {
		return getUuid();
	}

	@Override
	public boolean isNew() {
		return getCreatedAt() == null;
	}

}
  • Represents a category entity related to calendar events.
  • Contains fields for UUID, name, color, pinned status, and user association.
  • Extends BaseTimeEntity for created/updated timestamps.
  • Implements Persistable<String> for persistence control.
  • Provides getter/setter and builder pattern.

File: src/main/java/com/usememo/jugger/global/utils/BaseTimeEntity.java (lines 11-25)

@Getter
public abstract class BaseTimeEntity {

	@CreatedDate
	@Field("created_at")
	private Instant createdAt;

	@LastModifiedDate
	@Field("updated_at")
	private Instant updatedAt;

	public void setUpdatedAt(Instant updatedAt) {
		this.updatedAt = updatedAt;
	}
}
  • Abstract base class providing automatic timestamp fields for creation and last modification.
  • Uses Spring Data annotations to auto-populate these fields.
  • Used as a superclass by entities like Category.

File: src/main/java/com/usememo/jugger/domain/chat/entity/Chat.java (lines 16-50)

@Document(collection = "chats")
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@Builder
@Getter
public class Chat extends BaseTimeEntity implements Persistable<String> {

	@Id
	private String uuid;
	private String userUuid;

	@Setter
	private String categoryUuid;
	@Setter
	private String data;
	private Refs refs;

	@Data
	@Builder
	public static class Refs {
		private String calendarUuid;
		private String photoUuid;
		private String linkUuid;
	}

	@Override
	public String getId() {
		return getUuid();
	}

	@Override
	public boolean isNew() {
		return getCreatedAt() == null;
	}
}
  • Chat entity that references calendar events via Refs.calendarUuid.
  • Shows a pattern of entities with UUIDs, user association, category, and references to other entities.
  • Extends BaseTimeEntity and implements Persistable.

File: src/main/java/com/usememo/jugger/domain/user/entity/User.java (lines 13-34)

@Document(collection = "users")
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@Builder
@Getter
@ToString
public class User {

	@Id
	private String uuid;
	private String name;
	private String email;
	private String domain;

	private Terms terms;

	@Data
	public static class Terms {
		private boolean termsOfService;
		private boolean privacyPolicy;
		private boolean marketing;
	}
}
  • User entity with UUID, personal info, and terms acceptance.
  • Relevant for understanding userUuid field in Calendar.

Summary

The Calendar entity is a MongoDB document representing calendar events with fields for user association, timing, category, and additional metadata. Related classes include Category for event categorization, GetCalendarDto for data transfer, and User for user information. Base classes like BaseTimeEntity provide common timestamp fields. The Chat entity shows references to calendar events, indicating possible relations in the domain model.

Copy link
Contributor

Choose a reason for hiding this comment

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

와우...

Copy link

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

@Id
private String uuid;
private String userUuid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@Builder
@Setter
public class Category extends BaseTimeEntity implements Persistable<String> {

@Id
private String uuid;
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@Getter
public class Chat extends BaseTimeEntity implements Persistable<String> {


@Id
private String uuid;
private String userUuid;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.usememo.jugger.domain.chat.entity;

public enum ChatType {

CALENDAR, LINK, PHOTO
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@Builder
@Getter
public class Link extends BaseTimeEntity implements Persistable<String> {

@Id
private String uuid;
private String userUuid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@Builder
@Getter
public class Photo extends BaseTimeEntity implements Persistable<String> {

@Id
private String uuid;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
@Getter
@ToString
public class User {

@Id
private String uuid;
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@Document
public class RefreshToken {


@Id
private String id;
private String userId;
Expand Down