Skip to content

Commit

Permalink
⚡️ :: (#178) userQuestionCount 함수
Browse files Browse the repository at this point in the history
  • Loading branch information
flower1465 committed Jul 11, 2022
1 parent 15d75f6 commit 1e2d3ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/domain/repositories/video.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ export interface VideoRepository {
countUserQuestion(userId: number): Promise<GetCountUserQuestionPresenter>;
countAnswerVideo(userId: number): Promise<GetCountUserQuestionPresenter>;
videoViews(videoId: number): Promise<void>;
userQuestionCount(userId: number): Promise<number>;
}
11 changes: 11 additions & 0 deletions src/infrastructure/repositories/video.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,4 +513,15 @@ export class DatabaseVideoRepository implements VideoRepository {
.where('id = :id', { id: videoId })
.execute();
}

async userQuestionCount(userId: number): Promise<number> {
const userQuestionCnt: number = await this.videoEntityRepository
.createQueryBuilder('video')
.select('video.id', 'videoId')
.where('video.user_id = :user_id', { user_id: userId })
.andWhere('video.question IS NULL')
.getCount();

return userQuestionCnt;
}
}

0 comments on commit 1e2d3ee

Please sign in to comment.