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

refactor: remove unnecessary joins in getUserByFirebaseId method #646

Merged
merged 1 commit into from
Oct 1, 2024
Merged
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
19 changes: 3 additions & 16 deletions src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,9 @@ export class UserService {
userEntity: UserEntity | undefined;
userDto: GetUserDto | undefined;
}> {
const queryResult = await this.userRepository
.createQueryBuilder('user')
.leftJoinAndSelect('user.partnerAccess', 'partnerAccess')
.leftJoinAndSelect('user.partnerAdmin', 'partnerAdmin')
.leftJoinAndSelect('partnerAccess.therapySession', 'therapySession')
.leftJoinAndSelect('partnerAccess.partner', 'partner')
.leftJoinAndSelect('partnerAccess.partner', 'partnerAccessPartner')
.leftJoinAndSelect('partnerAdmin.partner', 'partnerAdminPartner')
.leftJoinAndSelect('user.courseUser', 'courseUser')
.leftJoinAndSelect('courseUser.course', 'course')
.leftJoinAndSelect('courseUser.sessionUser', 'sessionUser')
.leftJoinAndSelect('sessionUser.session', 'session')
.leftJoinAndSelect('user.subscriptionUser', 'subscriptionUser')
.leftJoinAndSelect('subscriptionUser.subscription', 'subscription')
.where('user.firebaseUid = :uid', { uid })
.getOne();
const queryResult = await this.userRepository.findOneBy({
firebaseUid: uid,
});

if (!queryResult) {
throw new HttpException('USER NOT FOUND', HttpStatus.NOT_FOUND);
Expand Down
Loading