mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 18:27:05 +00:00
Merge pull request #243 from SyncrowIOT/check-if-user-deleted-validation
This commit is contained in:
@ -36,6 +36,9 @@ export class UserAuthService {
|
|||||||
|
|
||||||
async signUp(userSignUpDto: UserSignUpDto): Promise<UserEntity> {
|
async signUp(userSignUpDto: UserSignUpDto): Promise<UserEntity> {
|
||||||
const findUser = await this.findUser(userSignUpDto.email);
|
const findUser = await this.findUser(userSignUpDto.email);
|
||||||
|
if (!findUser.isActive) {
|
||||||
|
throw new BadRequestException('User is not active');
|
||||||
|
}
|
||||||
if (findUser) {
|
if (findUser) {
|
||||||
throw new BadRequestException('User already registered with given email');
|
throw new BadRequestException('User already registered with given email');
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,9 @@ export class InviteUserService {
|
|||||||
where: { email },
|
where: { email },
|
||||||
relations: ['project'],
|
relations: ['project'],
|
||||||
});
|
});
|
||||||
|
if (!user.isActive) {
|
||||||
|
throw new HttpException('This user is deleted', HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
if (user?.project) {
|
if (user?.project) {
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
'This email already has a project',
|
'This email already has a project',
|
||||||
@ -193,7 +195,9 @@ export class InviteUserService {
|
|||||||
where: { email },
|
where: { email },
|
||||||
relations: ['project'],
|
relations: ['project'],
|
||||||
});
|
});
|
||||||
|
if (!invitedUser.isActive) {
|
||||||
|
throw new HttpException('This user is deleted', HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
if (invitedUser?.project) {
|
if (invitedUser?.project) {
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
'This email already has a project',
|
'This email already has a project',
|
||||||
|
Reference in New Issue
Block a user