@@ -9,21 +9,30 @@ import { UserGroup } from '../entities/UserGroup';
|
||||
export class CreateUser {
|
||||
@IsString()
|
||||
firstname: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
middlename?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
username?: string;
|
||||
|
||||
@IsPhoneNumber("ZZ")
|
||||
@IsOptional()
|
||||
phone?: string;
|
||||
|
||||
@IsString()
|
||||
password: string;
|
||||
|
||||
@IsString()
|
||||
lastname: string;
|
||||
|
||||
@IsEmail()
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
email?: string;
|
||||
|
||||
@IsOptional()
|
||||
groupId?: number[] | number
|
||||
|
||||
@@ -58,15 +67,14 @@ export class CreateUser {
|
||||
}
|
||||
}
|
||||
|
||||
const new_uuid = uuid.v4()
|
||||
|
||||
newUser.email = this.email
|
||||
newUser.username = this.username
|
||||
newUser.firstname = this.firstname
|
||||
newUser.middlename = this.middlename
|
||||
newUser.lastname = this.lastname
|
||||
newUser.uuid = new_uuid
|
||||
newUser.password = await argon2.hash(this.password + new_uuid);
|
||||
newUser.uuid = uuid.v4()
|
||||
newUser.phone = this.phone
|
||||
newUser.password = await argon2.hash(this.password + newUser.uuid);
|
||||
|
||||
console.log(newUser)
|
||||
return newUser;
|
||||
|
||||
Reference in New Issue
Block a user