-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapi-specification.yaml
More file actions
1058 lines (1013 loc) · 28.9 KB
/
api-specification.yaml
File metadata and controls
1058 lines (1013 loc) · 28.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.3
info:
title: 한국 여행 가이드 API
description: OAuth 기반 인증, AI 채팅, Guest-Guide 매칭을 지원하는 여행 가이드 서비스 (MVP)
version: 2.0.0
contact:
name: 개발팀
email: dev@example.com
servers:
- url: http://localhost:8080
description: 로컬 개발 서버
tags:
- name: auth
description: 인증 및 권한 관리
- name: users
description: 사용자 정보 관리
- name: aichat
description: AI 채팅 도메인
- name: userchat
description: 유저 채팅 도메인 (Guest-Guide)
- name: rate
description: 평가 도메인 (AI 세션 및 가이드 평가)
components:
schemas:
ApiResponse:
type: object
properties:
msg:
type: string
description: 응답 메시지
data:
type: object
description: 응답 데이터
nullable: true
# Auth Schemas
UserRole:
type: string
enum: [USER, ADMIN, GUIDE, PENDING]
description: 사용자 역할
UserRoleUpdateRequest:
type: object
required:
- role
properties:
role:
$ref: "#/components/schemas/UserRole"
LoginResponse:
type: object
properties:
accessToken:
type: string
description: JWT Access Token
AccessTokenResponse:
type: object
properties:
accessToken:
type: string
description: 새로 발급된 JWT Access Token
# User Schemas
User:
type: object
properties:
id:
type: integer
format: int64
description: 사용자 고유 식별자
email:
type: string
format: email
description: 사용자 이메일
nickname:
type: string
description: 사용자 닉네임
profileImageUrl:
type: string
format: uri
nullable: true
description: 프로필 이미지 URL
role:
$ref: "#/components/schemas/UserRole"
location:
type: string
nullable: true
description: 가이드 활동 지역 (GUIDE만)
description:
type: string
nullable: true
description: 사용자 소개글
createdAt:
type: string
format: date-time
description: 가입 일시
lastLoginAt:
type: string
format: date-time
description: 최종 로그인 일시
UserResponse:
type: object
properties:
id:
type: integer
format: int64
email:
type: string
format: email
nickname:
type: string
profileImageUrl:
type: string
format: uri
nullable: true
role:
$ref: "#/components/schemas/UserRole"
UserUpdateRequest:
type: object
properties:
nickname:
type: string
nullable: true
profileImageUrl:
type: string
format: uri
nullable: true
# AI Chat Domain Schemas
SessionsResponse:
type: object
properties:
sessionId:
type: integer
format: int64
description: 세션 고유 식별자
sessionTitle:
type: string
description: 세션 제목
SessionMessagesResponse:
type: object
properties:
content:
type: string
description: 메시지 내용
senderType:
type: string
enum: [USER, AI]
description: 발신자 유형
AiChatResponse:
type: object
properties:
userMessage:
type: string
description: 사용자 메시지 내용
aiMessage:
type: string
description: AI 응답 메시지 내용
UpdateSessionTitleResponse:
type: object
properties:
newTitle:
type: string
description: 수정된 세션 제목
# User Chat Domain Schemas
ChatRoomResponse:
type: object
properties:
id:
type: integer
format: int64
description: 채팅방 고유 식별자
title:
type: string
description: 채팅방 내부 식별용 기본 제목 (Guide-사용자 ID 조합)
displayTitle:
type: string
description: 요청자 기준 상대 닉네임을 포함한 표현용 제목 (예: "홍길동님과의 채팅")
guideId:
type: integer
format: int64
description: 가이드 ID
userId:
type: integer
format: int64
description: 게스트 ID
updatedAt:
type: string
format: date-time
description: 최근 메시지 기준 갱신 시각 (Asia/Seoul)
lastMessageId:
type: integer
format: int64
nullable: true
description: 마지막 메시지 ID (없다면 null)
ChatRoomStartRequest:
type: object
required:
- guideId
- userId
properties:
guideId:
type: integer
format: int64
description: 대화를 시작할 가이드 ID
userId:
type: integer
format: int64
description: 채팅을 요청한 사용자 ID
ChatMessageResponse:
type: object
properties:
id:
type: integer
format: int64
description: 메시지 고유 식별자
roomId:
type: integer
format: int64
description: 채팅방 ID
senderId:
type: integer
format: int64
description: 발신자 ID
content:
type: string
description: 메시지 내용
createdAt:
type: string
format: date-time
description: 메시지 전송 시간 (Asia/Seoul)
ChatMessageSendRequest:
type: object
required:
- content
properties:
content:
type: string
description: 전송할 메시지 내용
# Rating Schemas
RateTargetType:
type: string
enum: [AI_SESSION, GUIDE]
description: 평가 대상 타입
Rate:
type: object
properties:
id:
type: integer
format: int64
description: 평가 고유 식별자
user:
$ref: "#/components/schemas/UserResponse"
description: 평가를 남긴 사용자
targetType:
$ref: "#/components/schemas/RateTargetType"
targetId:
type: integer
format: int64
description: 평가 대상의 ID
rating:
type: integer
minimum: 1
maximum: 5
description: 평점 1-5
comment:
type: string
nullable: true
description: 평가 코멘트
createdAt:
type: string
format: date-time
description: 평가 일시
RateRequest:
type: object
required:
- rating
properties:
rating:
type: integer
minimum: 1
maximum: 5
comment:
type: string
nullable: true
RateResponse:
type: object
properties:
id:
type: integer
format: int64
raterNickname:
type: string
rating:
type: integer
comment:
type: string
nullable: true
createdAt:
type: string
format: date-time
GuideRatingSummaryResponse:
type: object
properties:
averageRating:
type: number
format: double
totalRatings:
type: integer
ratings:
type: array
items:
$ref: "#/components/schemas/RateResponse"
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
security:
- BearerAuth: []
paths:
# ===================
# Auth APIs
# ===================
/api/auth/role:
post:
tags:
- auth
summary: 신규 사용자 역할 선택
description: OAuth 최초 로그인 후, 사용자의 역할을 선택하고 정식으로 가입을 완료합니다.
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserRoleUpdateRequest"
responses:
"200":
description: 역할 선택 및 로그인 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/LoginResponse"
"401":
description: 인증 실패 (유효하지 않은 registerToken)
/api/auth/logout:
post:
tags:
- auth
summary: 로그아웃
description: 현재 사용자의 Access Token을 만료시켜 로그아웃 처리합니다.
security:
- BearerAuth: []
responses:
"200":
description: 로그아웃 성공
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
/api/auth/refresh:
post:
tags:
- auth
summary: Access Token 재발급
description: 쿠키에 담긴 Refresh Token을 사용하여 만료된 Access Token을 재발급합니다.
security: []
responses:
"200":
description: 토큰 재발급 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/AccessTokenResponse"
"401":
description: 유효하지 않은 Refresh Token
# ===================
# User APIs
# ===================
/api/users/me:
get:
tags:
- users
summary: 내 정보 조회
description: 현재 로그인된 사용자의 프로필 정보를 조회합니다.
security:
- BearerAuth: []
responses:
"200":
description: 내 정보 조회 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/UserResponse"
patch:
tags:
- users
summary: 내 프로필 수정
description: 현재 로그인된 사용자의 프로필 정보(닉네임, 프로필 이미지)를 수정합니다.
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserUpdateRequest"
responses:
"200":
description: 프로필 수정 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/UserResponse"
delete:
tags:
- users
summary: 회원 탈퇴
description: 현재 로그인된 사용자 계정을 영구적으로 삭제합니다.
security:
- BearerAuth: []
responses:
"200":
description: 회원 탈퇴 성공
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
# ===================
# AI Chat Domain APIs
# ===================
/api/aichat/sessions:
get:
tags:
- aichat
summary: AI 채팅 세션 목록 조회
description: 사용자의 AI 채팅 세션 목록을 최신순으로 조회
parameters:
- name: userId
in: query
required: true
schema:
type: integer
format: int64
description: 사용자 ID
responses:
"200":
description: 세션 목록 조회 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
type: array
items:
$ref: "#/components/schemas/SessionsResponse"
post:
tags:
- aichat
summary: 새 AI 채팅 세션 생성
description: 새로운 AI 채팅 세션을 생성합니다
parameters:
- name: userId
in: query
required: true
schema:
type: integer
format: int64
description: 사용자 ID
responses:
"200":
description: 세션 생성 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/SessionsResponse"
/api/aichat/sessions/{sessionId}:
delete:
tags:
- aichat
summary: AI 채팅 세션 삭제
description: AI 채팅 세션과 모든 메시지를 영구적으로 삭제합니다
parameters:
- name: sessionId
in: path
required: true
schema:
type: integer
format: int64
description: AI 채팅 세션 ID
- name: userId
in: query
required: true
schema:
type: integer
format: int64
description: 사용자 ID
responses:
"200":
description: 세션 삭제 완료
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
"404":
description: 세션을 찾을 수 없음
/api/aichat/sessions/{sessionId}/messages:
get:
tags:
- aichat
summary: AI 채팅 메시지 조회
description: 특정 AI 채팅 세션의 메시지 이력을 시간순으로 조회
parameters:
- name: sessionId
in: path
required: true
schema:
type: integer
format: int64
description: AI 채팅 세션 ID
- name: userId
in: query
required: true
schema:
type: integer
format: int64
description: 사용자 ID
responses:
"200":
description: 채팅 기록 조회 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
type: array
items:
$ref: "#/components/schemas/SessionMessagesResponse"
post:
tags:
- aichat
summary: AI에게 메시지 전송
description: AI 채팅 세션에 메시지를 전송하고 AI 응답을 받습니다
parameters:
- name: sessionId
in: path
required: true
schema:
type: integer
format: int64
description: AI 채팅 세션 ID
- name: userId
in: query
required: true
schema:
type: integer
format: int64
description: 사용자 ID
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- message
properties:
message:
type: string
description: 사용자 메시지 내용
responses:
"200":
description: 메시지 전송 및 AI 응답 완료
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/AiChatResponse"
/api/aichat/sessions/{sessionId}/title:
patch:
tags:
- aichat
summary: AI 채팅 세션 제목 수정
description: AI 채팅 세션의 제목을 사용자가 직접 수정합니다
parameters:
- name: sessionId
in: path
required: true
schema:
type: integer
format: int64
description: AI 채팅 세션 ID
- name: userId
in: query
required: true
schema:
type: integer
format: int64
description: 사용자 ID
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- newTitle
properties:
newTitle:
type: string
maxLength: 100
description: 새로운 세션 제목
responses:
"200":
description: 제목 수정 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/UpdateSessionTitleResponse"
"404":
description: 세션을 찾을 수 없음
"403":
description: 권한 없음
# ===================
# User Chat Domain APIs
# ===================
/api/userchat/rooms:
get:
tags:
- userchat
summary: 내 채팅방 목록 조회
description: 인증된 사용자가 참여한 채팅방 목록을 최근 업데이트 순으로 돌려줍니다.
security:
- BearerAuth: []
parameters:
- name: limit
in: query
required: false
schema:
type: integer
format: int32
default: 20
minimum: 1
maximum: 100
description: 응답에 포함할 최대 채팅방 수 (기본 20)
- name: cursor
in: query
required: false
schema:
type: string
description: "커서 기반 페이지네이션 포인터. '{updatedAt ISO-8601}|{roomId}' 형식이며 이전 응답의 nextCursor를 그대로 전달합니다."
responses:
"200":
description: 채팅방 목록 조회 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
type: object
properties:
rooms:
type: array
items:
$ref: "#/components/schemas/ChatRoomResponse"
nextCursor:
type: string
nullable: true
description: 다음 페이지 요청 시 사용할 커서 (없으면 null)
/api/userchat/rooms/start:
post:
tags:
- userchat
summary: 1:1 채팅방 생성 또는 재사용
description: 가이드-게스트 조합으로 채팅방을 생성하며, 기존 방이 있으면 재사용합니다.
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ChatRoomStartRequest"
responses:
"200":
description: 채팅방 생성 또는 기존 방 반환
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/ChatRoomResponse"
"403":
description: 인증되지 않은 사용자 또는 참여자가 아닙니다.
/api/userchat/rooms/{roomId}:
get:
tags:
- userchat
summary: 채팅방 단건 조회
description: 채팅방 참여자만 상세 정보를 조회할 수 있습니다.
security:
- BearerAuth: []
parameters:
- name: roomId
in: path
required: true
schema:
type: integer
format: int64
description: 채팅방 ID
responses:
"200":
description: 채팅방 조회 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/ChatRoomResponse"
"403":
description: 채팅방 참여자가 아닙니다.
"404":
description: 채팅방을 찾을 수 없음
delete:
tags:
- userchat
summary: 채팅방 삭제
description: 채팅방과 모든 메시지를 삭제합니다 (생성자만 가능).
security:
- BearerAuth: []
parameters:
- name: roomId
in: path
required: true
schema:
type: integer
format: int64
description: 채팅방 ID
responses:
"200":
description: 채팅방 삭제 완료
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
"403":
description: 채팅방 생성자가 아닙니다.
"404":
description: 채팅방을 찾을 수 없음
/api/userchat/rooms/{roomId}/messages:
get:
tags:
- userchat
summary: 채팅방 메시지 조회
description: 특정 채팅방의 메시지를 시간순으로 가져옵니다.
security:
- BearerAuth: []
parameters:
- name: roomId
in: path
required: true
schema:
type: integer
format: int64
description: 채팅방 ID
- name: after
in: query
required: false
schema:
type: integer
format: int64
description: 해당 메시지 ID 이후의 메시지만 조회
- name: limit
in: query
required: false
schema:
type: integer
format: int32
default: 50
minimum: 1
maximum: 200
description: 최대 조회 건수 (기본 50)
responses:
"200":
description: 메시지 조회 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
type: array
items:
$ref: "#/components/schemas/ChatMessageResponse"
"403":
description: 채팅방 참여자가 아닙니다.
"404":
description: 채팅방을 찾을 수 없음
post:
tags:
- userchat
summary: 채팅방에 메시지 전송
description: 채팅방에 새 메시지를 전송합니다.
security:
- BearerAuth: []
parameters:
- name: roomId
in: path
required: true
schema:
type: integer
format: int64
description: 채팅방 ID
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ChatMessageSendRequest"
responses:
"201":
description: 메시지 전송 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/ChatMessageResponse"
"403":
description: 채팅방 참여자가 아닙니다.
"404":
description: 채팅방을 찾을 수 없음
# ===================
# Rate Domain APIs
# ===================
/api/rate/guides/{guideId}:
put:
tags:
- rate
summary: 가이드 평가 생성/수정
description: 특정 가이드에 대한 평점을 생성하거나 수정합니다. (USER만 가능)
security:
- BearerAuth: []
parameters:
- name: guideId
in: path
required: true
schema:
type: integer
format: int64
description: 평가할 가이드의 ID
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/RateRequest"
responses:
"200":
description: 평가 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/RateResponse"
/api/rate/aichat/sessions/{sessionId}:
put:
tags:
- rate
summary: AI 채팅 세션 평가 생성/수정
description: 특정 AI 채팅 세션에 대한 평가를 생성하거나 수정합니다. (세션 소유자만 가능)
security:
- BearerAuth: []
parameters:
- name: sessionId
in: path
required: true
schema:
type: integer
format: int64
description: 평가할 AI 채팅 세션의 ID
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/RateRequest"
responses:
"200":
description: 평가 성공
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/RateResponse"
/api/rate/guides/my:
get: