Skip to content

Commit

Permalink
refactor : 비디오 삭제 및 조회 예외처리
Browse files Browse the repository at this point in the history
Co-authored-by: msjang4 <[email protected]>
  • Loading branch information
5tarry and msjang4 committed Dec 7, 2023
1 parent 789ff48 commit 5dbc076
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
5 changes: 5 additions & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions server/src/presigned-url/presigned-url.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
9 changes: 9 additions & 0 deletions server/src/presigned-url/presigned-url.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,13 @@ export class PresignedUrlService {
);
return { presignedUrl };
}

async getVideoPresignedUrl(id: string) {
const presignedUrl = await createPresignedUrl(
'test3-bucket',
id,
'GET',
);
return { presignedUrl };
}
}
10 changes: 7 additions & 3 deletions server/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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 };
}),
);
Expand Down

0 comments on commit 5dbc076

Please sign in to comment.