forked from Ynov/ptitspas-ynov-back
user correction added if exists
This commit is contained in:
parent
31b3893ff1
commit
6b82af49ae
@ -1,4 +1,4 @@
|
||||
import { BadRequestException, ForbiddenException, Injectable, NotFoundException } from "@nestjs/common";
|
||||
import { BadRequestException, ConflictException, ForbiddenException, Injectable, NotFoundException } from "@nestjs/common";
|
||||
import { InjectRepository } from "@nestjs/typeorm";
|
||||
import { RoleType, StatutUtilisateurType, Users } from "src/entities/users.entity";
|
||||
import { Repository } from "typeorm";
|
||||
@ -29,6 +29,9 @@ export class UserService {
|
||||
// Déterminer si le créateur est super admin
|
||||
const isSuperAdmin = currentUser?.role === RoleType.SUPER_ADMIN;
|
||||
|
||||
const exist = await this.usersRepository.findOneBy({ email: dto.email });
|
||||
if (exist) throw new ConflictException('Email déjà utilisé');
|
||||
|
||||
let role: RoleType;
|
||||
|
||||
if (isSuperAdmin) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user