Skip to content

Commit 9bbdd53

Browse files
committed
프로젝트 구조 완전 리팩토링: DDD 아키텍처 적용 및 문서화 완료
🏗️ 구조 변경: - DDD(Domain-Driven Design) 아키텍처 적용 - application, domain, infrastructure, common 레이어 분리 - Chat, Weather, Tour, User 도메인별 패키지 구조 📝 문서화: - README.md 완전 재작성 (사용법 가이드 포함) - API 명세서 OpenAPI 3.0.3 형식으로 작성 - ERD 다이어그램 Mermaid로 시각화 ⚙️ 설정 및 공통 기능: - GlobalExceptionHandler 전역 예외 처리 구현 - ApiResponse 통일된 응답 형식 도입 - Swagger UI 2.7.0 추가 - 시스템 프롬프트 yml 설정으로 이동 🛠️ 개발 가이드: - 도메인별 Service/ServiceCore 캐싱 패턴 문서화 - AI Tool 추가 방법 가이드 작성 - RestTemplate 사용법 및 설정 문서화
1 parent 113b46e commit 9bbdd53

Some content is hidden

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

41 files changed

+1755
-896
lines changed

README.md

Lines changed: 254 additions & 233 deletions
Large diffs are not rendered by default.

build.gradle.kts

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ plugins {
66
kotlin("plugin.jpa") version "1.9.25"
77
// ktlint plugin
88
id("org.jlleitschuh.gradle.ktlint") version "12.1.0"
9-
// detekt plugin
10-
id("io.gitlab.arturbosch.detekt") version "1.23.4"
119
}
1210

1311
group = "com.back"
@@ -34,28 +32,25 @@ dependencies {
3432
implementation("org.springframework.boot:spring-boot-starter-security")
3533
implementation("org.springframework.boot:spring-boot-starter-validation")
3634
implementation("org.springframework.boot:spring-boot-starter-web")
37-
implementation("org.springframework.boot:spring-boot-starter-webflux")
3835
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
39-
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
4036
implementation("org.jetbrains.kotlin:kotlin-reflect")
41-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
4237

4338
// Spring AI
4439
implementation("org.springframework.ai:spring-ai-starter-model-openai")
4540

4641
// XML parsing for weather API
4742
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
48-
implementation("org.springframework:spring-webflux")
4943
implementation("com.fasterxml.jackson.module:jackson-module-jaxb-annotations")
5044

5145
// Dotenv for environment variables
5246
implementation("io.github.cdimascio:dotenv-kotlin:6.4.1")
47+
48+
// Swagger UI for API documentation
49+
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0")
5350

5451
runtimeOnly("com.h2database:h2")
5552
testImplementation("org.springframework.boot:spring-boot-starter-test")
56-
testImplementation("io.projectreactor:reactor-test")
5753
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
58-
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test")
5954
testImplementation("org.springframework.security:spring-security-test")
6055
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
6156
}
@@ -99,21 +94,3 @@ ktlint {
9994
}
10095
}
10196

102-
// detekt configuration
103-
detekt {
104-
config = files(".config/detekt/detekt.yml") // detekt 설정 파일 필요 (선택사항)
105-
buildUponDefaultConfig = true
106-
allRules = false
107-
ignoreFailures = false
108-
parallel = true
109-
autoCorrect = true // detekt가 일부 문제를 자동 수정하도록 허용
110-
}
111-
112-
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
113-
reports {
114-
html.required.set(true)
115-
xml.required.set(true)
116-
txt.required.set(true)
117-
sarif.required.set(true)
118-
}
119-
}

docs/api-specification.yaml

Lines changed: 293 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,293 @@
1+
openapi: 3.0.3
2+
info:
3+
title: 한국 여행 가이드 API
4+
description: Spring AI 기반 한국 여행 가이드 챗봇 서비스
5+
version: 1.0.0
6+
contact:
7+
name: 개발팀
8+
9+
10+
servers:
11+
- url: http://localhost:8080
12+
description: 로컬 개발 서버
13+
14+
tags:
15+
- name: users
16+
description: 사용자 관리
17+
- name: chats
18+
description: 채팅 관리
19+
20+
components:
21+
schemas:
22+
ApiResponse:
23+
type: object
24+
properties:
25+
msg:
26+
type: string
27+
description: 응답 메시지
28+
data:
29+
type: object
30+
description: 응답 데이터
31+
32+
User:
33+
type: object
34+
properties:
35+
userId:
36+
type: integer
37+
format: int64
38+
username:
39+
type: string
40+
nickname:
41+
type: string
42+
email:
43+
type: string
44+
format: email
45+
profileImage:
46+
type: string
47+
format: uri
48+
createdAt:
49+
type: string
50+
format: date-time
51+
52+
ChatSession:
53+
type: object
54+
properties:
55+
sessionId:
56+
type: integer
57+
format: int64
58+
title:
59+
type: string
60+
createdAt:
61+
type: string
62+
format: date-time
63+
updatedAt:
64+
type: string
65+
format: date-time
66+
messageCount:
67+
type: integer
68+
69+
ChatMessage:
70+
type: object
71+
properties:
72+
messageId:
73+
type: integer
74+
format: int64
75+
content:
76+
type: string
77+
role:
78+
type: string
79+
enum: [user, assistant]
80+
createdAt:
81+
type: string
82+
format: date-time
83+
84+
securitySchemes:
85+
BearerAuth:
86+
type: http
87+
scheme: bearer
88+
bearerFormat: JWT
89+
90+
security:
91+
- BearerAuth: []
92+
93+
paths:
94+
/api/users/oauth/login:
95+
post:
96+
tags:
97+
- users
98+
summary: OAuth 로그인
99+
requestBody:
100+
required: true
101+
content:
102+
application/json:
103+
schema:
104+
type: object
105+
properties:
106+
provider:
107+
type: string
108+
enum: [google, kakao, naver]
109+
code:
110+
type: string
111+
responses:
112+
'200':
113+
description: 로그인 성공
114+
content:
115+
application/json:
116+
schema:
117+
allOf:
118+
- $ref: '#/components/schemas/ApiResponse'
119+
- type: object
120+
properties:
121+
data:
122+
allOf:
123+
- $ref: '#/components/schemas/User'
124+
- type: object
125+
properties:
126+
token:
127+
type: string
128+
'400':
129+
description: 잘못된 요청
130+
131+
/api/users/logout:
132+
post:
133+
tags:
134+
- users
135+
summary: 로그아웃
136+
responses:
137+
'200':
138+
description: 로그아웃 완료
139+
content:
140+
application/json:
141+
schema:
142+
$ref: '#/components/schemas/ApiResponse'
143+
144+
/api/users/withdrawal:
145+
delete:
146+
tags:
147+
- users
148+
summary: 회원탈퇴
149+
responses:
150+
'200':
151+
description: 회원탈퇴 완료
152+
content:
153+
application/json:
154+
schema:
155+
$ref: '#/components/schemas/ApiResponse'
156+
157+
/api/users/profile:
158+
get:
159+
tags:
160+
- users
161+
summary: 프로필 조회
162+
responses:
163+
'200':
164+
description: 프로필 조회 성공
165+
content:
166+
application/json:
167+
schema:
168+
allOf:
169+
- $ref: '#/components/schemas/ApiResponse'
170+
- type: object
171+
properties:
172+
data:
173+
$ref: '#/components/schemas/User'
174+
175+
/api/chats/sessions:
176+
get:
177+
tags:
178+
- chats
179+
summary: 채팅 세션 목록 조회
180+
responses:
181+
'200':
182+
description: 세션 목록 조회 성공
183+
content:
184+
application/json:
185+
schema:
186+
allOf:
187+
- $ref: '#/components/schemas/ApiResponse'
188+
- type: object
189+
properties:
190+
data:
191+
type: array
192+
items:
193+
$ref: '#/components/schemas/ChatSession'
194+
195+
post:
196+
tags:
197+
- chats
198+
summary: 새 채팅 세션 생성
199+
requestBody:
200+
content:
201+
application/json:
202+
schema:
203+
type: object
204+
properties:
205+
title:
206+
type: string
207+
description: 세션 제목 (선택사항)
208+
responses:
209+
'201':
210+
description: 세션 생성 성공
211+
content:
212+
application/json:
213+
schema:
214+
allOf:
215+
- $ref: '#/components/schemas/ApiResponse'
216+
- type: object
217+
properties:
218+
data:
219+
$ref: '#/components/schemas/ChatSession'
220+
221+
/api/chats/sessions/{sessionId}/messages:
222+
get:
223+
tags:
224+
- chats
225+
summary: 채팅 기록 조회
226+
parameters:
227+
- name: sessionId
228+
in: path
229+
required: true
230+
schema:
231+
type: integer
232+
format: int64
233+
responses:
234+
'200':
235+
description: 채팅 기록 조회 성공
236+
content:
237+
application/json:
238+
schema:
239+
allOf:
240+
- $ref: '#/components/schemas/ApiResponse'
241+
- type: object
242+
properties:
243+
data:
244+
type: object
245+
properties:
246+
sessionId:
247+
type: integer
248+
format: int64
249+
title:
250+
type: string
251+
messages:
252+
type: array
253+
items:
254+
$ref: '#/components/schemas/ChatMessage'
255+
256+
post:
257+
tags:
258+
- chats
259+
summary: 메시지 전송 및 AI 응답
260+
parameters:
261+
- name: sessionId
262+
in: path
263+
required: true
264+
schema:
265+
type: integer
266+
format: int64
267+
requestBody:
268+
required: true
269+
content:
270+
application/json:
271+
schema:
272+
type: object
273+
properties:
274+
content:
275+
type: string
276+
description: 사용자 메시지
277+
responses:
278+
'200':
279+
description: 메시지 전송 완료
280+
content:
281+
application/json:
282+
schema:
283+
allOf:
284+
- $ref: '#/components/schemas/ApiResponse'
285+
- type: object
286+
properties:
287+
data:
288+
type: object
289+
properties:
290+
userMessage:
291+
$ref: '#/components/schemas/ChatMessage'
292+
assistantMessage:
293+
$ref: '#/components/schemas/ChatMessage'

0 commit comments

Comments
 (0)