Merge branch 'development' into 'devops-staging'
add validation in create member See merge request empatnusabangsa/ppob/ppob-backend!15
This commit is contained in:
commit
c85199c337
|
@ -36,6 +36,21 @@ export class UsersService {
|
|||
async create(createUserDto: CreateUserDto, currentUser: any) {
|
||||
const roles = await this.roleService.findOne(createUserDto.roleId);
|
||||
const superior = await this.findByUsername(currentUser.username);
|
||||
|
||||
const check = await this.usersRepository.findOne({
|
||||
username: createUserDto.username,
|
||||
});
|
||||
|
||||
if (check) {
|
||||
throw new HttpException(
|
||||
{
|
||||
statusCode: HttpStatus.NOT_ACCEPTABLE,
|
||||
error: 'Username Already Exist',
|
||||
},
|
||||
HttpStatus.NOT_FOUND,
|
||||
);
|
||||
}
|
||||
|
||||
const salt = randomStringGenerator();
|
||||
|
||||
const userData = new User();
|
||||
|
|
Loading…
Reference in New Issue
Block a user