From 5dbc076bb84bd6ca1af6918be4750d01049b2f97 Mon Sep 17 00:00:00 2001 From: 5tarry Date: Thu, 7 Dec 2023 15:45:18 +0900 Subject: [PATCH 1/3] =?UTF-8?q?refactor=20:=20=EB=B9=84=EB=94=94=EC=98=A4?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: msjang4 --- server/.gitignore | 5 +++++ server/src/presigned-url/presigned-url.controller.ts | 5 +++++ server/src/presigned-url/presigned-url.service.ts | 9 +++++++++ server/src/user/user.service.ts | 10 +++++++--- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/server/.gitignore b/server/.gitignore index a2e6062..4b5c03b 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -35,3 +35,8 @@ lerna-debug.log* !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json + +src/ncpAPI/test.ts +src/test.py +src/video/common.response.dto.ts +src/video/video.decorator.ts diff --git a/server/src/presigned-url/presigned-url.controller.ts b/server/src/presigned-url/presigned-url.controller.ts index 8c8bbfb..8942f38 100644 --- a/server/src/presigned-url/presigned-url.controller.ts +++ b/server/src/presigned-url/presigned-url.controller.ts @@ -88,4 +88,9 @@ export class PresignedUrlController { ) { return this.presignedUrlService.getImagePresignedUrl(id, query); } + + @Get('test/issue/:id') + getVideoPresignedUrl(@Param('id') id: string) { + return this.presignedUrlService.getVideoPresignedUrl(id); + } } diff --git a/server/src/presigned-url/presigned-url.service.ts b/server/src/presigned-url/presigned-url.service.ts index 7d5012e..2a24046 100644 --- a/server/src/presigned-url/presigned-url.service.ts +++ b/server/src/presigned-url/presigned-url.service.ts @@ -91,4 +91,13 @@ export class PresignedUrlService { ); return { presignedUrl }; } + + async getVideoPresignedUrl(id: string) { + const presignedUrl = await createPresignedUrl( + 'test3-bucket', + id, + 'GET', + ); + return { presignedUrl }; + } } diff --git a/server/src/user/user.service.ts b/server/src/user/user.service.ts index 25d6104..7b0db08 100644 --- a/server/src/user/user.service.ts +++ b/server/src/user/user.service.ts @@ -93,6 +93,10 @@ export class UserService { async getUploadedVideos(uuid: string, limit: number, lastId: string) { const uploaderData = await this.UserModel.findOne({ uuid }, { actions: 0 }); + if (!uploaderData) { + throw new UserNotFoundException(); + } + const { uploader, uploaderId } = await this.getUploaderInfo( uuid, uploaderData.toObject(), @@ -204,9 +208,9 @@ export class UserService { const videoData = await this.VideoModel.findOne({ _id: action.videoId, }).populate('uploaderId', '-_id -actions'); - const video = await this.videoService.getVideoInfo( - videoData.toObject(), - ); + const video = videoData + ? await this.videoService.getVideoInfo(videoData.toObject()) + : { video: null, uploader: null }; return { ...video, ratedAt: action.updatedAt }; }), ); From 1a4c4d4dac9644342e03c32f7d0d29e3f334e70b Mon Sep 17 00:00:00 2001 From: 5tarry Date: Thu, 7 Dec 2023 15:55:03 +0900 Subject: [PATCH 2/3] =?UTF-8?q?chore=20:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/presigned-url/presigned-url.controller.ts | 5 ----- server/src/presigned-url/presigned-url.service.ts | 9 --------- 2 files changed, 14 deletions(-) diff --git a/server/src/presigned-url/presigned-url.controller.ts b/server/src/presigned-url/presigned-url.controller.ts index 8942f38..8c8bbfb 100644 --- a/server/src/presigned-url/presigned-url.controller.ts +++ b/server/src/presigned-url/presigned-url.controller.ts @@ -88,9 +88,4 @@ export class PresignedUrlController { ) { return this.presignedUrlService.getImagePresignedUrl(id, query); } - - @Get('test/issue/:id') - getVideoPresignedUrl(@Param('id') id: string) { - return this.presignedUrlService.getVideoPresignedUrl(id); - } } diff --git a/server/src/presigned-url/presigned-url.service.ts b/server/src/presigned-url/presigned-url.service.ts index 2a24046..7d5012e 100644 --- a/server/src/presigned-url/presigned-url.service.ts +++ b/server/src/presigned-url/presigned-url.service.ts @@ -91,13 +91,4 @@ export class PresignedUrlService { ); return { presignedUrl }; } - - async getVideoPresignedUrl(id: string) { - const presignedUrl = await createPresignedUrl( - 'test3-bucket', - id, - 'GET', - ); - return { presignedUrl }; - } } From 12dba277a684f1977c1f9217e87d81aad98d2ecb Mon Sep 17 00:00:00 2001 From: 5tarry Date: Thu, 7 Dec 2023 15:56:19 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat=20:=20swagger=20api=20=ED=83=9C?= =?UTF-8?q?=EA=B7=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/auth/auth.controller.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/src/auth/auth.controller.ts b/server/src/auth/auth.controller.ts index 68b16ec..f7bc759 100644 --- a/server/src/auth/auth.controller.ts +++ b/server/src/auth/auth.controller.ts @@ -18,6 +18,7 @@ import { SigninRequestDto } from './dto/signin-request.dto'; import { RefreshRequestDto } from './dto/refresh-request.dto'; import { RefreshResponseDto } from './dto/refresh-response.dto'; +@ApiTags('AUTH') @Controller('auth') export class AuthController { constructor( @@ -29,7 +30,6 @@ export class AuthController { * 회원가입 */ @Post('signup') - @ApiTags('AUTH') @ApiSuccessResponse(201, '회원가입 성공', SignupResponseDto) @ApiFailResponse('인증 실패', [OAuthFailedException]) @ApiFailResponse('업로드 필요', [ProfileUploadRequiredException]) @@ -44,7 +44,6 @@ export class AuthController { * 로그인 */ @Post('login') - @ApiTags('AUTH') @ApiSuccessResponse(201, '로그인 성공', SigninResponseDto) @ApiFailResponse('인증 실패', [LoginFailException, OAuthFailedException]) signin( @@ -57,7 +56,6 @@ export class AuthController { * 토큰 재발급 */ @Post('refresh') - @ApiTags('AUTH') @ApiSuccessResponse(201, '토큰 재발급 성공', RefreshResponseDto) @ApiFailResponse('인증 실패', [InvalidRefreshTokenException]) refresh(