Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syn #183

Merged
merged 209 commits into from
Jun 18, 2024
Merged

syn #183

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
209 commits
Select commit Hold shift + click to select a range
c54c85b
feat: 프로필 수정 요청 dto에 필드 추가
minahYu May 23, 2024
0c8fd42
feat: 프로필 수정 응답 dto에 필드 추가
minahYu May 23, 2024
7d66b16
feat: 이메일, 닉네임, 비밀번호 수정 기능 구현
minahYu May 23, 2024
f639497
feat: 코드 중복으로 인해 getUser 메서드 추가
minahYu May 23, 2024
d6f73f3
feat: application.yml에 프로필사진 저장 디렉토리 경로 추가
minahYu May 23, 2024
db5af5a
feat: 이미지 파일 확장자가 지원되지 않는 경우에 대한 예외 처리 추가
minahYu May 23, 2024
26c804b
feat: 프로필 이미지 저장 기능 구현
minahYu May 23, 2024
7c7f1d5
feat: generateUniqueFileName 메서드 추가
minahYu May 23, 2024
41b33ec
feat: 파일명 DB에 업데이트 후, 이전 프로필 이미지 삭제 기능 구현
minahYu May 23, 2024
ea2fb3f
refac: 지원하는 확장자인지 확인하는 부분 코드 수정
minahYu May 24, 2024
f734615
Merge branch 'main' into feat/update-profile
minahYu May 28, 2024
c042c16
test: 프로필 수정 관련 테스트 코드 오류 해결
minahYu May 28, 2024
f14fe68
refac: 프로필 이미지 업로드 부분 클래스 분리
minahYu May 28, 2024
9ed564f
Merge branch 'main' into feat/update-profile
minahYu May 29, 2024
50fbd8b
feat: 프로필 수정 요청에 대한 유효성검사 로직 추가
minahYu May 29, 2024
7d7cc9b
chore: db setting과 properties application.yml에 추가
minisundev Jun 3, 2024
0f52c3d
chore: build.gradle에 redis 추가
minisundev Jun 3, 2024
9a93d03
feat: getChatRoomInvitation Controller Layer 구현
minisundev Jun 3, 2024
edd40ed
feat: getChatRoomInvitation Service Layer 구현
minisundev Jun 3, 2024
66ffbc6
feat: ErrorCode 추가
minisundev Jun 3, 2024
b0b114c
feat: UserChatRoomInvitationRepository 생성
minisundev Jun 3, 2024
5b70b4b
feat: UserChatRoomInvitationRepository에 setInvitation, getInvitation …
minisundev Jun 3, 2024
9826a24
feat: InvitationChatRoomRepository 생성
minisundev Jun 3, 2024
0a934ba
feat: InvitationChatRoomRepository에 setInvitationLink 메서드 구현
minisundev Jun 3, 2024
7dfae34
feat: InvitationResponse DTO 생성
minisundev Jun 3, 2024
a5a16e1
feat: PropertyConfig 생성
minisundev Jun 3, 2024
d67ff43
feat: RedisConfig 생성
minisundev Jun 3, 2024
18b7f84
chore: Redis docker image 설정
minisundev Jun 3, 2024
47038d4
feat: ChatRoomControllerTest에 getChatRoomInvitation api testcode 작성
minisundev Jun 3, 2024
a9c1453
refac: 추가된 repository 테스트코드에 반영
minisundev Jun 3, 2024
406d11d
refac: 메서드,필드 이름 link,key 에서 code로 통일
minisundev Jun 3, 2024
a797346
refac: 불필요한 메서드 삭제
minisundev Jun 3, 2024
7ecfec9
refac: 불필요한 ErrorCode 삭제
minisundev Jun 3, 2024
46e80af
refac: 서비스 로직 repository에서 service로 옮기고 return type이 ResponseDTO가 아니게 변경
minisundev Jun 4, 2024
048d997
fix: 충돌 해결
minahYu Jun 5, 2024
99bf611
Header 부분 충돌 해결
jihyun-j Jun 5, 2024
18b7cb6
rename: userChatRoomInvitationRepository를 InvitationRepository로 변경
minisundev Jun 5, 2024
ac747fb
remove: InvitationChatRoomRepository 삭제
minisundev Jun 5, 2024
18c44ef
feat: invitation 정보들을 인코딩해서 코드 생성하는 method 구현
minisundev Jun 5, 2024
ee2e953
[refec] 모달창 컴포넌트화 모달창 토글 커스텀 훅으로 관리
jihyun-j Jun 5, 2024
a45b609
[feat] server form작성
jihyun-j Jun 5, 2024
f6238fd
chore : docker hub auth application 연동
yudonggeun Jun 5, 2024
dbef416
chore : docker hub server application 연동
yudonggeun Jun 5, 2024
faee0e7
chore : docker hub user application 연동
yudonggeun Jun 5, 2024
885ab8a
Merge pull request #157 from yudonggeun/chore/docker-hub
yudonggeun Jun 5, 2024
1854afd
fix: getExpire를 하기 위한 key 수정
minisundev Jun 5, 2024
6020df3
refac: InvitationResponse에서 expiration 삭제
minisundev Jun 5, 2024
2383b40
rename: ChatRoomProperty로 이름 변경
minisundev Jun 5, 2024
be2f961
refac: 테스트코드에 변경사항 반영
minisundev Jun 5, 2024
640d3ac
style: 코드 정렬
minisundev Jun 5, 2024
7804e42
feat: InvitationService 생성
minisundev Jun 6, 2024
0449e6f
refac: InvitationRepository의 재사용 불가능한 로직 InvitationService로 분리
minisundev Jun 6, 2024
df2ecfd
refac: InvitationRepository대신 InvitationService 사용
minisundev Jun 6, 2024
c583e10
chore: 변경된 dependency ChatRoomServiceTest에 반영
minisundev Jun 6, 2024
84a0079
Delete infra/Chart.lock
jihyun-j Jun 7, 2024
f2732db
Chart.lock 파일 .gitignore에 추가
jihyun-j Jun 7, 2024
dc44751
Merge pull request #158 from jihyun-j/feat/server
yewon830 Jun 7, 2024
57d3930
Merge branch 'dev' of https://github.com/minahYu/kpring into dev
minahYu Jun 7, 2024
f26e8c3
[refec] 서버카드 관련 타입파일 정리
jihyun-j Jun 7, 2024
a53ce3d
[feat] 왼쪽 사이드바 유저 아이콘 추가
jihyun-j Jun 7, 2024
c14cc82
bug : mongodb username 환경 변수 매칭 버그 수정
yudonggeun Jun 7, 2024
cd45639
bug : server 생성시 serverProfileEntity id가 "test"로 고정되는 버그 수정
yudonggeun Jun 7, 2024
32571bd
feat : 화면 공유 WebRtc 컴포넌트 UI 제작
yewon830 Jun 7, 2024
270e061
remove : 깃 문제로 없어져야 하는 파일이 존재해서 삭제
yewon830 Jun 8, 2024
1df0e97
[feat] 캐릭터 말풍선 추가
jihyun-j Jun 8, 2024
7f9711c
refac: 미디어타입 enum으로 변경
minahYu Jun 8, 2024
127fb89
remove: 불필요한 코드 삭제
minahYu Jun 8, 2024
1012b08
chore: 이미지 저장 경로 변경
minahYu Jun 8, 2024
79a0742
refac: 에러메시지 한국어로 변경
minahYu Jun 8, 2024
672833e
refac: System.getProperty 필드로 분리
minahYu Jun 8, 2024
b2c771c
Merge pull request #161 from yewon830/feat/share-webcam
jihyun-j Jun 9, 2024
f806f10
fix: UserServiceTest 수정하여 테스트 에러 해결
minahYu Jun 9, 2024
685bbbe
Merge branch 'dev' of https://github.com/kSideProject/kpring into fea…
minahYu Jun 9, 2024
1dfc13c
Merge branch 'dev' into feat/create-server
jihyun-j Jun 10, 2024
cdd69f3
Merge pull request #162 from jihyun-j/feat/create-server
jihyun-j Jun 10, 2024
dde725d
refac: getOrCreateInvitation 메서드 삭제하고 getChatRoomInvitation으로 로직 이동
minisundev Jun 10, 2024
15fa38f
feat: Chat model으로 ServerChat과 RoomChat 통합
minisundev Jun 10, 2024
24f64a3
refac: Chat model으로 ServerChat과 RoomChat 통합
minisundev Jun 10, 2024
868210f
refac: Chat model으로 ServerChat과 RoomChat 통합
minisundev Jun 10, 2024
3485157
refac: RoomChatRepository가 RoomChat대신 Chat을 저장하도록 변경
minisundev Jun 10, 2024
44957fa
refac: ServerChatRepository가 ServerChat대신 Chat을 저장하도록 변경
minisundev Jun 10, 2024
9b2090a
remove: RoomChat 삭제
minisundev Jun 10, 2024
e974fa2
remove: ServerChat 삭제
minisundev Jun 10, 2024
1a0e342
refac: RoomChat을 Chat으로 변경
minisundev Jun 10, 2024
5e7bc7f
Merge pull request #160 from yudonggeun/bug/mongo-connect-fail
yudonggeun Jun 10, 2024
90df7ba
Merge pull request #156 from minahYu/feat/update-profile
minahYu Jun 10, 2024
c91dfef
Merge branch 'dev' of https://github.com/kSideProject/kpring into dev
minahYu Jun 10, 2024
712ea7b
Merge pull request #149 from minisundev/feat/invite-to-chatroom-with-…
minisundev Jun 10, 2024
1a8ef8d
feat: Chat에 verifyAccess 메서드 구현
minisundev Jun 10, 2024
9a0f861
feat: updateChat Controller Layer 구현
minisundev Jun 10, 2024
c638d6b
feat: updateRoomChat,updateServerChat ChatService에 구현
minisundev Jun 10, 2024
fcafda7
feat: CHAT_NOT_FOUND ErrorCode 정의
minisundev Jun 10, 2024
1865a58
feat: UpdateChatRequest 생성
minisundev Jun 10, 2024
5e609fe
feat: MongoAuditing 적용
minisundev Jun 10, 2024
a9a6756
chore: MongoAuditing 적용하기 위한 설정 추가
minisundev Jun 10, 2024
8c823ba
chore: 사용자 인증 및 권한 검증하는 로직 분리
minahYu Jun 10, 2024
a5c191c
chore: FriendService 자바에서 코틀린 파일로 변경
minahYu Jun 10, 2024
9730302
feat: updateChat 테스트코드 작성
minisundev Jun 10, 2024
3aa0306
feat: updateChat 테스트코드 작성
minisundev Jun 10, 2024
7124224
feat: FriendController 에 사용자 인증 및 권한 검증 기능 추가
minahYu Jun 10, 2024
39ff4bf
Merge branch 'dev' into feat/edit-chat
minisundev Jun 10, 2024
854b848
feat: 친구신청 상태를 정의하는 FriendRequestStatus enum클래스 추가
minahYu Jun 10, 2024
623896b
feat: 친구신청 관련 에러코드 추가
minahYu Jun 10, 2024
c9e40d6
feat: Friend 엔티티 생성
minahYu Jun 10, 2024
1a3f132
feat: Friend 레포지토리 생성
minahYu Jun 10, 2024
3171bc7
feat: User 엔티티에 친구관계 생성하는 코드 추가
minahYu Jun 10, 2024
afd73a7
feat: FriendServiceImpl에 친구신청 기능 구현
minahYu Jun 10, 2024
abc4fa4
chore: 테스트에서 mongoAuditing을 이용하기 위한 설정 추가
minisundev Jun 10, 2024
0ed93d7
feat: 테스트에서 mongoAuditing을 이용하기 위해 TestMongoConfig 생성
minisundev Jun 10, 2024
51275cc
feat: 테스트에서 mongoAuditing을 이용하기 위해 TestMongoConfig ChatControllerTest…
minisundev Jun 10, 2024
b39fdcc
Merge remote-tracking branch 'origin/feat/edit-chat' into feat/edit-chat
minisundev Jun 10, 2024
ee82aa1
fix: 잘못 병합된 파일 수정
minisundev Jun 10, 2024
d91e903
feat: ChatRoomControllerTest에 MongoConfig Import
minisundev Jun 10, 2024
a4c6128
test: AuthValidator 로 인한 테스트 코드 수정
minahYu Jun 10, 2024
2515402
feat : category 목록 조회 api 구현
yudonggeun Jun 11, 2024
b4d7261
feat : WebTestClient 설정 공통화
yudonggeun Jun 11, 2024
14d85f2
fix : Mvc 이름 추가
yudonggeun Jun 11, 2024
3c6a94a
test : 카테고리 조회 api 성공 테스트
yudonggeun Jun 11, 2024
5252289
feat : 카테고리 domain 생성
yudonggeun Jun 11, 2024
df0eee3
feat : 카테코리 서비스 구현
yudonggeun Jun 11, 2024
775e575
fix : MvcWebTestClientDescribeSpec 테스트 실행 실패 수정
yudonggeun Jun 11, 2024
9b30e85
refac: 불필요한 예외케이스 발생 삭제
minisundev Jun 11, 2024
ef2d895
test: CommonTest 생성
minahYu Jun 11, 2024
fce76ee
test: 친구신청 controller 테스트코드 작성
minahYu Jun 11, 2024
12450ff
test: 친구신청 service 테스트코드 작성
minahYu Jun 11, 2024
8c75710
refac: verifyAccess Service Layer로 이동
minisundev Jun 11, 2024
4957831
feat: verifyIfAuthor 메서드 구현
minisundev Jun 11, 2024
a001c3b
Merge branch 'dev' of https://github.com/kSideProject/kpring into dev
minahYu Jun 11, 2024
0a043bd
test : 빈 생성 실패로 인한 테스트 실패 해결
yudonggeun Jun 11, 2024
66da52c
Merge pull request #167 from yudonggeun/feat/get-category
yudonggeun Jun 11, 2024
237d318
feat : 서버 생성시 theme, userId, category 정보를 포함하도록 기능 추가
yudonggeun Jun 12, 2024
236fc14
feat : 서버 생성 userId validate 로직 구현
yudonggeun Jun 12, 2024
671fbb3
refactor : CreateServerUseCase 인터페이스 개선
yudonggeun Jun 12, 2024
2cfe61b
refactor : entity 클래스 구조 개선
yudonggeun Jun 12, 2024
36bd40f
test : entity 변경으로 인한 테스트 수정
yudonggeun Jun 12, 2024
0fc454c
feat : 서버 생성 응답 스키마 추가 확장(theme, category)
yudonggeun Jun 12, 2024
d41c13a
Merge branch 'dev' of https://github.com/kSideProject/kpring into dev
minahYu Jun 12, 2024
b99176d
refac: checkIfAccessTokenAndGetUserId 메서드 check, get 기능 분리
minahYu Jun 12, 2024
a88474e
chore: 상태별 주석 추가
minahYu Jun 12, 2024
e101402
refac: 접근제어자 변경
minahYu Jun 12, 2024
fae8c95
refac: 친구신청 및 신청받는 로직 분리
minahYu Jun 12, 2024
e3a461d
test: 테스트 오류 해결
minahYu Jun 12, 2024
ccb819b
test: 테스트 오류 해결
minahYu Jun 12, 2024
db6b0d3
Merge pull request #166 from minisundev/feat/edit-chat
minisundev Jun 12, 2024
f387b32
feat: verifyIfAuthor 메서드 private으로 변경
minisundev Jun 12, 2024
63fee2d
feat: deleteChat Controller Layer에 구현
minisundev Jun 12, 2024
ee3166e
feat: deleteRoomChat, deleteServerChat Service Layer에 구현
minisundev Jun 12, 2024
1a04e1c
feat: CreateChatRoomRequest의 var을 val로 수정
minisundev Jun 12, 2024
b6b2fe9
feat: ChatRoom에 NoArg설정
minisundev Jun 12, 2024
47c30bc
feat: ChatControllerTest에 deleteChat 테스트코드 작성
minisundev Jun 12, 2024
d56ef01
feat: ChatServiceTest에 deleteRoomChat,deleteServerChat 테스트코드 작성
minisundev Jun 12, 2024
2b370df
refac: Service Layer에서만 사용하는 메서드 private 처리
minisundev Jun 14, 2024
bd82c2e
Merge pull request #168 from minahYu/feat/add-friend
minahYu Jun 14, 2024
6e61306
Merge branch 'dev' of https://github.com/kSideProject/kpring into dev
minahYu Jun 14, 2024
8347daf
chore: 응답 dto 디렉토리명 response로 변경
minahYu Jun 14, 2024
a2da747
feat: GetFriendRequestResponse 생성
minahYu Jun 14, 2024
1bbcbd0
feat: GetFriendRequestsResponse 생성
minahYu Jun 14, 2024
db0117c
feat: FriendController에 친구신청 조회 메서드 추가
minahYu Jun 14, 2024
8640c9d
feat: FriendRepository에 findAllByUserIdAndRequestStatus 메서드 추가
minahYu Jun 14, 2024
08effd9
feat: FriendServiceImpl에 getFriendRequests 메서드 추가
minahYu Jun 14, 2024
419bf37
test: FriendControllerTest에 친구신청 조회 관련 테스트 코드 추가
minahYu Jun 14, 2024
1763648
test: FriendServiceImplTest에 친구신청 조회 관련 테스트 코드 추가
minahYu Jun 14, 2024
7f3cf3d
feat : webRtc 설정 툴바 UI 구현
yewon830 Jun 9, 2024
d9a26c4
feat : 웹 RTC 화면공유 기능(유저 구별x) 구현
yewon830 Jun 10, 2024
b7e5f29
style : tailwind 사용-> MUI sx 속성으로 변경
yewon830 Jun 14, 2024
63bb5ec
refac: members List에서 Set으로 변경
minisundev Jun 14, 2024
3c2bdbc
feat: ChatRoom에 addUser 메서드 구현
minisundev Jun 14, 2024
b639231
feat: ChatRoomController에 joinChatRoom 메서드 구현
minisundev Jun 14, 2024
d026d16
feat: ChatRoomService에 verifyInvitationExistence 메서드 구현
minisundev Jun 14, 2024
c8c3744
feat: ChatRoomService에 joinChatRoom 메서드 구현
minisundev Jun 14, 2024
580d5f1
feat: EXPIRED_INVITATION 에러코드 정의
minisundev Jun 14, 2024
6fc3b9e
feat: InvitationInfo DTO 정의
minisundev Jun 14, 2024
01ebfe9
feat: InvitationService에 decodeCode, getInvitationInfoFromCode 메서드 정의
minisundev Jun 14, 2024
0ffce0c
refac: String으로 받던 type parameter ChatType enum으로 변경
minisundev Jun 15, 2024
8f8031f
refac: 검증 부분 //Then 후로 이동
minisundev Jun 15, 2024
b37dddf
refac: returns Unit 대신 just Runs 사용해서 가독성 높임
minisundev Jun 15, 2024
505538b
Merge pull request #169 from yudonggeun/feat/create-server
yudonggeun Jun 16, 2024
7c84e7f
Merge pull request #171 from minisundev/feat/delete-chat
minisundev Jun 16, 2024
3d1c813
refac: id,members var에서 val로 변경
minisundev Jun 17, 2024
3b71575
refac: createChatRoom 메서드에서 Chat생성시 members에 요청하는 user의 id가 포함되게 수정
minisundev Jun 17, 2024
3cc8250
refac: ChatRoomServiceTest에 수정 사항 반영
minisundev Jun 17, 2024
ab1af19
refac: SampleTest에 수정 사항 반영
minisundev Jun 17, 2024
97bfc37
refac: Chat의 id var에서 val로 변경
minisundev Jun 17, 2024
25bb6a4
refac: ChatServiceTest에 수정 사항 반영
minisundev Jun 17, 2024
d7e010d
refac: code를 decode하는 메서드 private으로 변경
minisundev Jun 17, 2024
938d53b
refac: getInvitationInfoFromCode 메서드에 가독성을 위해 주석 추가
minisundev Jun 17, 2024
7098290
chore : platform 설정 추가
yudonggeun Jun 17, 2024
90051da
chore : cluster domain 변경
yudonggeun Jun 17, 2024
d88ef66
chore : 개발환경을 위한 docker compose swagger 설정 추가
yudonggeun Jun 17, 2024
031cf0f
chore : k8s swagger 서비스 제거
yudonggeun Jun 17, 2024
b2cce9c
feat: joinChatRoom Controller Layer 테스트코드 작성
minisundev Jun 17, 2024
16f9690
Merge branch 'dev' into feat/join-chatroom-with-code
minisundev Jun 17, 2024
2bafdbc
Merge pull request #175 from yewon830/feat/share-webcam
yewon830 Jun 17, 2024
62b9e32
chore : hostname 설정
yudonggeun Jun 17, 2024
7db9453
refac: ChatServiceTest에 Chat 수정사항 반영
minisundev Jun 17, 2024
58df014
Merge pull request #176 from minisundev/feat/join-chatroom-with-code
minisundev Jun 17, 2024
f1df7b4
Merge pull request #179 from yudonggeun/chore/platform
yudonggeun Jun 17, 2024
f29cead
chore : docker compose ip 변경 적용
yudonggeun Jun 17, 2024
c62fda8
Merge pull request #181 from yudonggeun/chore/infra-docker-compose
yudonggeun Jun 17, 2024
7d3e844
chore : github actions ci job 추가
yudonggeun Jun 18, 2024
2aa1d55
chore : 이미지 변경 추적을 위한 tag 설정
yudonggeun Jun 18, 2024
eaebb81
chore: git commit hash를 통한 버전 관리 설정 추가
yudonggeun Jun 18, 2024
4eb830c
chore : ip -> hostname으로 변경
yudonggeun Jun 18, 2024
68382ff
chore : main push시에 ci 작업이 작동하도록 변경
yudonggeun Jun 18, 2024
c3d218a
refac: friendRequests immutable 한 타입으로 변경
minahYu Jun 18, 2024
e4ee4fa
refac: 가독성을 위해 stream api로 변환
minahYu Jun 18, 2024
45630c4
Merge pull request #174 from minahYu/feat/get-friend-requests
minahYu Jun 18, 2024
3627418
docs : 주석 수정
yudonggeun Jun 18, 2024
12f7acf
Merge pull request #182 from yudonggeun/chore/cd-actions
yudonggeun Jun 18, 2024
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
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
push:
branches: [ main ] # push 되었을 때, 실행

jobs:
cd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# jdk 21 환경 구성
- name: set up jdk 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'

# Gradle wrapper 파일 실행 권한주기
- name: Grant execute permission for gradlew
run: chmod +x gradlew

# Gradle jib를 통한 이미지 배포
- name: update image using jib
run: ./gradlew --info jib
14 changes: 11 additions & 3 deletions auth/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ tasks.asciidoctor {
dependsOn(tasks.test)
}

val hostname = "kpring.duckdns.org"

openapi3 {
setServer("http://localhost/auth")
setServer("http://$hostname/auth")
title = "Auth API"
description = "API document"
version = "0.1.0"
Expand All @@ -82,11 +84,17 @@ openapi3 {
jib {
from {
image = "eclipse-temurin:21-jre"
platforms {
platform {
architecture = "arm64"
os = "linux"
}
}
}
to {
image = "localhost:5000/auth-application"
image = "youdong98/kpring-auth-application"
setAllowInsecureRegistries(true)
tags = setOf("latest")
tags = setOf("latest", version.toString())
}
container {
jvmFlags = listOf("-Xms512m", "-Xmx512m")
Expand Down
25 changes: 24 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.springframework.boot.gradle.tasks.bundling.BootJar
import java.io.IOException

plugins {
id("org.springframework.boot") version "3.2.4"
Expand All @@ -17,7 +18,7 @@ repositories {

allprojects {
group = "com.sideproject"
version = "0.0.1-SNAPSHOT"
version = "git rev-parse --short=8 HEAD".runCommand(workingDir = rootDir)

repositories {
mavenCentral()
Expand Down Expand Up @@ -53,3 +54,25 @@ subprojects {
debug.set(true)
}
}

/**
* cli 실행 결과를 반환한기 위한 함수
*/
fun String.runCommand(
workingDir: File = File("."),
timeoutAmount: Long = 60,
timeoutUnit: TimeUnit = TimeUnit.SECONDS,
): String =
ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`])[^'\"`]*\\1)*[^'\"`]*$)".toRegex()))
.directory(workingDir)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)
.start()
.apply { waitFor(timeoutAmount, timeoutUnit) }
.run {
val error = errorStream.bufferedReader().readText().trim()
if (error.isNotEmpty()) {
throw IOException(error)
}
inputStream.bufferedReader().readText().trim()
}
3 changes: 3 additions & 0 deletions chat/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ dependencies {
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")

// non-blocking redis
implementation("org.springframework.boot:spring-boot-starter-data-redis")

// test
testImplementation(project(":test"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
Expand Down
17 changes: 13 additions & 4 deletions chat/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ services:
image: mongo:latest
container_name: mongo
ports:
- "27017:27017"
- "27018:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: 58155815
MONGO_INITDB_DATABASE: mongodb
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: testpassword1234
MONGO_INITDB_DATABASE: mongodb

redis:
image: redis:alpine
container_name: redis_link
ports:
- "6379:6379"
environment:
- REDIS_PASSWORD = "testpassword1234"
command: [ "redis-server","--requirepass","${REDIS_PASSWORD}" ]
2 changes: 2 additions & 0 deletions chat/src/main/kotlin/kpring/chat/ChatApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package kpring.chat

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.data.mongodb.config.EnableMongoAuditing

@EnableMongoAuditing
@SpringBootApplication
class ChatApplication

Expand Down
41 changes: 35 additions & 6 deletions chat/src/main/kotlin/kpring/chat/chat/api/v1/ChatController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import kpring.chat.global.exception.GlobalException
import kpring.core.auth.client.AuthClient
import kpring.core.chat.chat.dto.request.ChatType
import kpring.core.chat.chat.dto.request.CreateChatRequest
import kpring.core.chat.chat.dto.request.UpdateChatRequest
import kpring.core.global.dto.response.ApiResponse
import kpring.core.server.client.ServerClient
import kpring.core.server.dto.request.GetServerCondition
Expand All @@ -18,8 +19,8 @@ import org.springframework.web.bind.annotation.*
@RequestMapping("/api/v1")
class ChatController(
private val chatService: ChatService,
val authClient: AuthClient,
val serverClient: ServerClient,
private val authClient: AuthClient,
private val serverClient: ServerClient,
) {
@PostMapping("/chat")
fun createChat(
Expand All @@ -39,24 +40,52 @@ class ChatController(

@GetMapping("/chat")
fun getChats(
@RequestParam("type") type: String,
@RequestParam("type") type: ChatType,
@RequestParam("id") id: String,
@RequestParam("page") page: Int,
@RequestHeader("Authorization") token: String,
): ResponseEntity<*> {
val userId = authClient.getTokenInfo(token).data!!.userId
val result =
when (type) {
ChatType.Room.toString() -> chatService.getRoomChats(id, userId, page)
ChatType.Server.toString() ->
ChatType.Room -> chatService.getRoomChats(id, userId, page)
ChatType.Server ->
chatService.getServerChats(
id,
userId,
page,
serverClient.getServerList(token, GetServerCondition()).body!!.data!!,
)
else -> throw GlobalException(ErrorCode.INVALID_CHAT_TYPE)
}
return ResponseEntity.ok().body(ApiResponse(data = result, status = 200))
}

@PatchMapping("/chat")
fun updateChat(
@Validated @RequestBody request: UpdateChatRequest,
@RequestHeader("Authorization") token: String,
): ResponseEntity<*> {
val userId = authClient.getTokenInfo(token).data!!.userId
val result =
when (request.type) {
ChatType.Room -> chatService.updateRoomChat(request, userId)
ChatType.Server -> chatService.updateServerChat(request, userId)
}
return ResponseEntity.ok().body(ApiResponse<Nothing>(status = 200))
}

@DeleteMapping("/chat/{chatId}")
fun deleteChat(
@RequestParam("type") type: ChatType,
@PathVariable("chatId") chatId: String,
@RequestHeader("Authorization") token: String,
): ResponseEntity<*> {
val userId = authClient.getTokenInfo(token).data!!.userId
val result =
when (type) {
ChatType.Room -> chatService.deleteRoomChat(chatId, userId)
ChatType.Server -> chatService.deleteServerChat(chatId, userId)
}
return ResponseEntity.ok().body(ApiResponse<Nothing>(status = 200))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ import org.springframework.data.mongodb.core.mapping.Document

@NoArg
@Document(collection = "chats")
class RoomChat(
class Chat(
@Id
val id: String? = null,
val userId: String,
val roomId: String,
val content: String,
// roomId or serverId
val contextId: String,
var content: String,
) : BaseTime() {
@Id
var id: String? = null

fun isEdited(): Boolean {
return !createdAt.equals(updatedAt)
}

fun updateContent(content: String) {
this.content = content
}
}
21 changes: 0 additions & 21 deletions chat/src/main/kotlin/kpring/chat/chat/model/ServerChat.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package kpring.chat.chat.repository

import kpring.chat.chat.model.RoomChat
import kpring.chat.chat.model.Chat
import org.springframework.data.domain.Pageable
import org.springframework.data.mongodb.repository.MongoRepository
import org.springframework.data.querydsl.QuerydslPredicateExecutor
import org.springframework.stereotype.Repository

@Repository
interface RoomChatRepository : MongoRepository<RoomChat, String>, QuerydslPredicateExecutor<RoomChat> {
fun findAllByRoomId(
roomId: String,
interface RoomChatRepository : MongoRepository<Chat, String>, QuerydslPredicateExecutor<Chat> {
fun findAllByContextId(
contextId: String,
pageable: Pageable,
): List<RoomChat>
): List<Chat>
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package kpring.chat.chat.repository

import kpring.chat.chat.model.ServerChat
import kpring.chat.chat.model.Chat
import org.springframework.data.domain.Pageable
import org.springframework.data.mongodb.repository.MongoRepository
import org.springframework.data.querydsl.QuerydslPredicateExecutor
import org.springframework.stereotype.Repository

@Repository
interface ServerChatRepository : MongoRepository<ServerChat, String>, QuerydslPredicateExecutor<ServerChat> {
fun findAllByServerId(
interface ServerChatRepository : MongoRepository<Chat, String>, QuerydslPredicateExecutor<Chat> {
fun findAllByContextId(
serverId: String,
pageable: Pageable,
): List<ServerChat>
): List<Chat>
}
Loading