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

비디오 삭제 및 조회 예외처리 #234

Merged
merged 3 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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