fix: replace first and last name with single field (#4915)
This commit is contained in:
@@ -7,8 +7,7 @@ describe('create user DTO', () => {
|
||||
const params: Partial<CreateUserDto> = {
|
||||
email: undefined,
|
||||
password: 'password',
|
||||
firstName: 'first name',
|
||||
lastName: 'last name',
|
||||
name: 'name',
|
||||
};
|
||||
let dto: CreateUserDto = plainToInstance(CreateUserDto, params);
|
||||
let errors = await validate(dto);
|
||||
@@ -31,8 +30,7 @@ describe('create user DTO', () => {
|
||||
const dto = plainToInstance(CreateUserDto, {
|
||||
email: someEmail,
|
||||
password: 'some password',
|
||||
firstName: 'some first name',
|
||||
lastName: 'some last name',
|
||||
name: 'some name',
|
||||
});
|
||||
const errors = await validate(dto);
|
||||
expect(errors).toHaveLength(0);
|
||||
@@ -48,8 +46,7 @@ describe('create admin DTO', () => {
|
||||
isAdmin: true,
|
||||
email: someEmail,
|
||||
password: 'some password',
|
||||
firstName: 'some first name',
|
||||
lastName: 'some last name',
|
||||
name: 'some name',
|
||||
});
|
||||
const errors = await validate(dto);
|
||||
expect(errors).toHaveLength(0);
|
||||
@@ -64,8 +61,7 @@ describe('create user oauth DTO', () => {
|
||||
const dto = plainToInstance(CreateUserOAuthDto, {
|
||||
email: someEmail,
|
||||
oauthId: 'some oauth id',
|
||||
firstName: 'some first name',
|
||||
lastName: 'some last name',
|
||||
name: 'some name',
|
||||
});
|
||||
const errors = await validate(dto);
|
||||
expect(errors).toHaveLength(0);
|
||||
|
||||
@@ -13,11 +13,7 @@ export class CreateUserDto {
|
||||
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
firstName!: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
lastName!: string;
|
||||
name!: string;
|
||||
|
||||
@Optional({ nullable: true })
|
||||
@IsString()
|
||||
@@ -45,10 +41,7 @@ export class CreateAdminDto {
|
||||
password!: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
firstName!: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
lastName!: string;
|
||||
name!: string;
|
||||
}
|
||||
|
||||
export class CreateUserOAuthDto {
|
||||
@@ -59,7 +52,5 @@ export class CreateUserOAuthDto {
|
||||
@IsNotEmpty()
|
||||
oauthId!: string;
|
||||
|
||||
firstName?: string;
|
||||
|
||||
lastName?: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
@@ -17,12 +17,7 @@ export class UpdateUserDto {
|
||||
@Optional()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
firstName?: string;
|
||||
|
||||
@Optional()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
lastName?: string;
|
||||
name?: string;
|
||||
|
||||
@Optional()
|
||||
@IsString()
|
||||
|
||||
Reference in New Issue
Block a user