Skip to content

Commit b93e7b9

Browse files
authored
Merge pull request #74 from BackEndSchoolPlus3th/SMS-100-feature-ref
Refactor: 코드 정리
2 parents dd93eed + 32aba73 commit b93e7b9

87 files changed

Lines changed: 136 additions & 677 deletions

File tree

Some content is hidden

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

src/main/java/org/com/stocknote/domain/post/config/QuerydslConfig.java renamed to src/main/java/org/com/stocknote/config/QuerydslConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.com.stocknote.domain.post.config;
1+
package org.com.stocknote.config;
22

33
import com.querydsl.jpa.impl.JPAQueryFactory;
44
import jakarta.persistence.EntityManager;

src/main/java/org/com/stocknote/config/RedisConfig.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.springframework.data.redis.core.RedisTemplate;
1212
import org.springframework.data.redis.core.StringRedisTemplate;
1313
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
14-
import org.springframework.data.redis.serializer.GenericToStringSerializer;
1514
import org.springframework.data.redis.serializer.RedisSerializer;
1615
import org.springframework.data.redis.serializer.StringRedisSerializer;
1716

@@ -40,20 +39,20 @@ public RedisTemplate<Object, Object> redisObjectTemplate() {
4039
redisTemplate.setValueSerializer(new StringRedisSerializer());
4140
return redisTemplate;
4241
}
42+
4343
@Bean
4444
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
4545
RedisTemplate<String, Object> template = new RedisTemplate<>();
4646
template.setConnectionFactory(connectionFactory);
4747

48-
// 🔹 JSON 직렬화 설정
4948
ObjectMapper objectMapper = new ObjectMapper();
50-
objectMapper.registerModule(new JavaTimeModule()); // LocalDateTime 지원 추가
51-
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); // ISO 8601 포맷 유지
49+
objectMapper.registerModule(new JavaTimeModule());
50+
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
5251

5352
RedisSerializer<Object> serializer = new GenericJackson2JsonRedisSerializer(objectMapper);
5453

55-
template.setKeySerializer(new StringRedisSerializer()); // 키 직렬화
56-
template.setValueSerializer(serializer); // 값 직렬화
54+
template.setKeySerializer(new StringRedisSerializer());
55+
template.setValueSerializer(serializer);
5756
template.setHashKeySerializer(new StringRedisSerializer());
5857
template.setHashValueSerializer(serializer);
5958

src/main/java/org/com/stocknote/config/StockScheduler.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.com.stocknote.config;
22

3-
import jakarta.annotation.PostConstruct;
43
import lombok.extern.slf4j.Slf4j;
54
import org.springframework.beans.factory.annotation.Value;
65
import org.springframework.context.annotation.Bean;
@@ -18,7 +17,6 @@
1817
import java.nio.file.Files;
1918
import java.nio.file.StandardCopyOption;
2019
import java.time.LocalDateTime;
21-
import java.util.TimeZone;
2220

2321
@Configuration
2422
@EnableScheduling
@@ -49,7 +47,7 @@ public void downloadStockData() {
4947
StandardCopyOption.REPLACE_EXISTING);
5048

5149
ProcessBuilder processBuilder = new ProcessBuilder("python", tempScript.getAbsolutePath());
52-
processBuilder.redirectErrorStream(true); // 에러 스트림을 표준 출력으로 리다이렉트
50+
processBuilder.redirectErrorStream(true);
5351
Process process = processBuilder.start();
5452

5553
// 실시간으로 로그 출력

src/main/java/org/com/stocknote/config/SwaggerConfig.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ public OpenAPI customOpenAPI() {
1818
.title("StockNote API")
1919
.version("v1.0.0");
2020

21-
// 스키마 이름을 'JWT' 라고 간단히 표현
2221
String securitySchemeName = "JWT";
2322

24-
// 요구 사항(“Authorize”) 생성
2523
SecurityRequirement securityRequirement = new SecurityRequirement().addList(securitySchemeName);
2624

27-
// bearer 인증 스키마 구성
2825
Components components = new Components()
2926
.addSecuritySchemes(securitySchemeName, new SecurityScheme()
3027
.name("Authorization") // HTTP Header 이름
@@ -34,7 +31,7 @@ public OpenAPI customOpenAPI() {
3431

3532
return new OpenAPI()
3633
.info(info)
37-
.addSecurityItem(securityRequirement) // 글로벌 적용
34+
.addSecurityItem(securityRequirement)
3835
.components(components);
3936
}
4037
}

src/main/java/org/com/stocknote/config/WebSocketConfig.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.com.stocknote.config;
22

3-
import org.springframework.beans.factory.annotation.Value;
43
import org.springframework.context.annotation.Configuration;
54

65
import org.springframework.messaging.simp.config.ChannelRegistration;

src/main/java/org/com/stocknote/domain/comment/controller/CommentController.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.com.stocknote.domain.comment.service.CommentService;
1111
import org.com.stocknote.domain.member.entity.Member;
1212
import org.com.stocknote.domain.notification.service.CommentNotificationService;
13-
import org.com.stocknote.global.dto.GlobalResponse;
13+
import org.com.stocknote.global.globalDto.GlobalResponse;
1414
import org.com.stocknote.oauth.entity.PrincipalDetails;
1515
import org.springframework.security.core.annotation.AuthenticationPrincipal;
1616
import org.springframework.web.bind.annotation.*;
@@ -19,17 +19,11 @@
1919
@RequestMapping("/api/v1/posts/{postId}/comments")
2020
@RequiredArgsConstructor
2121
@Tag(name = "게시판 댓글 API", description = "댓글(comment)")
22-
public class CommentController {
22+
public class CommentController{
2323

2424
private final CommentService commentService;
2525
private final CommentNotificationService commentNotificationService;
2626

27-
// @GetMapping
28-
// public GlobalResponse<Page<CommentDetailResponse>> getComments(@PathVariable(value = "postId") Long postId, Pageable pageable) {
29-
// return GlobalResponse.success(commentService.getComments(postId, pageable));
30-
// }
31-
32-
3327
@GetMapping("/{commentId}")
3428
@Operation(summary = "댓글 상세 조회")
3529
public GlobalResponse<CommentDetailResponse> getComment(@PathVariable(value = "commentId") Long commentId) {
@@ -86,5 +80,4 @@ public GlobalResponse<Boolean> hasUserCommentedOnPost(
8680
boolean hasCommented = commentService.hasUserCommentedOnPost(postId, member);
8781
return GlobalResponse.success(hasCommented);
8882
}
89-
90-
}
83+
}

src/main/java/org/com/stocknote/domain/comment/dto/CommentDetailResponse.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.com.stocknote.domain.comment.dto;
22

3-
import lombok.AllArgsConstructor;
4-
import lombok.Getter;
53
import org.com.stocknote.domain.comment.entity.Comment;
64

75
import java.time.LocalDateTime;
@@ -14,7 +12,6 @@ public record CommentDetailResponse(
1412
String author,
1513
String profile
1614
) {
17-
// Factory method to convert Comment to DTO
1815
public static CommentDetailResponse of(Comment comment) {
1916
return new CommentDetailResponse(
2017
comment.getId(),
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package org.com.stocknote.domain.comment.dto;
22

3+
import lombok.Getter;
4+
5+
@Getter
36
public class CommentRequest {
47
private String body;
5-
6-
public String getBody() {
7-
return body;
8-
}
98
}

src/main/java/org/com/stocknote/domain/comment/repository/CommentRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
@Repository
1313
public interface CommentRepository extends JpaRepository<Comment, Long> {
14-
// Page<Comment> findByPostId(Pageable pageable, Long postId);
14+
1515
Page<Comment> findByMember(Member member, Pageable pageable);
1616
boolean existsByPostIdAndMember(Long postId, Member member);
1717
@Query(value = "SELECT DISTINCT c FROM Comment c " +

src/main/java/org/com/stocknote/domain/hashtag/service/HashtagService.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ public List<Hashtag> getHashtagsByPostId(Long postId) {
3434

3535
@Transactional
3636
public void updateHashtags(Long postId, List<String> newHashtagNames) {
37-
// Delete existing hashtags
3837
hashtagRepository.deleteByPostId(postId);
39-
40-
// Create new hashtags
4138
createHashtags(postId, newHashtagNames);
4239
}
4340

0 commit comments

Comments
 (0)