Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
58e9b5e
chore: ์„ฑ๋Šฅ ์ตœ์ ํ™”(After) ํ™˜๊ฒฝ ๊ตฌ์„ฑ
HeoJunHyoung Nov 27, 2025
b616e74
chore: ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ํŒŒ์ผ๋ช…์„ after๋กœ ๋ณ€๊ฒฝ
HeoJunHyoung Nov 27, 2025
cda675b
chore: before ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ด
HeoJunHyoung Nov 27, 2025
c882564
perf(support): Redis ์บ์‹ฑ ๋„์ž… ๋ฐ ๊ณต์ง€์‚ฌํ•ญ ์กฐํšŒ ์„ฑ๋Šฅ ์ตœ์ ํ™”
HeoJunHyoung Nov 27, 2025
d03027d
perf(community): Community ์กฐํšŒ ์ฟผ๋ฆฌ ์ตœ์ ํ™”
HeoJunHyoung Nov 27, 2025
284f3f2
chore: docs/developer guide ์ œ๊ฑฐ(์ตœ์‹ ํ™” ์•ˆ๋˜์–ด์žˆ์Œ)
HeoJunHyoung Nov 27, 2025
5bf79a7
feat: ๋ชจ๋‹ˆํ„ฐ๋ง ์˜์กด์„ฑ ๋ˆ„๋ฝ๋œ ์„œ๋น„์Šค์— ์ถ”๊ฐ€ ๋ฐ ๋ชจ๋“  ์„œ๋น„์Šค(๋ชจ๋“ˆ)์˜ application.yml์— ๋ชจ๋‹ˆํ„ฐ๋ง ์—”๋“œํฌ์ธํŠธ โ€ฆ
HeoJunHyoung Nov 28, 2025
ea25aaf
fix(auth-service): ๋ชจ๋‹ˆํ„ฐ๋ง ๊ฒฝ๋กœ(/actuator/**) ํ—ˆ์šฉ
HeoJunHyoung Nov 28, 2025
8aae770
feat(portfolio): ์‹ค์‹œ๊ฐ„ ์ธ๊ธฐ ์ ์ˆ˜ ๊ณ„์‚ฐ ๋ฐ ์ •๋ ฌ ๋กœ์ง ๊ตฌํ˜„ (Naive Ver)
HeoJunHyoung Nov 29, 2025
cb892b0
perf(portfolio): ์กฐํšŒ์ˆ˜ Redis Write-Back ํŒจํ„ด ๋ฐ ๋ฐฐ์น˜ ์Šค์ผ€์ค„๋Ÿฌ ์ ์šฉ
HeoJunHyoung Nov 29, 2025
bf0ffcb
chore: StringRedis ๋ณ€๊ฒฝ
HeoJunHyoung Nov 29, 2025
b428cb5
perf(portfolio): ํฌํŠธํด๋ฆฌ์˜ค ์กฐํšŒ ์„ฑ๋Šฅ ์ตœ์ ํ™” (Split Caching ์ „๋žต ์ ์šฉ)
HeoJunHyoung Nov 29, 2025
60d3456
perf(community): ๊ฒŒ์‹œ๊ธ€ ์กฐํšŒ ์„ฑ๋Šฅ ์ตœ์ ํ™” (Redis ์บ์‹ฑ, Write-Back ๋ฐ DB ์ธ๋ฑ์‹ฑ ์ ์šฉ)
HeoJunHyoung Nov 29, 2025
8402270
chore: tests/k6/workloads ์ดˆ๊ธฐํ™”
HeoJunHyoung Nov 29, 2025
b3d4da9
feat: k6 ์Šคํฌ๋ฆฝํŠธ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ถ”๊ฐ€
HeoJunHyoung Nov 29, 2025
aad03eb
k6 ์Šคํฌ๋ฆฝํŠธ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ˆ˜์ •
HeoJunHyoung Nov 30, 2025
5f9616b
chore: k6 before ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ
HeoJunHyoung Nov 30, 2025
445cf64
chore: cherry-pick
HeoJunHyoung Nov 30, 2025
fe06b21
chore: ci/cd ํ‘ธ์‹œ ๋ธŒ๋žœ์น˜ ์ถ”๊ฐ€(perf/after-optimization)
HeoJunHyoung Nov 30, 2025
e46d291
fix: ์ปค๋ฎค๋‹ˆํ‹ฐ ๊ฒŒ์‹œ๊ธ€ ๋ณธ๋ฌธ(context) ํ•„๋“œ์—์„œ @Lob ์ œ๊ฑฐ ํ›„ substring ํ•˜๋Š” ๋ถ€๋ถ„ ์‚ญ์ œ (์ง€์› ์•ˆํ•จ)
HeoJunHyoung Nov 30, 2025
3a638c4
fix(community): QueryDSL ์กฐํšŒ ๋กœ์ง์„ fields์—์„œ constructor ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝ
HeoJunHyoung Nov 30, 2025
f856e16
chore
HeoJunHyoung Nov 30, 2025
4661a40
perf(portfolio): ์ข‹์•„์š” ์นด์šดํŠธ ๋™๊ธฐํ™” ๋ฐฉ์‹์„ Redis Write-Back ํŒจํ„ด์œผ๋กœ ๋ณ€๊ฒฝํ•˜์—ฌ ๋™์‹œ์„ฑ ์ด์Šˆ ํ•ด๊ฒฐ
HeoJunHyoung Dec 1, 2025
a3624d8
perf(community): ๋Œ“๊ธ€ ๋ฐ ๋ถ๋งˆํฌ ์นด์šดํŠธ ๋™๊ธฐํ™” ๋ฐฉ์‹์„ Redis Write-Back์œผ๋กœ ๋ณ€๊ฒฝ
HeoJunHyoung Dec 1, 2025
88ed17d
perf: DB ์ปค๋„ฅ์…˜ ํ’€ ์ตœ์ ํ™” ๋ฐ ๋ฏธ์‚ฌ์šฉ OpenFeign ์˜์กด์„ฑ ์ œ๊ฑฐ
HeoJunHyoung Dec 1, 2025
7082da8
chore
HeoJunHyoung Dec 1, 2025
7bfb297
fix(support): ๊ณต์ง€์‚ฌํ•ญ ๋ชฉ๋ก ์กฐํšŒ Redis ์ง๋ ฌํ™” ์—๋Ÿฌ ์ˆ˜์ • ๋ฐ ์บ์‹œ ํ‚ค ํŒจํ„ด ์ตœ์ ํ™”
HeoJunHyoung Dec 1, 2025
e523cf7
fix(community): ์ปค๋ฎค๋‹ˆํ‹ฐ ๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก ์กฐํšŒ ์‹œ OpenFeign ์ง๋ ฌํ™” ์ถฉ๋Œ ์—๋Ÿฌ ์ˆ˜์ •
HeoJunHyoung Dec 1, 2025
1529040
perf: ์„ฑ๋Šฅ ์ตœ์ ํ™” ์ ์šฉ ๋ฐ ๋ถ€ํ•˜ ํ…Œ์ŠคํŠธ ํ™˜๊ฒฝ ๊ณ ๋„ํ™”
HeoJunHyoung Dec 1, 2025
2a31b3f
refactor: k6 ํ…Œ์ŠคํŠธ ๋””๋ ‰ํ„ฐ๋ฆฌ ๊ตฌ์กฐ ๋ณ€๊ฒฝ ๋ฐ ์‹œ๋‚˜๋ฆฌ์˜ค ๋ณ€๊ฒฝ
HeoJunHyoung Dec 2, 2025
168b2a9
chore: k6 ์Šคํฌ๋ฆฝํŠธ ์ˆ˜์ • ๋ฐ before result๊ฐ’ ๊ฐ€์ ธ์˜ด
HeoJunHyoung Dec 2, 2025
aa6d19f
chore
HeoJunHyoung Dec 2, 2025
ed806aa
chore: perf/after-optimization ci/cd workflows ํ™œ์„ฑํ™” ์šฉ ์ปค๋ฐ‹
HeoJunHyoung Dec 2, 2025
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
1 change: 1 addition & 0 deletions .github/workflows/pipeline-monorepo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- dev
- perf/after-optimization
paths-ignore:
- 'tests/**' # k6 ์Šคํฌ๋ฆฝํŠธ
- 'docs/**' # ๋ฌธ์„œ ํด๋”
Expand Down
9 changes: 9 additions & 0 deletions apigateway-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@
<version>2.5.0</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

<dependency>
<groupId>com.example</groupId>
<artifactId>common-module</artifactId>
Expand Down
20 changes: 19 additions & 1 deletion apigateway-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ spring:
uri: http://community-service:80
predicates:
- Path=/community-service/**
httpclient:
connect-timeout: 10000
response-timeout: 30s

app:
gateway:
Expand Down Expand Up @@ -146,4 +149,19 @@ springdoc:
# ๊ฒŒ์ดํŠธ์›จ์ด์˜ ๊ณต์ธ ์ฃผ์†Œ(ngrok)๋ฅผ ๋ช…์‹œํ•˜์—ฌ Mixed Content ๋ฌธ์ œ ํ•ด๊ฒฐ
servers:
- url: https://impressionless-connaturally-jonie.ngrok-free.dev
description: NGrok Development Server
description: NGrok Development Server

# --- Monitoring Configuration (Added) ---
management:
endpoints:
web:
exposure:
include: prometheus, health, info # ํ”„๋กœ๋ฉ”ํ…Œ์šฐ์Šค ์ง€ํ‘œ ๋…ธ์ถœ ํ—ˆ์šฉ
endpoint:
health:
show-details: always
prometheus:
enabled: true
metrics:
tags:
application: ${spring.application.name} # Grafana์—์„œ ์„œ๋น„์Šค๋ณ„๋กœ ๊ตฌ๋ถ„ํ•˜๊ธฐ ์œ„ํ•ด ํƒœ๊ทธ ์ถ”๊ฐ€
4 changes: 0 additions & 4 deletions auth-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes-client-loadbalancer</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;
Expand All @@ -11,7 +10,6 @@
@SpringBootApplication(scanBasePackages = "com.example")
@EnableJpaAuditing
@EnableAsync
@EnableFeignClients
public class AuthServiceApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http, Authentication
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(authorize -> authorize
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
.requestMatchers("/swagger-ui/**", "/v3/api-docs/**", "/swagger-resources/**").permitAll()
.requestMatchers("/swagger-ui/**", "/v3/api-docs/**", "/swagger-resources/**", "/actuator/**").permitAll()
// ๋ชจ๋“  /auth/** ๊ฒฝ๋กœ๋Š” ์ธ์ฆ ์—†์ด ํ—ˆ์šฉ
.requestMatchers("/auth/**").permitAll()
.requestMatchers("/oauth2/**", "/login/oauth2/**").permitAll()
Expand Down
19 changes: 16 additions & 3 deletions auth-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,23 @@ jwt:

# Feign (User Service ???)
app:
feign:
user-service-url: http://user-service:80 # k8s ?? ??? ?? (?? 80)
frontend:
redirect-url: ${APP_FRONTEND_REDIRECT_URL} # ex) http://127.0.0.1:5173/auth/callback

springdoc:
override-with-generic-response: false
override-with-generic-response: false

# --- Monitoring Configuration (Added) ---
management:
endpoints:
web:
exposure:
include: prometheus, health, info # ํ”„๋กœ๋ฉ”ํ…Œ์šฐ์Šค ์ง€ํ‘œ ๋…ธ์ถœ ํ—ˆ์šฉ
endpoint:
health:
show-details: always
prometheus:
enabled: true
metrics:
tags:
application: ${spring.application.name} # Grafana์—์„œ ์„œ๋น„์Šค๋ณ„๋กœ ๊ตฌ๋ถ„ํ•˜๊ธฐ ์œ„ํ•ด ํƒœ๊ทธ ์ถ”๊ฐ€
10 changes: 10 additions & 0 deletions chat-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

</dependencies>

<dependencyManagement>
Expand Down
17 changes: 16 additions & 1 deletion chat-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,19 @@ spring:
logging:
level:
org.springframework.web.socket: DEBUG
com.example.chatservice: DEBUG
com.example.chatservice: DEBUG

# --- Monitoring Configuration (Added) ---
management:
endpoints:
web:
exposure:
include: prometheus, health, info # ํ”„๋กœ๋ฉ”ํ…Œ์šฐ์Šค ์ง€ํ‘œ ๋…ธ์ถœ ํ—ˆ์šฉ
endpoint:
health:
show-details: always
prometheus:
enabled: true
metrics:
tags:
application: ${spring.application.name} # Grafana์—์„œ ์„œ๋น„์Šค๋ณ„๋กœ ๊ตฌ๋ถ„ํ•˜๊ธฐ ์œ„ํ•ด ํƒœ๊ทธ ์ถ”๊ฐ€
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
@AllArgsConstructor
public class UserProfileCreationFailureEvent {
private Long userId;
private String reason; // ์‹คํŒจ ์‚ฌ์œ 
private String reason;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import com.example.communityservice.dto.request.PostCreateRequest;
import com.example.communityservice.dto.request.PostUpdateRequest;
import com.example.communityservice.dto.request.RecruitmentStatusRequest;
import com.example.communityservice.dto.response.PostDetailResponse;
import com.example.communityservice.dto.response.PostResponse;
import com.example.communityservice.dto.response.*;
import com.example.communityservice.entity.enumerate.PostCategory;
import com.example.communityservice.service.PostService;
import io.swagger.v3.oas.annotations.Operation;
Expand Down Expand Up @@ -79,12 +78,13 @@ public ResponseEntity<Void> deletePost(@AuthenticationPrincipal AuthUser authUse

@Operation(summary = "๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก ์กฐํšŒ (๊ฒ€์ƒ‰/ํ•„ํ„ฐ)", description = "์นดํ…Œ๊ณ ๋ฆฌ, ํ‚ค์›Œ๋“œ, ํ•ด๊ฒฐ ์—ฌ๋ถ€ ๋“ฑ์„ ์กฐ๊ฑด์œผ๋กœ ๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค. (์ธ์ฆ ๋ถˆํ•„์š”)")
@GetMapping("/posts")
public ResponseEntity<Page<PostResponse>> getPosts(
public ResponseEntity<CustomPageResponse<PostResponse>> getPosts(
@Parameter(description = "์นดํ…Œ๊ณ ๋ฆฌ (QNA, INFO, RECRUIT)") @RequestParam(required = false) PostCategory category,
@Parameter(description = "๊ฒ€์ƒ‰ ํ‚ค์›Œ๋“œ (์ œ๋ชฉ + ๋‚ด์šฉ)") @RequestParam(required = false) String keyword,
@Parameter(description = "ํ•ด๊ฒฐ ์—ฌ๋ถ€ (QnA ์ „์šฉ)") @RequestParam(required = false) Boolean isSolved,
@Parameter(description = "ํŽ˜์ด์ง• ์„ค์ • (๊ธฐ๋ณธ: ์ตœ์‹ ์ˆœ 10๊ฐœ)") @PageableDefault(size = 10, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable) {
return ResponseEntity.ok(postService.getPosts(category, keyword, isSolved, pageable));
Page<PostResponse> page = postService.getPosts(category, keyword, isSolved, pageable);
return ResponseEntity.ok(new CustomPageResponse<>(page));
}

@Operation(summary = "๊ฒŒ์‹œ๊ธ€ ์ƒ์„ธ ์กฐํšŒ", description = "๊ฒŒ์‹œ๊ธ€์˜ ์ƒ์„ธ ๋‚ด์šฉ๊ณผ ๊ณ„์ธตํ˜• ๋Œ“๊ธ€ ๋ชฉ๋ก์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธ ์‹œ ๋ถ๋งˆํฌ ์—ฌ๋ถ€๊ฐ€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.")
Expand Down Expand Up @@ -202,27 +202,26 @@ public ResponseEntity<Void> updateRecruitmentStatus(@AuthenticationPrincipal Aut
return ResponseEntity.ok().build();
}

@Operation(summary = "๋‚ด๊ฐ€ ์“ด ๊ฒŒ์‹œ๊ธ€ ์กฐํšŒ", description = "๋กœ๊ทธ์ธํ•œ ์‚ฌ์šฉ์ž๊ฐ€ ์ž‘์„ฑํ•œ ๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.")
@Operation(summary = "๋‚ด๊ฐ€ ์“ด ๊ฒŒ์‹œ๊ธ€ ์กฐํšŒ", description = "๋กœ๊ทธ์ธํ•œ ์‚ฌ์šฉ์ž๊ฐ€ ์ž‘์„ฑํ•œ ๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค. (์นดํ…Œ๊ณ ๋ฆฌ ํ•„ํ„ฐ๋ง ๊ฐ€๋Šฅ)")
@SecurityRequirement(name = "BearerAuthentication")
@GetMapping("/posts/me")
public ResponseEntity<Page<PostResponse>> getMyPosts(@AuthenticationPrincipal AuthUser authUser,
@PageableDefault(sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable) {
return ResponseEntity.ok(postService.getMyPosts(authUser.getUserId(), pageable));
public ResponseEntity<CustomPageResponse<MyPostResponse>> getMyPosts(
@AuthenticationPrincipal AuthUser authUser,
@Parameter(description = "์นดํ…Œ๊ณ ๋ฆฌ (QNA, INFO, RECRUIT), ๋ฏธ์ž…๋ ฅ ์‹œ ์ „์ฒด") @RequestParam(required = false) PostCategory category,
@PageableDefault(sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable) {
Page<MyPostResponse> page = postService.getMyPosts(authUser.getUserId(), category, pageable);
return ResponseEntity.ok(new CustomPageResponse<>(page));
}

@Operation(summary = "๋‚ด๊ฐ€ ๋ถ๋งˆํฌํ•œ ๊ธ€ ์กฐํšŒ", description = "๋กœ๊ทธ์ธํ•œ ์‚ฌ์šฉ์ž๊ฐ€ ๋ถ๋งˆํฌํ•œ ๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.")
@Operation(summary = "๋‚ด๊ฐ€ ๋ถ๋งˆํฌํ•œ ๊ธ€ ์กฐํšŒ", description = "๋กœ๊ทธ์ธํ•œ ์‚ฌ์šฉ์ž๊ฐ€ ๋ถ๋งˆํฌํ•œ ๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค. (์นดํ…Œ๊ณ ๋ฆฌ ํ•„ํ„ฐ๋ง ๊ฐ€๋Šฅ)")
@SecurityRequirement(name = "BearerAuthentication")
@GetMapping("/posts/me/bookmarks")
public ResponseEntity<Page<PostResponse>> getMyBookmarkedPosts(@AuthenticationPrincipal AuthUser authUser,
@PageableDefault(sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable) {
return ResponseEntity.ok(postService.getMyBookmarkedPosts(authUser.getUserId(), pageable));
public ResponseEntity<CustomPageResponse<MyBookmarkPostResponse>> getMyBookmarkedPosts(
@AuthenticationPrincipal AuthUser authUser,
@Parameter(description = "์นดํ…Œ๊ณ ๋ฆฌ (QNA, INFO, RECRUIT), ๋ฏธ์ž…๋ ฅ ์‹œ ์ „์ฒด") @RequestParam(required = false) PostCategory category,
@PageableDefault(sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable) {
Page<MyBookmarkPostResponse> page = postService.getMyBookmarkedPosts(authUser.getUserId(), category, pageable);
return ResponseEntity.ok(new CustomPageResponse<>(page));
}

@Operation(summary = "๋‚ด๊ฐ€ ๋Œ“๊ธ€ ๋‹จ ๊ธ€ ์กฐํšŒ", description = "๋กœ๊ทธ์ธํ•œ ์‚ฌ์šฉ์ž๊ฐ€ ๋Œ“๊ธ€์„ ์ž‘์„ฑํ•œ ๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.")
@SecurityRequirement(name = "BearerAuthentication")
@GetMapping("/posts/me/commented")
public ResponseEntity<Page<PostResponse>> getMyCommentedPosts(@AuthenticationPrincipal AuthUser authUser,
@PageableDefault(sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable) {
return ResponseEntity.ok(postService.getMyCommentedPosts(authUser.getUserId(), pageable));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,18 @@ public ResponseEntity<Void> setupPosts(@RequestBody Map<String, Object> request)

// 2. ๋ฐ์ดํ„ฐ ์ƒ์„ฑ
List<PostEntity> posts = new ArrayList<>();

PostCategory[] categories = PostCategory.values();

for (int i = 0; i < count; i++) {

PostCategory category = categories[i % categories.length];

posts.add(PostEntity.builder()
.userId(userId)
.title("์„ฑ๋Šฅ ํ…Œ์ŠคํŠธ์šฉ ๊ฒŒ์‹œ๊ธ€ " + i)
.content("์ด ๊ฒŒ์‹œ๊ธ€์€ ์„ฑ๋Šฅ ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•ด ์ƒ์„ฑ๋œ ๋”๋ฏธ ๋ฐ์ดํ„ฐ์ž…๋‹ˆ๋‹ค. ".repeat(5)) // ๋‚ด์šฉ ๋ถˆ๋ฆฌ๊ธฐ
.category(PostCategory.INFO)
.category(category)
.build());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
package com.example.communityservice.dto.response;

import com.example.communityservice.entity.PostCommentEntity;
import lombok.Builder;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Data
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CommentResponse {
private Long id;
private Long userId;

// ์ž‘์„ฑ์ž ์ •๋ณด (๋กœ์ปฌ ์บ์‹œ์—์„œ ๋งคํ•‘)
private Long postId;
private Long userId; // ์ž‘์„ฑ์ž ID
private String writerName;
private String writerEmail;

private String content;
private boolean isAccepted; // QnA ์ฑ„ํƒ ์—ฌ๋ถ€
private boolean isAccepted; // ์ฑ„ํƒ ์—ฌ๋ถ€

@JsonIgnore // ๊ณ„์ธต ๊ตฌ์กฐ ์ƒ์„ฑ์šฉ (ํด๋ผ์ด์–ธํŠธ ์‘๋‹ต์—๋Š” ์ œ์™ธ ๊ฐ€๋Šฅ)
private Long parentId;

private LocalDateTime createdAt;
private LocalDateTime lastModifiedAt;

// ๋Œ€๋Œ“๊ธ€ ๋ฆฌ์ŠคํŠธ (๊ณ„์ธตํ˜• ๊ตฌ์กฐ)
private List<CommentResponse> children;
@Builder.Default
private List<CommentResponse> children = new ArrayList<>();

public static CommentResponse from(PostCommentEntity entity) {
return CommentResponse.builder()
.id(entity.getId())
.userId(entity.getUserId())
.content(entity.getContent())
.isAccepted(entity.isAccepted())
.createdAt(entity.getCreatedAt())
.children(new ArrayList<>()) // ์ดˆ๊ธฐํ™”
.build();
// QueryDSL Projections.constructor ์‚ฌ์šฉ์„ ์œ„ํ•œ ์ƒ์„ฑ์ž (children ์ œ์™ธ)
public CommentResponse(Long id, Long postId, Long userId, String writerName, String writerEmail,
String content, boolean isAccepted, Long parentId,
LocalDateTime createdAt, LocalDateTime lastModifiedAt) {
this.id = id;
this.postId = postId;
this.userId = userId;
this.writerName = writerName;
this.writerEmail = writerEmail;
this.content = content;
this.isAccepted = isAccepted;
this.parentId = parentId;
this.createdAt = createdAt;
this.lastModifiedAt = lastModifiedAt;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.example.communityservice.dto.response;

import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.data.domain.Page;

import java.util.List;

@Getter
@NoArgsConstructor
public class CustomPageResponse<T> {
private List<T> content;
private int pageNumber;
private int pageSize;
private long totalElements;
private int totalPages;
private boolean last;

public CustomPageResponse(Page<T> page) {
this.content = page.getContent();
this.pageNumber = page.getNumber();
this.pageSize = page.getSize();
this.totalElements = page.getTotalElements();
this.totalPages = page.getTotalPages();
this.last = page.isLast();
}
}
Loading