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

[Release] 4차 배포 #367

Merged
merged 202 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
202 commits
Select commit Hold shift + click to select a range
6a48830
feat: object storage 업로드 파일 구현
Jieun1ee Nov 26, 2024
094f222
chore: 안쓰는 변수 삭제
Jieun1ee Nov 26, 2024
644e41f
feat: stream summary 기본 구조 구현
Jieun1ee Nov 26, 2024
7d490af
feat: 음성 내용 텍스트로 변환 기능 구현
Jieun1ee Nov 26, 2024
f0701dd
feat: 텍스트 내용 요약기능 구현
Jieun1ee Nov 26, 2024
1d2c593
feat: stream api 요약기능, 생성, 조회 기능 구현
Jieun1ee Nov 26, 2024
d79d057
feat: 에러 메세지 추가
Jieun1ee Nov 27, 2024
e9a35fc
feat: 오디오 변환 로직 수정
Jieun1ee Nov 27, 2024
3715199
chore: 주석 삭제
Jieun1ee Nov 27, 2024
7be4131
feat: TicleStatus에 진행중 추가
Jieun1ee Nov 28, 2024
1e74c25
feat: ticle status 추가로 인한 대시보드 리스트 조회 수정
Jieun1ee Nov 28, 2024
3f1b52f
feat: ticle 메인페이지, 상세조회에 status 추가
Jieun1ee Nov 28, 2024
e439146
feat: 대시보드 스키마 수정
Jieun1ee Nov 28, 2024
e7ce6d5
feat: 티클 시작시 상태 변경
Fixtar Nov 28, 2024
641ad1e
feat: ticle 종료 구현
Fixtar Nov 28, 2024
5be8d2a
fix: 티클 시작&종료 수정
Fixtar Nov 28, 2024
9dafeee
docs: readme 수정
simeunseo Nov 29, 2024
7b89436
Merge pull request #328 from boostcampwm-2024/docs/#327/readme
simeunseo Nov 29, 2024
3e5bd80
refactor: 패키지 구조 변경
Fixtar Nov 30, 2024
33d6fd1
feat: 인프로그레스 수정
Jieun1ee Nov 30, 2024
e85a597
fix: createticle userid validate
Jieun1ee Nov 30, 2024
414f9ef
Merge pull request #320 from boostcampwm-2024/feat/#318/ticle-status
Jieun1ee Nov 30, 2024
785a19f
feat: 대시보드에 'inProgress' 상태 추가
simeunseo Nov 30, 2024
50e8a51
refactor: 티클 상세 조회에서 버튼 조건부 분기 리팩토링
simeunseo Nov 30, 2024
3b22b0f
feat: getTicleList service에서 isOpen 필터링시 inprogress 상태인 것도 포함
simeunseo Nov 30, 2024
ef8aeb6
feat: 티클 시작하기 버튼 API 연결
simeunseo Nov 30, 2024
de60301
feat: 대시보드에서 시작된 티클일 경우 버튼 disabled
simeunseo Nov 30, 2024
9ae164c
feat: 티클 나가기시 isOwner 여부에 따라 모달 분기
simeunseo Nov 30, 2024
3c2c013
feat: 티클 종료 api 연결
simeunseo Nov 30, 2024
cba4fb2
feat: 종료된 티클 접속시 /로 navigate
simeunseo Nov 30, 2024
d02e5c0
design: 대시보드에서 CTA 버튼 width 고정
simeunseo Nov 30, 2024
de136a2
design: 티클 상세 조회에서 카드 색상 변경
simeunseo Nov 30, 2024
caa059f
feat: 스트리밍 페이지에서 티클 제목 추가
simeunseo Nov 30, 2024
da7fafc
feat: winston logger 구현
Fixtar Nov 30, 2024
ae8239e
feat: log ObjcetStorage로 업로드 기능 추가
Fixtar Dec 1, 2024
2116d41
Merge branch 'develop' into feat/#289/ncp-object-storage
Jieun1ee Dec 1, 2024
1235417
Merge branch 'develop' into feat/#92/api-summary
Jieun1ee Dec 1, 2024
c4e876f
fix: batch 단위 수정
Fixtar Dec 1, 2024
785c71b
fix: 로그에 결과값 포함
Fixtar Dec 1, 2024
46f71bc
fix: 주석 제거
Fixtar Dec 1, 2024
78d062e
fix: singleton 으로 logger사용
Fixtar Dec 1, 2024
0f8965c
feat: 티클 종료시 할당된 자원을 해제하는 기능 추가
seoko97 Dec 1, 2024
b05a1a4
feat: 새로운 peer 접속시 레이아웃 상에 반영하는 dummy user 구현
seoko97 Dec 1, 2024
3b6d8d5
feat: newPeer 이벤트시 nickname 반환
seoko97 Dec 1, 2024
5002d32
feat: 카메라 및 마이크 스트림 시작 기능 추가
seoko97 Dec 1, 2024
dd6cb87
feat: remoteStream consume 로직 개선 및 스트림 정리 기능 추가
seoko97 Dec 1, 2024
d62e628
feat: 소켓 연결 해제 로직 제거
seoko97 Dec 1, 2024
56c0d30
feat: 더미 스트림 상태 추가 및 페이지네이션 로직 개선
seoko97 Dec 1, 2024
f7d17ac
feat: 로컬 스트림 종료 기능 추가
seoko97 Dec 1, 2024
2823b52
docs: readme 업데이트
simeunseo Dec 1, 2024
ccc3c85
docs: 수정
simeunseo Dec 1, 2024
a5e54a7
feat: 미디어 스트림 설정을 위한 기본 제약 조건 추가 및 옵션 지원
seoko97 Dec 1, 2024
12af3aa
feat: 미디어 장치 관리 기능 추가 및 선택된 장치 ID 설정 로직 구현
seoko97 Dec 1, 2024
7a6dcd5
docs: 종빈 리드미 업데이트
begong313 Dec 1, 2024
f50466b
feat: 설정 아이콘 SVG 파일 추가
seoko97 Dec 1, 2024
55bba7a
feat: 미디어 장치의 deviceId 속성을 value로 변경
seoko97 Dec 1, 2024
15992af
feat: position 순서 정렬을 통한 z index 제거
seoko97 Dec 1, 2024
c2d6062
feat: 설정 다이얼로그 추가 및 제어바에 설정 아이콘 토글 버튼 구현
seoko97 Dec 1, 2024
60a7eaa
feat: useEffect 의존성 배열에서 불필요한 stream 제거
seoko97 Dec 1, 2024
94296a0
feat: 설정 다이얼로그에 오디오 및 비디오 선택 기능 추가
seoko97 Dec 1, 2024
13d7a72
feat: 미디어 장치 필터링에서 기본 deviceId 제외
seoko97 Dec 1, 2024
9e03d57
feat: 선택 가능한 카메라 및 마이크가 없을 때 사용자에게 메시지 표시
seoko97 Dec 1, 2024
e9c4715
docs: README.md 업데이트
seoko97 Dec 1, 2024
419fabe
docs: README.md 업데이트
seoko97 Dec 2, 2024
46e6a31
docs: README.md 업데이트
seoko97 Dec 2, 2024
9b04d36
docs: 수정
simeunseo Dec 2, 2024
b222095
Merge pull request #336 from boostcampwm-2024/docs/#332/readme
simeunseo Dec 2, 2024
e7b08ed
docs: README.md 업데이트
seoko97 Dec 2, 2024
ea66b9f
fix: 병합 충돌 해결
seoko97 Dec 2, 2024
a6617fd
Merge pull request #292 from boostcampwm-2024/feat/#289/ncp-object-st…
Jieun1ee Dec 2, 2024
32b0201
Merge pull request #302 from boostcampwm-2024/feat/#92/api-summary
Jieun1ee Dec 2, 2024
eeefb25
fix: console.log 제거
Fixtar Dec 2, 2024
d652f58
style: 주석 제거
seoko97 Dec 2, 2024
aceac7e
fix: conflict해결
Fixtar Dec 2, 2024
8c8c792
fix: merge develop
Fixtar Dec 2, 2024
5244322
fix: 사용하지 않는 Import 제거
Fixtar Dec 2, 2024
d344eb3
fix: pnpm Install 다시 진행
Fixtar Dec 2, 2024
fc5ac2b
feat: OR문을 IN 절로 수정
simeunseo Dec 2, 2024
b393394
Merge pull request #329 from boostcampwm-2024/feat/#27/ticle-status
simeunseo Dec 2, 2024
525194c
fix: s3 sdk 버전 통합
Fixtar Dec 2, 2024
ec2bdbb
Merge branch 'develop' into feat/#304/winston
Fixtar Dec 2, 2024
ee3538b
feat: ticle/detail guard제거 및 query param 추가
begong313 Dec 2, 2024
c69aed7
Merge pull request #334 from boostcampwm-2024/feat/#331/video-grid
seoko97 Dec 2, 2024
7f5c8ca
Merge pull request #340 from boostcampwm-2024/feat/#339/edit-ticle-de…
begong313 Dec 2, 2024
e159270
fix: 병합 충돌 해결
seoko97 Dec 2, 2024
cbf91fd
Merge pull request #333 from boostcampwm-2024/feat/#304/winston
Fixtar Dec 2, 2024
e772b19
Merge pull request #338 from boostcampwm-2024/feat/#335/stream-setup
seoko97 Dec 2, 2024
9c3ab56
fix: 티클쿼리 수정
Jieun1ee Dec 2, 2024
c2d4716
Merge pull request #346 from boostcampwm-2024/fix/#345/fix-ticle
Jieun1ee Dec 2, 2024
f9d4625
feat: in/out 애니메이션 효과 추가
seoko97 Dec 2, 2024
eda8553
feat: toast content 타입 가드 함수 추가
seoko97 Dec 2, 2024
e9ad6e0
feat: toast node에 애니메이션 효과 추가
seoko97 Dec 2, 2024
ea739bf
feat: ToastContainer RootComponent에 추가
seoko97 Dec 2, 2024
82b2d41
feat: useToast 훅 추가 및 클릭 시 토스트 닫기 기능 구현
seoko97 Dec 2, 2024
a822885
feat: toast 유틸리티 함수 추가 및 토스트 ID 생성 기능 구현
seoko97 Dec 2, 2024
8d11bc0
feat: toast 타입 정의 및 인터페이스 추가
seoko97 Dec 2, 2024
157273c
feat: Observer Pattern을 통한 ToastManager 구현
seoko97 Dec 2, 2024
e147554
feat: ToastTransition 컴포넌트 추가 및 애니메이션 효과 구현
seoko97 Dec 2, 2024
1839bcb
feat: 토스트 애니메이션 관련 상수 추가
seoko97 Dec 2, 2024
14120da
feat: toast 모듈에서 eventManager 및 utils 내보내기 추가
seoko97 Dec 2, 2024
6b33630
feat: 입력받은 toast message를 렌더링하는 ToastContainer 컴포넌트 구현
seoko97 Dec 2, 2024
05c8c55
feat: Toast 컴포넌트 추가
seoko97 Dec 2, 2024
491b6b1
feat: useToastContainer 훅 추가 및 토스트 관리 기능 구현
seoko97 Dec 2, 2024
a9ae1b5
fix: emit 메서드의 args 타입을 never로 변경하여 타입 안전성 향상
seoko97 Dec 2, 2024
875c33c
refactor: return 문 제거
seoko97 Dec 2, 2024
3027763
feat: 사용하지 않는 props 제거
seoko97 Dec 2, 2024
e2b7cb9
feat: 방폭 로직 구현
begong313 Dec 2, 2024
747822b
feat: ESLint 설정에 Prettier 추가
seoko97 Dec 2, 2024
0da94ea
fix: Toast 컴포넌트의 애니메이션 클래스 순서 수정
seoko97 Dec 2, 2024
a0889b0
fix: 병합 충돌 해결
seoko97 Dec 2, 2024
36a69b4
fix: log 없을시 에러처리 추가
Fixtar Dec 2, 2024
491c938
fix: cron 수정
Fixtar Dec 3, 2024
6cccd5e
fix: log파일 저장 기한 수정
Fixtar Dec 3, 2024
2465b0b
Merge pull request #350 from boostcampwm-2024/feat/#348/break-room
begong313 Dec 3, 2024
42817fa
Merge pull request #351 from boostcampwm-2024/feat/#304/winston
Fixtar Dec 3, 2024
d45dd23
Merge pull request #349 from boostcampwm-2024/feat/#342/toast
seoko97 Dec 3, 2024
cee13f0
feat: 토스트 메시지를 사용하여 에러 및 성공 알림 추가
seoko97 Dec 3, 2024
88f558e
feat: 에러 및 성공 메시지를 렌더링하는 유틸리티 함수 추가
seoko97 Dec 3, 2024
60aca3c
feat: ToastContainer에 최대 토스트 수 제한 옵션 추가
seoko97 Dec 3, 2024
680aacf
refactor: 불필요한 import 문 제거
seoko97 Dec 3, 2024
24d7386
style: Toast 컴포넌트 배경색을 변경
seoko97 Dec 3, 2024
157c770
feat: Alert 컴포넌트 추가 및 타입별 스타일링 구현
seoko97 Dec 3, 2024
91e61dd
feat: VideoPlayer 컴포넌트에서 stream prop을 선택적으로 변경
seoko97 Dec 3, 2024
a7c177b
fix: WSExceptionFilter에서 WsException 타입을 제거하고 일반 예외 처리로 변경
seoko97 Dec 3, 2024
314416a
feat: record 기본 파일 세팅
begong313 Nov 30, 2024
0305299
feat: plaintransport 생성로직 추가
begong313 Nov 30, 2024
009178a
feat: record용 consumer 추가
begong313 Nov 30, 2024
413fa71
feat: gateway에 event 추가. 로직 결합
begong313 Nov 30, 2024
35ffe2c
feat: ffmpeg생성 및 실행로직 추가
begong313 Nov 30, 2024
d845c92
feat: 삭제 로직 추가, 저장폴더 없으면 폴더생성, 버그수정
begong313 Nov 30, 2024
a868f78
fix: ffmpeg 종료안되던 버그 제거
begong313 Dec 1, 2024
4d051ce
feat: 녹음 정지기능 추가
begong313 Dec 1, 2024
79c61c9
feat: record pause,resume 기능 추가
begong313 Dec 1, 2024
e802721
feat: 녹음용 포트 안겹치게 기능생성, 함수명 변경
begong313 Dec 1, 2024
7a5702c
feat: record 관련 type 추가
begong313 Dec 1, 2024
7354b81
feat: 메모리 누수 관리
begong313 Dec 1, 2024
129e262
feat: type 추가
begong313 Dec 1, 2024
cf66aae
feat: 음성녹음 종료 시 object storage 업로드
begong313 Dec 2, 2024
98840b3
feat: object storeage 저장 후 api서버로 fetch
begong313 Dec 2, 2024
407c4a3
feat: ffmpeg-fluent 패키지로 변경
begong313 Dec 2, 2024
3d26281
feat: ffmpeg 프로세스 종료 로직 수정, 불필요한 stream 전환 제거
begong313 Dec 3, 2024
fa928bc
fix: 병합 충돌 해결
seoko97 Dec 3, 2024
0543e66
feat: 녹음 업로드 완료 시 파일 삭제
begong313 Dec 3, 2024
5c6bdb1
feat: inProgress 상태인 티클에만 참여할 수 있도록 버튼 disabled
simeunseo Dec 3, 2024
b497ca0
Merge pull request #354 from boostcampwm-2024/feat/#342/setup-toast
seoko97 Dec 3, 2024
8de2fae
feat: Merge branch 'develop' into feat/#356/ticle-participate
simeunseo Dec 3, 2024
460cb9a
feat: ai 요약버튼 추가
begong313 Dec 3, 2024
629adde
refactor: StreamData를 client.RemoteStream으로 변경 및 관련 타입 수정
seoko97 Dec 3, 2024
75a1bfe
feat: initialStream이 존재할 때 해당 스트림과 교체
seoko97 Dec 3, 2024
aefbdd5
feat: disconnect 메서드를 clearMediasoup로 변경
seoko97 Dec 3, 2024
f2e23d1
feat: closeLocalStream 메서드를 clearLocalStream으로 변경
seoko97 Dec 3, 2024
3e53e4b
feat: disconnect 메서드를 navigate로 변경
seoko97 Dec 3, 2024
653990e
feat: clearStreams 메서드 추가 및 미디어 장치 오류 처리 개선
seoko97 Dec 3, 2024
016f071
feat: dummyStream 컨텍스트 및 프로바이더 삭제
seoko97 Dec 3, 2024
1e7dc78
feat: DummyStreamProvider 제거
seoko97 Dec 3, 2024
fd53780
feat: 녹화 상태 check event 추가
begong313 Dec 3, 2024
a4b978b
feat: useTicle 호출시 userId를 query param으로 넘김
simeunseo Dec 3, 2024
93bddf6
Merge pull request #353 from boostcampwm-2024/feat/#344/ai-pipline
begong313 Dec 3, 2024
ea2474a
feat: 티클 상세 페이지 로그인 없이 볼 수 있도록 수정
simeunseo Dec 3, 2024
1930fce
feat: toast 디자인 변경
simeunseo Dec 3, 2024
108b276
feat: 방장 티클 종료시 참가자 모두 나가게 하기
simeunseo Dec 3, 2024
c33c312
chore: prettier error 수정
simeunseo Dec 3, 2024
a992d08
feat: ai 요약 확인 dialog UI 구현
simeunseo Dec 3, 2024
216eb15
feat: ai 요약본 GET api 연결
simeunseo Dec 3, 2024
bacadc6
feat: 개설한 티클 관리에서도 ai 요약본 보기
simeunseo Dec 3, 2024
5657c76
feat: AI 요약이 완료되지 않았을 때 보여줄 로딩 뷰 구현
simeunseo Dec 3, 2024
4a3ab2f
feat: 이미 녹음 버튼을 눌렀다면 다시 누르지 못하게 함
simeunseo Dec 3, 2024
dbaf7b8
feat: 녹음 버튼은 방장에게만 보여주도록 분기
simeunseo Dec 3, 2024
e2c5bd4
docs: README 수정
simeunseo Dec 4, 2024
9fff9ca
fix: 정렬 진행시 기존 스트림이 업데이트 되지 않는 현상 수정
seoko97 Dec 4, 2024
40ba81a
feat: ProducerOptions의 비트레이트 및 인코딩 설정 수정
seoko97 Dec 4, 2024
2cd8f58
feat: pause 여부에 따른 filter 조건 추가
seoko97 Dec 4, 2024
5553e38
feat: rtpParameters.encodings 설정을 mediaTypes에 따라 조정
seoko97 Dec 4, 2024
cdd2ec8
docs: 종빈 readme 수정
begong313 Dec 4, 2024
4e6d0ae
feat: 네트워크 상테에 따른 consumer layer 변경
seoko97 Dec 4, 2024
346a7c1
feat: 네트워크 상태에 따라 스트림 품질을 변경하는 useNetworkMonitor 추가
seoko97 Dec 4, 2024
dc46f44
feat: consumer stats 변경을 위한 이벤트 및 DTO 추가
seoko97 Dec 4, 2024
bf7bdf4
fix: useNetworkMonitor에서 변수 이름 수정 및 타입 단언 추가
seoko97 Dec 4, 2024
53d4a76
feat: Pinned 및 UnPinned 컴포넌트에 useNetworkMonitor 추가
seoko97 Dec 4, 2024
0724fe9
Merge pull request #359 from boostcampwm-2024/feat/#342/setup-toast
seoko97 Dec 4, 2024
f86cc1e
Merge branch 'develop' into feat/#356/ticle-participate
simeunseo Dec 4, 2024
4756444
fix: 병합 충돌 해결
seoko97 Dec 4, 2024
22ec22e
Merge pull request #363 from boostcampwm-2024/docs/#362/readme
simeunseo Dec 4, 2024
78da51d
chore: 안쓰는 import 삭제
simeunseo Dec 4, 2024
4064cb3
feat: Merge branch 'feat/#356/ticle-participate' of https://github.co…
simeunseo Dec 4, 2024
322d967
Merge pull request #360 from boostcampwm-2024/feat/#356/ticle-partici…
simeunseo Dec 4, 2024
8074756
Merge branch 'develop' into feat/#58/ai
simeunseo Dec 4, 2024
19379fc
feat: 병합
simeunseo Dec 4, 2024
8c5fc67
chore: prettier
simeunseo Dec 4, 2024
59f4d22
Merge pull request #361 from boostcampwm-2024/feat/#58/ai
simeunseo Dec 4, 2024
a36bae9
fix: videoGoogleStartBitrate 값을 10000에서 1000으로 수정
seoko97 Dec 4, 2024
d74df42
Merge pull request #364 from boostcampwm-2024/feat/#266/network
seoko97 Dec 4, 2024
a1aa4de
refactor: ControlBar 컴포넌트에서 useParams와 useNavigate를 한 줄로 통합
seoko97 Dec 4, 2024
7d962df
refactor: AiSummary 컴포넌트에서 socket 변수를 함수 내로 이동 및 타입 정의 추가
seoko97 Dec 4, 2024
3a20e1a
refactor: SubVideoGrid 컴포넌트에서 StreamData를 client.RemoteStream으로 변경
seoko97 Dec 4, 2024
d15ecce
feat: userId를 문자열로 변환하여 setAuthInfo에 추가
seoko97 Dec 4, 2024
124b670
chore: node-fetch 버전을 2.7.0으로 다운그레이드
seoko97 Dec 4, 2024
5e8bf9e
Merge pull request #365 from boostcampwm-2024/fix/#364/type-error
seoko97 Dec 4, 2024
18263ed
chore: 20000-20100 포트에 대한 tcp/udp 설정 추가
seoko97 Dec 4, 2024
d722a78
chore: Dockerfile에 ffmpeg 추가
seoko97 Dec 4, 2024
9175eda
chore: 포트 제거
seoko97 Dec 4, 2024
2d617d2
Merge pull request #366 from boostcampwm-2024/fix/#364/type-error
seoko97 Dec 4, 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
2 changes: 1 addition & 1 deletion .github/workflows/back-media-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:

- name: 🐳 media 컨테이너 실행
run: |
docker run -dit --name media -p 3002:3002 -p 30000-30500:30000-30500/tcp -p 30000-30500:30000-30500/udp ${{secrets.DOCKER_REGISTRY_URL}}/media:${{ github.sha }}
docker run -dit --name media -p 3002:3002 -p 30000-30500:30000-30500/tcp -p 30000-30500:30000-30500/udp ${{secrets.DOCKER_REGISTRY_URL}}/media:${{ github.sha }}

- name: 🐳 사용하지 않는 Docker 이미지 제거
run: |
Expand Down
212 changes: 170 additions & 42 deletions README.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.700.0",
"@nestjs/common": "^10.4.6",
"@nestjs/config": "^3.3.0",
"@nestjs/core": "^10.0.0",
"@nestjs/jwt": "^10.2.0",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/schedule": "^4.1.1",
"@nestjs/swagger": "^8.0.1",
"@nestjs/throttler": "^6.2.1",
"@nestjs/typeorm": "^10.0.2",
Expand All @@ -39,6 +41,7 @@
"eslint-import-resolver-typescript": "^3.6.3",
"jsonwebtoken": "^9.0.2",
"mysql2": "^3.11.3",
"nest-winston": "^1.9.7",
"passport": "^0.7.0",
"passport-github2": "^0.1.12",
"passport-google-oauth20": "^2.0.0",
Expand All @@ -47,6 +50,8 @@
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1",
"typeorm": "^0.3.20",
"winston": "^3.17.0",
"winston-daily-rotate-file": "^5.0.0",
"zod": "^3.23.8"
},
"devDependencies": {
Expand Down
13 changes: 11 additions & 2 deletions apps/api/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { Module } from '@nestjs/common';
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { ThrottlerModule } from '@nestjs/throttler';
import { TypeOrmModule } from '@nestjs/typeorm';

import { TypeOrmConfigService } from '@/config/typeorm.config';

import { AuthModule } from './auth/auth.module';
import { LoggerMiddleware } from './common/log/logger.middleware';
import { LoggerModule } from './common/log/logger.module';
import { NcpModule } from './common/ncp/ncp.module';
import { DashboardModule } from './dashboard/dashboard.module';
import { StreamModule } from './stream/stream.module';
import { TicleModule } from './ticle/ticle.module';
Expand All @@ -32,6 +35,12 @@ import { UserModule } from './user/user.module';
useClass: TypeOrmConfigService,
}),
DashboardModule,
LoggerModule,
NcpModule,
],
})
export class AppModule {}
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer.apply(LoggerMiddleware).forRoutes('*');
}
}
2 changes: 1 addition & 1 deletion apps/api/src/common/filter/http-exception.filter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ExceptionFilter, Catch, ArgumentsHost, HttpException } from '@nestjs/common';
import { Response } from 'express';

import { ErrorResponse } from '@/response.interface';
import { ErrorResponse } from '@/common/Interceptor/response.interface';

@Catch(HttpException)
export class HttpExceptionFilter implements ExceptionFilter {
Expand Down
41 changes: 41 additions & 0 deletions apps/api/src/common/log/logger.batch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import fs from 'fs/promises';
import path from 'path';

import { Injectable } from '@nestjs/common';
import { Cron, CronExpression } from '@nestjs/schedule';

import { LoggerService } from './logger.service';
import { NcpService } from '../ncp/ncp.service';

@Injectable()
export class LogBatchService {
constructor(
private readonly ncpService: NcpService,
private readonly loggerService: LoggerService
) {}

@Cron(CronExpression.EVERY_DAY_AT_1AM)
async uploadLogToObjectStorage() {
const logsDir = path.join(__dirname, '../../../logs');
const today = new Date();
today.setHours(today.getHours() + 9);
today.setDate(today.getDate() - 1);

const logFileName = `application-${today.toISOString().split('T')[0]}.log`;
const localFilePath = path.join(logsDir, logFileName);
try {
await fs.access(localFilePath);

const remoteFileName = `logs/${logFileName}`;
const result = await this.ncpService.uploadFile(localFilePath, remoteFileName);
this.loggerService.log(`Log file uploaded successfully: ${result}`, 'logBatchService');
} catch (error) {
const err = error as Error;
this.loggerService.error(
`Log file not found: ${localFilePath}`,
err.stack,
'logBatchService'
);
}
}
}
26 changes: 26 additions & 0 deletions apps/api/src/common/log/logger.middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Injectable, NestMiddleware } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';

import { LoggerService } from './logger.service';

@Injectable()
export class LoggerMiddleware implements NestMiddleware {
constructor(private readonly logger: LoggerService) {}

use(req: Request, res: Response, next: NextFunction) {
const { method, originalUrl } = req;
const userAgent = req.headers['user-agent'] || 'Unknown';

res.on('finish', () => {
const { statusCode } = res;
const contentLength = res.get('content-length') || 0;

this.logger.log(
`[${method}] ${originalUrl} - ${statusCode} - ${contentLength} bytes - UserAgent: ${userAgent}`,
'HTTP'
);
});

next();
}
}
17 changes: 17 additions & 0 deletions apps/api/src/common/log/logger.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Global, Module } from '@nestjs/common';
import { ScheduleModule } from '@nestjs/schedule';
import { WinstonModule } from 'nest-winston';

import { WinstonConfig } from '@/config/winston.confing';

import { LogBatchService } from './logger.batch';
import { LoggerService } from './logger.service';
import { NcpModule } from '../ncp/ncp.module';

@Global()
@Module({
imports: [WinstonModule.forRoot(WinstonConfig), ScheduleModule.forRoot(), NcpModule],
providers: [LoggerService, LogBatchService],
exports: [LoggerService],
})
export class LoggerModule {}
28 changes: 28 additions & 0 deletions apps/api/src/common/log/logger.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Inject, Injectable, LoggerService as NestLoggerService } from '@nestjs/common';
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston';

@Injectable()
export class LoggerService implements NestLoggerService {
constructor(@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger) {}

log(message: string, context: string) {
this.logger.info(message, { context });
}

error(message: string, trace: string, context: string) {
this.logger.error(message, { trace, context });
}

warn(message: string, context: string) {
this.logger.warn(message, { context });
}

debug(message: string, context: string) {
this.logger.debug(message, { context });
}

verbose(message: string, context: string) {
this.logger.verbose(message, { context });
}
}
11 changes: 11 additions & 0 deletions apps/api/src/common/ncp/ncp.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common';

import { NcpConfig } from '@/config/ncp.config';

import { NcpService } from './ncp.service';

@Module({
providers: [NcpService, NcpConfig],
exports: [NcpService],
})
export class NcpModule {}
39 changes: 39 additions & 0 deletions apps/api/src/common/ncp/ncp.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as fs from 'fs';

import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { ErrorMessage } from '@repo/types';

import { NcpConfig } from '@/config/ncp.config';

@Injectable()
export class NcpService {
private s3: S3Client;

constructor(
private ncpConfig: NcpConfig,
private configService: ConfigService
) {
this.s3 = ncpConfig.s3Client;
}

async uploadFile(localFilePath: string, remoteFileName: string): Promise<string> {
const bucketName = this.configService.get<string>('NCP_OBJECT_STORAGE_BUCKET');
const endpoint = this.configService.get<string>('NCP_OBJECT_STORAGE_ENDPOINT');

try {
const fileStream = fs.createReadStream(localFilePath);
const params = {
Bucket: bucketName,
Key: remoteFileName,
Body: fileStream,
};
const uploadResponse = await this.s3.send(new PutObjectCommand(params));
const url = `${endpoint}/${bucketName}/${remoteFileName}`;
return remoteFileName;
} catch (error) {
throw new Error(ErrorMessage.FILE_UPLOAD_FAILED);
}
}
}
25 changes: 25 additions & 0 deletions apps/api/src/config/ncp.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { S3Client } from '@aws-sdk/client-s3';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';

@Injectable()
export class NcpConfig {
s3Client: S3Client;

constructor(private configService: ConfigService) {
const accessKeyId = this.configService.get<string>('NCP_ACCESS_KEY');
const secretAccessKey = this.configService.get<string>('NCP_SECRET_KEY');
const region = this.configService.get<string>('NCP_OBJECT_STORAGE_REGION');
const endpoint = this.configService.get<string>('NCP_OBJECT_STORAGE_ENDPOINT');

this.s3Client = new S3Client({
region: region,
credentials: {
accessKeyId: accessKeyId,
secretAccessKey: secretAccessKey,
},
endpoint: endpoint,
forcePathStyle: true,
});
}
}
26 changes: 26 additions & 0 deletions apps/api/src/config/winston.confing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import path from 'path';

import * as winston from 'winston';
import 'winston-daily-rotate-file';

export const WinstonConfig = {
transports: [
new winston.transports.Console({
format: winston.format.combine(
winston.format.timestamp(),
winston.format.colorize(),
winston.format.printf(({ level, message, timestamp }) => {
return `[${timestamp}] ${level}: ${message}`;
})
),
}),
new winston.transports.DailyRotateFile({
dirname: path.join(__dirname, '../../logs'),
filename: 'application-%DATE%.log',
datePattern: 'YYYY-MM-DD',
zippedArchive: true,
maxSize: '20m',
maxFiles: '3d',
}),
],
};
17 changes: 14 additions & 3 deletions apps/api/src/dashboard/dashboard.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { GetDashboardListQuerySchema } from '@repo/types';

import { JwtAuthGuard } from '@/auth/jwt/jwt-auth.guard';
import { GetUserId } from '@/common/decorator/get-userId.decorator';
import { ZodValidationPipe } from '@/zodValidationPipe';
import { ZodValidationPipe } from '@/common/pipe/zodValidationPipe';

import { DashboardService } from './dashboard.service';
import { GetDashboardListQueryDto } from './dto/getDashboardListQueryDto';
Expand Down Expand Up @@ -31,8 +31,19 @@ export class DashboardController {
return await this.dashboardService.getApplicants(ticleId);
}

@Post('start')
startTicle(@Param('ticleId') ticleId: number) {}
@Post(':ticleId/start')
@UseGuards(JwtAuthGuard)
async startTicle(@GetUserId() userId: number, @Param('ticleId') ticleId: number) {
await this.dashboardService.startTicle(userId, ticleId);
return 'success ticle start';
}

@Post(':ticleId/end')
@UseGuards(JwtAuthGuard)
async endTicle(@GetUserId() userId: number, @Param('ticleId') ticleId: number) {
await this.dashboardService.endTicle(userId, ticleId);
return 'success ticle end';
}

@Post('join')
joinTicle(@Param('ticleId') ticleId: number) {}
Expand Down
Loading
Loading