Add optional chaining to user and invitedUser checks

This commit is contained in:
faris Aljohari
2025-02-04 07:24:47 -06:00
parent ef403d5ad2
commit b02b4c049c
@@ -181,7 +181,7 @@ export class InviteUserService {
where: { email },
relations: ['project'],
});
if (!user.isActive) {
if (!user?.isActive) {
throw new HttpException('This user is deleted', HttpStatus.BAD_REQUEST);
}
if (user?.project) {
@@ -195,7 +195,7 @@ export class InviteUserService {
where: { email },
relations: ['project'],
});
if (!invitedUser.isActive) {
if (!invitedUser?.isActive) {
throw new HttpException('This user is deleted', HttpStatus.BAD_REQUEST);
}
if (invitedUser?.project) {