File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export class AddUserInGroupUseCase
3434 protected async implementation ( inputData : AddUserInGroupDs ) : Promise < AddedUserInGroupDs > {
3535 const { email, groupId } = inputData ;
3636 const foundGroup = await this . _dbContext . groupRepository . findGroupById ( groupId ) ;
37- const foundUser = await this . _dbContext . userRepository . findOneUserByEmail ( email ) ;
37+ const foundUser = await this . _dbContext . userRepository . findUserByEmailWithEmailVerificationAndInvitation ( email ) ;
3838
3939 if ( foundUser && foundUser . isActive ) {
4040 const userAlreadyAdded = ! ! foundGroup . users . find ( ( u ) => u . id === foundUser . id ) ;
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ export interface IUserRepository {
2121
2222 findOneUserWithEmailVerification ( userId : string ) : Promise < UserEntity > ;
2323
24+ findUserByEmailWithEmailVerificationAndInvitation ( email : string ) : Promise < UserEntity >
25+
2426 deleteUserEntity ( user : UserEntity ) : Promise < UserEntity > ;
2527
2628 getUsersWithNotNullGCLIDsInTwoWeeks ( ) : Promise < Array < UserEntity > > ;
Original file line number Diff line number Diff line change @@ -72,6 +72,15 @@ export class UserRepository extends Repository<UserEntity> implements IUserRepos
7272 return await usersQb . getOne ( ) ;
7373 }
7474
75+ public async findUserByEmailWithEmailVerificationAndInvitation ( email : string ) : Promise < UserEntity > {
76+ const usersQb = await getRepository ( UserEntity )
77+ . createQueryBuilder ( 'user' )
78+ . leftJoinAndSelect ( 'user.email_verification' , 'email_verification' )
79+ . leftJoinAndSelect ( 'user.user_invitation' , 'user_invitation' )
80+ . where ( 'user.email = :userEmail' , { userEmail : email } ) ;
81+ return await usersQb . getOne ( ) ;
82+ }
83+
7584 public async findAllUsersInConnection (
7685 connectionId : string ,
7786 ) : Promise < Array < Omit < UserEntity , 'connections' | 'groups' > > > {
You can’t perform that action at this time.
0 commit comments