Merge remote-tracking branch 'origin/master' into eric_front_and_back
This commit is contained in:
@@ -24,10 +24,12 @@ export class AuthenticationService {
|
||||
if (!check_name)
|
||||
return await this.userService.create(createUsersDto);
|
||||
let createUsersDtoWithUsername : CreateUsersDto = createUsersDto;
|
||||
let i = 0;
|
||||
while (check_name === true)
|
||||
{
|
||||
createUsersDtoWithUsername = { ...createUsersDto, username: createUsersDto.username + randomUUID() };
|
||||
createUsersDtoWithUsername = { ...createUsersDto, username: createUsersDto.username + '_' + i};
|
||||
check_name = await this.userService.isUsernameExists(createUsersDtoWithUsername.username);
|
||||
i++;
|
||||
}
|
||||
return this.userService.create(createUsersDtoWithUsername);
|
||||
}
|
||||
|
||||
@@ -372,11 +372,14 @@ export class ChatService {
|
||||
async getListBlockUser(username: string): Promise<string[]>
|
||||
{
|
||||
printCaller("-- in ");
|
||||
|
||||
let users: string[] = [];
|
||||
let user = await this.getUserByName(username);
|
||||
let friends_users = await this.friendshipService.findAllBlockedFriends(user.id);
|
||||
let users = friends_users.map(user => user.receiverUsername);
|
||||
|
||||
console.log("USERNAME CHAT SRVICE " + username);
|
||||
let friends_users;
|
||||
if (user)
|
||||
friends_users = await this.friendshipService.findAllBlockedFriends(user.id);
|
||||
if (friends_users)
|
||||
users = friends_users.map(user => user.receiverUsername);
|
||||
printCaller("-- out ");
|
||||
return users;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { IsBoolean, IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||||
import { IsBoolean, Matches, MaxLength, IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||||
import { isSet } from 'util/types';
|
||||
|
||||
export class CreateUsersDto {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@Matches(/^[a-zA-Z0-9'-_]+$/)
|
||||
@MaxLength(50)
|
||||
readonly username: string;
|
||||
readonly fortyTwoId: string;
|
||||
@IsEmail()
|
||||
|
||||
Reference in New Issue
Block a user