From 60f1119805b99e07a3cdf011c24ff4501758d2a4 Mon Sep 17 00:00:00 2001 From: Eunseo Sim <55528304+simeunseo@users.noreply.github.com> Date: Fri, 22 Nov 2024 17:17:15 +0900 Subject: [PATCH 001/161] =?UTF-8?q?docs:=20readme=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 23 ++++++++++++----------- apps/web/src/components/live/index.tsx | 3 +-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index cc4333f3..6a92f51a 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,21 @@ 메인 배너
-### [:ledger: 팀 노션](https://www.notion.so/simeunseo/9-Ticle-12e599a6f0d2804682ccd2251248a435?pvs=4) | [:mag: 위키](https://github.com/boostcampwm-2024/web21-boostproject/wiki) | [🎨 피그마](https://www.figma.com/design/nw74detTvjXGrDP2cfdmwp/TICLE-%EB%94%94%EC%9E%90%EC%9D%B8?node-id=32-4477&t=3FCCnBpgQXMZs63X-1) | [🗓️ 스프린트 백로그](https://github.com/orgs/boostcampwm-2024/projects/82/views/7) +### [:ledger: 팀 노션](https://www.notion.so/simeunseo/9-Ticle-12e599a6f0d2804682ccd2251248a435?pvs=4) | [:mag: 위키](https://github.com/boostcampwm-2024/web21-boostproject/wiki) | [🎨 피그마](https://www.figma.com/design/nw74detTvjXGrDP2cfdmwp/TICLE-%EB%94%94%EC%9E%90%EC%9D%B8?node-id=32-4477&t=3FCCnBpgQXMZs63X-1) | [🗓️ 스프린트 백로그](https://github.com/orgs/boostcampwm-2024/projects/82/views/7) | [🧪 스토리북](https://673a0cccd15a760db778c591-kxdpixadfg.chromatic.com/?path=/docs/common-dialog--docs) +# 🖧 시스템 아키텍처 + +아키텍처 + +# 🏃 작업 진행 상황 + +- [🆕 4주차 발표자료](https://simeunseo.notion.site/4-1ccf63bab4b14fd8b249f5d7c7cd7e53?pvs=4) +- [3주차 발표자료](https://simeunseo.notion.site/3-0df689ca7cd3407b89a93284854a54b8?pvs=4) +- [2주차 발표자료](https://simeunseo.notion.site/2-137599a6f0d2809fa498fa1cc31d97f9?pvs=4) +- [1주차 발표자료](https://simeunseo.notion.site/1-130599a6f0d2804597e0c55e8ee33920?pvs=4) + # 💡 핵심 기능 ### **✔️ 실시간 화상 지식 공유** @@ -40,16 +51,6 @@ CLOVA API를 이용해 티클 내용을 요약하여 제공합니다. -# 📽️ 스트리밍 구현 흐름 - -### Producer(미디어 전송 엔드포인트) - -mediasoup sequence diagram - producer - -### Consumer(미디어 수신 엔드포인트) - -mediasoup sequence diagram - consumer - # ✍️ 학습 정리 | 분야 | 기술 | diff --git a/apps/web/src/components/live/index.tsx b/apps/web/src/components/live/index.tsx index ee591836..3781c486 100644 --- a/apps/web/src/components/live/index.tsx +++ b/apps/web/src/components/live/index.tsx @@ -43,11 +43,10 @@ function MediaContainer() { audioProducerRef, videoProducerRef, - screenProducerRef, + startScreenStream, closeStream, - pauseStream, resumeStream, From 3edb84e384ac5380dbd29f446e59a5515887149c Mon Sep 17 00:00:00 2001 From: Eunseo Sim <55528304+simeunseo@users.noreply.github.com> Date: Sat, 23 Nov 2024 18:13:12 +0900 Subject: [PATCH 002/161] =?UTF-8?q?feat:=20dashboard=20api=20=EB=84=A4?= =?UTF-8?q?=EC=9D=B4=EB=B0=8D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/api/dashboard.ts | 6 +++--- apps/web/src/hooks/api/dashboard.ts | 23 +++++++++++------------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/apps/web/src/api/dashboard.ts b/apps/web/src/api/dashboard.ts index bb75f2ff..d02c4fd8 100644 --- a/apps/web/src/api/dashboard.ts +++ b/apps/web/src/api/dashboard.ts @@ -1,13 +1,13 @@ import axiosInstance from '@/api/axios'; -interface GetAppliedTicleListParams { +export interface GetDashboardTicleListParams { isSpeaker: boolean; page: number; pageSize: number; status: 'open' | 'close'; } -const getAppliedTicleList = async (params: GetAppliedTicleListParams) => { +const getDashboardTicleList = async (params: GetDashboardTicleListParams) => { const { data } = await axiosInstance.get('/dashboard', { params }); return data; @@ -31,4 +31,4 @@ const joinTicle = async (ticleId: string) => { return data; }; -export { getAppliedTicleList, startTicle, joinTicle, getApplicantsTicle }; +export { getDashboardTicleList, startTicle, joinTicle, getApplicantsTicle }; diff --git a/apps/web/src/hooks/api/dashboard.ts b/apps/web/src/hooks/api/dashboard.ts index 63d78ea1..41c7220a 100644 --- a/apps/web/src/hooks/api/dashboard.ts +++ b/apps/web/src/hooks/api/dashboard.ts @@ -1,18 +1,17 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; -import { getAppliedTicleList, getApplicantsTicle, startTicle, joinTicle } from '@/api/dashboard'; - -interface GetAppliedTicleListParams { - isSpeaker: boolean; - page: number; - pageSize: number; - status: 'open' | 'close'; -} - -export const useAppliedTicleList = (params: GetAppliedTicleListParams) => { +import { + getDashboardTicleList, + getApplicantsTicle, + startTicle, + joinTicle, + GetDashboardTicleListParams, +} from '@/api/dashboard'; + +export const useDashboardTicleList = (params: GetDashboardTicleListParams) => { return useQuery({ - queryKey: ['appliedTicleList', params], - queryFn: () => getAppliedTicleList(params), + queryKey: ['dashboardTicleList', params], + queryFn: () => getDashboardTicleList(params), }); }; From b6d1f41b2628f66820309f45e92a532b29a12d8e Mon Sep 17 00:00:00 2001 From: JongBin Noh <95959567+begong313@users.noreply.github.com> Date: Sat, 23 Nov 2024 18:24:22 +0900 Subject: [PATCH 003/161] =?UTF-8?q?feat:=20cookieparser=20=EC=84=A4?= =?UTF-8?q?=EC=B9=98=20=EB=B0=8F=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/package.json | 2 ++ apps/api/src/main.ts | 3 +++ pnpm-lock.yaml | 42 ++++++++++++++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/apps/api/package.json b/apps/api/package.json index 29e899f6..32c1e6c3 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -32,6 +32,7 @@ "@nestjs/typeorm": "^10.0.2", "@repo/types": "workspace:*", "bcrypt": "^5.1.1", + "cookie-parser": "^1.4.7", "eslint-import-resolver-typescript": "^3.6.3", "jsonwebtoken": "^9.0.2", "mysql2": "^3.11.3", @@ -52,6 +53,7 @@ "@repo/lint": "workspace:*", "@repo/tsconfig": "workspace:*", "@types/bcrypt": "^5.0.2", + "@types/cookie-parser": "^1.4.7", "@types/express": "^5.0.0", "@types/jest": "^29.5.2", "@types/jsonwebtoken": "^9.0.7", diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index f1dfc59b..3781ba9d 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -1,6 +1,7 @@ import { ConfigService } from '@nestjs/config'; import { NestFactory } from '@nestjs/core'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; +import cookieParser from 'cookie-parser'; import { AppModule } from '@/app.module'; @@ -10,6 +11,8 @@ import { ResponseInterceptor } from './response.interceptor'; async function bootstrap() { const app = await NestFactory.create(AppModule); + app.use(cookieParser()); + //swagger setting const config = new DocumentBuilder() .setTitle('Ticle API server') diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 52c814ec..32a28314 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,16 +43,19 @@ importers: version: 10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6) '@nestjs/swagger': specifier: ^8.0.1 - version: 8.0.1(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.6)(@nestjs/websockets@10.4.7)(reflect-metadata@0.2.2)(rxjs@7.8.1))(reflect-metadata@0.2.2) + version: 8.0.1(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6)(reflect-metadata@0.2.2) '@nestjs/typeorm': specifier: ^10.0.2 - version: 10.0.2(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.6)(@nestjs/websockets@10.4.7)(reflect-metadata@0.2.2)(rxjs@7.8.1))(reflect-metadata@0.2.2)(rxjs@7.8.1)(typeorm@0.3.20(mysql2@3.11.3)(ts-node@10.9.2(@types/node@20.17.6)(typescript@5.6.3))) + version: 10.0.2(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6)(reflect-metadata@0.2.2)(rxjs@7.8.1)(typeorm@0.3.20(mysql2@3.11.3)(ts-node@10.9.2(@types/node@20.17.6)(typescript@5.6.3))) '@repo/types': specifier: workspace:* version: link:../../packages/types bcrypt: specifier: ^5.1.1 version: 5.1.1 + cookie-parser: + specifier: ^1.4.7 + version: 1.4.7 eslint-import-resolver-typescript: specifier: ^3.6.3 version: 3.6.3(@typescript-eslint/parser@8.11.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1) @@ -98,7 +101,7 @@ importers: version: 10.2.3(chokidar@3.6.0)(typescript@5.6.3) '@nestjs/testing': specifier: ^10.0.0 - version: 10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.6)(@nestjs/websockets@10.4.7)(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6)) + version: 10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6)(@nestjs/platform-express@10.4.6) '@repo/lint': specifier: workspace:* version: link:../../packages/eslint @@ -108,6 +111,9 @@ importers: '@types/bcrypt': specifier: ^5.0.2 version: 5.0.2 + '@types/cookie-parser': + specifier: ^1.4.7 + version: 1.4.7 '@types/express': specifier: ^5.0.0 version: 5.0.0 @@ -225,7 +231,7 @@ importers: version: 10.2.3(chokidar@3.6.0)(typescript@5.6.3) '@nestjs/testing': specifier: ^10.0.0 - version: 10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.6)(@nestjs/websockets@10.4.7)(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6)) + version: 10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6)(@nestjs/platform-express@10.4.6) '@types/express': specifier: ^5.0.0 version: 5.0.0 @@ -2045,6 +2051,9 @@ packages: '@types/connect@3.4.38': resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} + '@types/cookie-parser@1.4.7': + resolution: {integrity: sha512-Fvuyi354Z+uayxzIGCwYTayFKocfV7TuDYZClCdIP9ckhvAu/ixDtCB6qx2TT0FKjPLf1f3P/J1rgf6lPs64mw==} + '@types/cookie@0.4.1': resolution: {integrity: sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==} @@ -2866,6 +2875,10 @@ packages: convert-source-map@2.0.0: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + cookie-parser@1.4.7: + resolution: {integrity: sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==} + engines: {node: '>= 0.8.0'} + cookie-signature@1.0.6: resolution: {integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==} @@ -7019,7 +7032,7 @@ snapshots: transitivePeerDependencies: - chokidar - '@nestjs/swagger@8.0.1(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.6)(@nestjs/websockets@10.4.7)(reflect-metadata@0.2.2)(rxjs@7.8.1))(reflect-metadata@0.2.2)': + '@nestjs/swagger@8.0.1(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6)(reflect-metadata@0.2.2)': dependencies: '@microsoft/tsdoc': 0.15.0 '@nestjs/common': 10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1) @@ -7031,7 +7044,7 @@ snapshots: reflect-metadata: 0.2.2 swagger-ui-dist: 5.17.14 - '@nestjs/testing@10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.6)(@nestjs/websockets@10.4.7)(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6))': + '@nestjs/testing@10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6)(@nestjs/platform-express@10.4.6)': dependencies: '@nestjs/common': 10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1) '@nestjs/core': 10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.6)(@nestjs/websockets@10.4.7)(reflect-metadata@0.2.2)(rxjs@7.8.1) @@ -7039,7 +7052,7 @@ snapshots: optionalDependencies: '@nestjs/platform-express': 10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6) - '@nestjs/typeorm@10.0.2(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.6)(@nestjs/websockets@10.4.7)(reflect-metadata@0.2.2)(rxjs@7.8.1))(reflect-metadata@0.2.2)(rxjs@7.8.1)(typeorm@0.3.20(mysql2@3.11.3)(ts-node@10.9.2(@types/node@20.17.6)(typescript@5.6.3)))': + '@nestjs/typeorm@10.0.2(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6)(reflect-metadata@0.2.2)(rxjs@7.8.1)(typeorm@0.3.20(mysql2@3.11.3)(ts-node@10.9.2(@types/node@20.17.6)(typescript@5.6.3)))': dependencies: '@nestjs/common': 10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1) '@nestjs/core': 10.4.6(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.6)(@nestjs/websockets@10.4.7)(reflect-metadata@0.2.2)(rxjs@7.8.1) @@ -7633,6 +7646,10 @@ snapshots: dependencies: '@types/node': 20.17.6 + '@types/cookie-parser@1.4.7': + dependencies: + '@types/express': 5.0.0 + '@types/cookie@0.4.1': {} '@types/cookie@0.6.0': {} @@ -8597,6 +8614,11 @@ snapshots: convert-source-map@2.0.0: {} + cookie-parser@1.4.7: + dependencies: + cookie: 0.7.2 + cookie-signature: 1.0.6 + cookie-signature@1.0.6: {} cookie@0.7.1: {} @@ -9044,7 +9066,7 @@ snapshots: debug: 4.3.7(supports-color@9.4.0) enhanced-resolve: 5.17.1 eslint: 8.57.1 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.11.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.11.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.11.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) fast-glob: 3.3.2 get-tsconfig: 4.8.1 is-bun-module: 1.2.1 @@ -9057,7 +9079,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@8.11.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.11.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@8.11.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: @@ -9079,7 +9101,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.11.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.11.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.11.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 From 2f49e8193604e7667ecad29edc2b39c8bbf8e156 Mon Sep 17 00:00:00 2001 From: JongBin Noh <95959567+begong313@users.noreply.github.com> Date: Sat, 23 Nov 2024 21:39:54 +0900 Subject: [PATCH 004/161] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=97=86=EC=9D=84=EB=96=84=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=EC=B6=94=EA=B0=80,=20=ED=86=A0=ED=81=B0=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=EC=8B=A4=ED=8C=A8=EC=8B=9C=20=EC=97=90=EB=9F=AC?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/src/auth/jwt/jwt-auth.guard.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/api/src/auth/jwt/jwt-auth.guard.ts b/apps/api/src/auth/jwt/jwt-auth.guard.ts index be748685..7fcb00c4 100644 --- a/apps/api/src/auth/jwt/jwt-auth.guard.ts +++ b/apps/api/src/auth/jwt/jwt-auth.guard.ts @@ -1,17 +1,25 @@ -import { ExecutionContext, Injectable } from '@nestjs/common'; +import { ExecutionContext, Injectable, UnauthorizedException } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; @Injectable() export class JwtAuthGuard extends AuthGuard('jwt') { getRequest(context: ExecutionContext) { const req = context.switchToHttp().getRequest(); - const cookies = req.cookies; - const token = cookies['accessToken']; - if (token) req.headers.authorization = `Bearer ${token}`; + if (!token) { + throw new UnauthorizedException('로그인이 필요합니다.'); + } + req.headers.authorization = `Bearer ${token}`; return req; } + + handleRequest(err: any, user: any) { + if (err || !user) { + throw new UnauthorizedException('잘못된 인증 정보입니다.'); + } + return user; + } } From 016536b088af479a2a7fb861b6a10536b7577236 Mon Sep 17 00:00:00 2001 From: Eunseo Sim <55528304+simeunseo@users.noreply.github.com> Date: Sun, 24 Nov 2024 00:25:54 +0900 Subject: [PATCH 005/161] =?UTF-8?q?feat:=20ticle=20list=20zod=20schema=20?= =?UTF-8?q?=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/types/src/ticle/index.ts | 1 + packages/types/src/ticle/ticleList.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 packages/types/src/ticle/ticleList.ts diff --git a/packages/types/src/ticle/index.ts b/packages/types/src/ticle/index.ts index d3e7919e..9ea64b98 100644 --- a/packages/types/src/ticle/index.ts +++ b/packages/types/src/ticle/index.ts @@ -1,2 +1,3 @@ export * from './createTicle'; +export * from './ticleList'; export * from './ticleStatus'; diff --git a/packages/types/src/ticle/ticleList.ts b/packages/types/src/ticle/ticleList.ts new file mode 100644 index 00000000..c4e86e75 --- /dev/null +++ b/packages/types/src/ticle/ticleList.ts @@ -0,0 +1,27 @@ +import { z } from 'zod'; + +const TicleSchema = z.object({ + id: z.number(), + title: z.string(), + tags: z.array(z.string()), + startTime: z.string().datetime(), + endTime: z.string().datetime(), + speakerName: z.string(), + applicantsCount: z.number(), + createdAt: z.string().datetime(), +}); + +const MetaSchema = z.object({ + page: z.number(), + take: z.number(), + totalItems: z.number(), + totalPages: z.number(), + hasNextPage: z.boolean(), +}); + +export const TicleListResponseSchema = z.object({ + ticles: z.array(TicleSchema), + meta: MetaSchema, +}); + +export type TicleListResponse = z.infer; From d2247143300c9835fed1c673d9058371b428a28b Mon Sep 17 00:00:00 2001 From: Eunseo Sim <55528304+simeunseo@users.noreply.github.com> Date: Sun, 24 Nov 2024 00:26:23 +0900 Subject: [PATCH 006/161] =?UTF-8?q?feat:=20zod=20schema=20=EA=B2=80?= =?UTF-8?q?=EC=A6=9D=EC=9D=84=20=EC=9C=84=ED=95=9C=20api=20request=20?= =?UTF-8?q?=EC=9C=A0=ED=8B=B8=20=ED=95=A8=EC=88=98=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/package.json | 3 ++- apps/web/src/hooks/api/request.ts | 32 +++++++++++++++++++++++++++++++ apps/web/src/routes/index.tsx | 16 ++-------------- 3 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 apps/web/src/hooks/api/request.ts diff --git a/apps/web/package.json b/apps/web/package.json index 3572354c..f261b92c 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -33,7 +33,8 @@ "react-dom": "^18.3.1", "react-hook-form": "^7.53.2", "socket.io-client": "^4.8.1", - "tailwind-merge": "^2.5.4" + "tailwind-merge": "^2.5.4", + "zod": "^3.23.8" }, "devDependencies": { "@chromatic-com/storybook": "^3.2.2", diff --git a/apps/web/src/hooks/api/request.ts b/apps/web/src/hooks/api/request.ts new file mode 100644 index 00000000..c265b1a5 --- /dev/null +++ b/apps/web/src/hooks/api/request.ts @@ -0,0 +1,32 @@ +import { AxiosRequestConfig } from 'axios'; +import { z } from 'zod'; + +import axiosInstance from '@/api/axios'; + +const request = async ({ + schema, + ...config +}: AxiosRequestConfig & { + schema: z.ZodType; +}) => { + const { data: response } = await axiosInstance.request(config); + + const validation = schema.safeParse(response.data); + + if (!validation.success) { + const errorDetails = validation.error.issues.map((issue) => ({ + path: issue.path.join('.'), + error: issue.message, + received: issue.path.reduce((obj, key) => obj?.[key], response.data), + })); + + console.error( + `서버 응답이 정의된 스키마와 일치하지 않습니다. (${config.method} ${config.url})`, + JSON.stringify(errorDetails, null, 2) + ); + } + + return response.data; +}; + +export default request; diff --git a/apps/web/src/routes/index.tsx b/apps/web/src/routes/index.tsx index daf47308..56d2dc93 100644 --- a/apps/web/src/routes/index.tsx +++ b/apps/web/src/routes/index.tsx @@ -1,6 +1,6 @@ import { createFileRoute, Link } from '@tanstack/react-router'; -import TextArea from '@/components/common/TextArea'; +import TicleList from '@/components/ticle/list/TicleList'; export const Route = createFileRoute('/')({ component: IndexPage, @@ -9,19 +9,7 @@ export const Route = createFileRoute('/')({ function IndexPage() { return ( <> - 티클 개설하기 -