Skip to content

Commit 9e6c4ec

Browse files
committed
[ci/cd] refactor all of file
1 parent 1740065 commit 9e6c4ec

49 files changed

Lines changed: 1066 additions & 1188 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,14 @@ apply plugin: 'com.diffplug.spotless'
8585

8686
spotless {
8787
java {
88-
googleJavaFormat()
8988
target 'src/**/*.java'
89+
90+
// Checkstyle XML 규칙을 완전히 재현할 수는 없지만, 기본 규칙 적용
91+
// 들여쓰기 4칸, 중괄호 스타일, 라인 길이 제한
92+
eclipse().configFile 'config/checkstyle/checkstyle_eclipse_format.xml'
93+
94+
// 혹은 Google Java Format 사용
95+
// googleJavaFormat('1.16.0')
9096
}
91-
}
97+
98+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<profiles version="12">
4+
<profile kind="CodeFormatterProfile" name="CheckstyleLike" version="12">
5+
<!-- 탭/공백 설정: 들여쓰기 4칸, 스페이스 사용 -->
6+
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
7+
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
8+
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
9+
10+
```
11+
<!-- 한 줄 최대 길이 -->
12+
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
13+
14+
<!-- 클래스/메소드/블록 중괄호 위치 -->
15+
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
16+
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
17+
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
18+
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
19+
20+
<!-- 빈 타입, 메소드 블록에서 줄바꿈 -->
21+
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="true"/>
22+
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="true"/>
23+
</profile>
24+
```
25+
26+
</profiles>
Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,38 @@
1-
<?xml version="1.0"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE module PUBLIC
33
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
44
"https://checkstyle.org/dtds/configuration_1_3.dtd">
55

66
<module name="Checker">
7+
<!-- 공통 규칙 적용 -->
78
<module name="TreeWalker">
8-
<!-- 최소 규칙만 적용 -->
9+
<!-- 클래스/인터페이스 이름은 대문자로 시작 -->
10+
<module name="TypeName"/>
11+
12+
<!-- 메소드 이름은 소문자로 시작, camelCase -->
13+
<module name="MethodName"/>
14+
15+
<!-- 변수 이름은 소문자로 시작, camelCase -->
16+
<module name="LocalVariableName"/>
17+
18+
<!-- 들여쓰기: 4칸 -->
19+
<module name="Indentation">
20+
<property name="basicOffset" value="4"/>
21+
<property name="tabWidth" value="4"/>
22+
<property name="braceAdjustment" value="0"/>
23+
</module>
24+
25+
<!-- 한 줄 최대 길이 제한 -->
26+
<module name="LineLength">
27+
<property name="max" value="120"/>
28+
</module>
29+
30+
<!-- 중괄호 스타일 체크 -->
31+
<module name="LeftCurly">
32+
<property name="option" value="eol"/>
33+
</module>
34+
<module name="RightCurly">
35+
<property name="option" value="alone"/>
36+
</module>
937
</module>
10-
</module>
38+
</module>

src/main/java/opensource/bravest/BravestApplication.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@SpringBootApplication
77
public class BravestApplication {
88

9-
public static void main(String[] args) {
10-
SpringApplication.run(BravestApplication.class, args);
11-
}
9+
public static void main(String[] args) {
10+
SpringApplication.run(BravestApplication.class, args);
11+
}
1212
}

src/main/java/opensource/bravest/domain/chatList/controller/ChatListController.java

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,37 +23,36 @@
2323
@RequiredArgsConstructor
2424
public class ChatListController {
2525

26-
private final ChatListService chatListService;
27-
28-
@PostMapping
29-
public ApiResponse<ChatListResponse> createChatList(
30-
@Valid @RequestBody ChatListCreateRequest request) {
31-
ChatListResponse response = chatListService.createChatList(request);
32-
return ApiResponse.onSuccess(response);
33-
}
34-
35-
@GetMapping("/room/{roomId}")
36-
public ApiResponse<List<ChatListResponse>> getChatListsByRoomId(@PathVariable Long roomId) {
37-
List<ChatListResponse> response = chatListService.getChatListsByRoomId(roomId);
38-
return ApiResponse.onSuccess(response);
39-
}
40-
41-
@GetMapping("/{id}")
42-
public ApiResponse<ChatListResponse> getChatListById(@PathVariable Long id) {
43-
ChatListResponse response = chatListService.getChatListById(id);
44-
return ApiResponse.onSuccess(response);
45-
}
46-
47-
@PutMapping("/{id}")
48-
public ApiResponse<ChatListResponse> updateChatList(
49-
@PathVariable Long id, @Valid @RequestBody ChatListUpdateRequest request) {
50-
ChatListResponse response = chatListService.updateChatList(id, request);
51-
return ApiResponse.onSuccess(response);
52-
}
53-
54-
@DeleteMapping("/{id}")
55-
public ApiResponse<Void> deleteChatList(@PathVariable Long id) {
56-
chatListService.deleteChatList(id);
57-
return ApiResponse.onSuccess(null);
58-
}
26+
private final ChatListService chatListService;
27+
28+
@PostMapping
29+
public ApiResponse<ChatListResponse> createChatList(@Valid @RequestBody ChatListCreateRequest request) {
30+
ChatListResponse response = chatListService.createChatList(request);
31+
return ApiResponse.onSuccess(response);
32+
}
33+
34+
@GetMapping("/room/{roomId}")
35+
public ApiResponse<List<ChatListResponse>> getChatListsByRoomId(@PathVariable Long roomId) {
36+
List<ChatListResponse> response = chatListService.getChatListsByRoomId(roomId);
37+
return ApiResponse.onSuccess(response);
38+
}
39+
40+
@GetMapping("/{id}")
41+
public ApiResponse<ChatListResponse> getChatListById(@PathVariable Long id) {
42+
ChatListResponse response = chatListService.getChatListById(id);
43+
return ApiResponse.onSuccess(response);
44+
}
45+
46+
@PutMapping("/{id}")
47+
public ApiResponse<ChatListResponse> updateChatList(@PathVariable Long id,
48+
@Valid @RequestBody ChatListUpdateRequest request) {
49+
ChatListResponse response = chatListService.updateChatList(id, request);
50+
return ApiResponse.onSuccess(response);
51+
}
52+
53+
@DeleteMapping("/{id}")
54+
public ApiResponse<Void> deleteChatList(@PathVariable Long id) {
55+
chatListService.deleteChatList(id);
56+
return ApiResponse.onSuccess(null);
57+
}
5958
}

src/main/java/opensource/bravest/domain/chatList/dto/ChatListDto.java

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,40 @@
88

99
public class ChatListDto {
1010

11-
// 1. 아이디어 생성 요청 DTO (Create Request)
12-
@Getter
13-
@Setter
14-
public static class ChatListCreateRequest {
15-
16-
private Long roomId;
17-
18-
private String content;
19-
20-
private Long registeredBy;
21-
}
22-
23-
// 2. 아이디어 수정 요청 DTO (Update Request)
24-
@Getter
25-
@Setter
26-
public static class ChatListUpdateRequest {
27-
28-
// 아이디어 내용 수정만 가정
29-
private String content;
30-
}
31-
32-
@Getter
33-
@Builder
34-
public static class ChatListResponse {
35-
private Long id;
36-
private Long roomId;
37-
private String content;
38-
private Long registeredBy;
39-
private LocalDateTime createdAt;
40-
41-
public static ChatListResponse fromEntity(ChatList chatList) {
42-
return ChatListResponse.builder()
43-
.id(chatList.getId())
44-
.roomId(chatList.getRoomId())
45-
.content(chatList.getContent())
46-
.registeredBy(chatList.getRegisteredBy().getId())
47-
.createdAt(chatList.getCreatedAt())
48-
.build();
11+
// 1. 아이디어 생성 요청 DTO (Create Request)
12+
@Getter
13+
@Setter
14+
public static class ChatListCreateRequest {
15+
16+
private Long roomId;
17+
18+
private String content;
19+
20+
private Long registeredBy;
21+
}
22+
23+
// 2. 아이디어 수정 요청 DTO (Update Request)
24+
@Getter
25+
@Setter
26+
public static class ChatListUpdateRequest {
27+
28+
// 아이디어 내용 수정만 가정
29+
private String content;
30+
}
31+
32+
@Getter
33+
@Builder
34+
public static class ChatListResponse {
35+
private Long id;
36+
private Long roomId;
37+
private String content;
38+
private Long registeredBy;
39+
private LocalDateTime createdAt;
40+
41+
public static ChatListResponse fromEntity(ChatList chatList) {
42+
return ChatListResponse.builder().id(chatList.getId()).roomId(chatList.getRoomId())
43+
.content(chatList.getContent()).registeredBy(chatList.getRegisteredBy().getId())
44+
.createdAt(chatList.getCreatedAt()).build();
45+
}
4946
}
50-
}
5147
}

src/main/java/opensource/bravest/domain/chatList/entity/ChatList.java

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,40 +25,41 @@
2525
@Table(name = "chat_list")
2626
public class ChatList {
2727

28-
@Id
29-
@GeneratedValue(strategy = GenerationType.IDENTITY)
30-
private Long id;
28+
@Id
29+
@GeneratedValue(strategy = GenerationType.IDENTITY)
30+
private Long id;
3131

32-
@ManyToOne(fetch = FetchType.LAZY)
33-
@JoinColumn(name = "room_id", nullable = false)
34-
private AnonymousRoom room;
32+
@ManyToOne(fetch = FetchType.LAZY)
33+
@JoinColumn(name = "room_id", nullable = false)
34+
private AnonymousRoom room;
3535

36-
@NotNull
37-
@Column(length = 255)
38-
private String content;
36+
@NotNull
37+
@Column(length = 255)
38+
private String content;
3939

40-
@ManyToOne(fetch = FetchType.LAZY)
41-
@JoinColumn(name = "profile_id", nullable = false)
42-
private AnonymousProfile registeredBy;
40+
@ManyToOne(fetch = FetchType.LAZY)
41+
@JoinColumn(name = "profile_id", nullable = false)
42+
private AnonymousProfile registeredBy;
4343

44-
@CreationTimestamp private LocalDateTime createdAt;
44+
@CreationTimestamp
45+
private LocalDateTime createdAt;
4546

46-
@Builder
47-
public ChatList(AnonymousRoom room, String content, AnonymousProfile registeredBy) {
48-
this.room = room;
49-
this.content = content;
50-
this.registeredBy = registeredBy;
51-
}
47+
@Builder
48+
public ChatList(AnonymousRoom room, String content, AnonymousProfile registeredBy) {
49+
this.room = room;
50+
this.content = content;
51+
this.registeredBy = registeredBy;
52+
}
5253

53-
public void updateContent(String content) {
54-
this.content = content;
55-
}
54+
public void updateContent(String content) {
55+
this.content = content;
56+
}
5657

57-
public Long getRoomId() {
58-
return this.room.getId();
59-
}
58+
public Long getRoomId() {
59+
return this.room.getId();
60+
}
6061

61-
public Long getProfileId() {
62-
return this.registeredBy.getId();
63-
}
62+
public Long getProfileId() {
63+
return this.registeredBy.getId();
64+
}
6465
}

src/main/java/opensource/bravest/domain/chatList/repository/ChatListRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
public interface ChatListRepository extends JpaRepository<ChatList, Long> {
99

10-
@Query("SELECT c FROM ChatList c WHERE c.room.id = :roomId ORDER BY c.createdAt DESC")
11-
List<ChatList> findAllByRoomId(Long roomId);
10+
@Query("SELECT c FROM ChatList c WHERE c.room.id = :roomId ORDER BY c.createdAt DESC")
11+
List<ChatList> findAllByRoomId(Long roomId);
1212
}

0 commit comments

Comments
 (0)