Skip to content

Commit

Permalink
Merge pull request #234 from boostcampwm2023/fix/deleted_video
Browse files Browse the repository at this point in the history
비디오 삭제 및 조회 예외처리
  • Loading branch information
msjang4 authored Dec 7, 2023
2 parents 789ff48 + 12dba27 commit 86fae7a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 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
4 changes: 1 addition & 3 deletions server/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -29,7 +30,6 @@ export class AuthController {
* 회원가입
*/
@Post('signup')
@ApiTags('AUTH')
@ApiSuccessResponse(201, '회원가입 성공', SignupResponseDto)
@ApiFailResponse('인증 실패', [OAuthFailedException])
@ApiFailResponse('업로드 필요', [ProfileUploadRequiredException])
Expand All @@ -44,7 +44,6 @@ export class AuthController {
* 로그인
*/
@Post('login')
@ApiTags('AUTH')
@ApiSuccessResponse(201, '로그인 성공', SigninResponseDto)
@ApiFailResponse('인증 실패', [LoginFailException, OAuthFailedException])
signin(
Expand All @@ -57,7 +56,6 @@ export class AuthController {
* 토큰 재발급
*/
@Post('refresh')
@ApiTags('AUTH')
@ApiSuccessResponse(201, '토큰 재발급 성공', RefreshResponseDto)
@ApiFailResponse('인증 실패', [InvalidRefreshTokenException])
refresh(
Expand Down
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 86fae7a

Please sign in to comment.