Skip to content

Commit

Permalink
fix(#31): users could not use spaces in their character names
Browse files Browse the repository at this point in the history
  • Loading branch information
cbartel-ci committed Dec 1, 2021
1 parent 99e4d40 commit 8741156
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions server/src/login/dto/user.create.dto.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { IsAlpha, IsNotEmpty } from 'class-validator';
import { IsString, Matches, MaxLength, MinLength } from 'class-validator';
import { CreateUser } from '@nw-company-tool/model';

export class CreateUserDto implements CreateUser {
@IsAlpha()
@IsNotEmpty()
@Matches(/^[a-zA-Z0-9\s]+$/)
@MinLength(2)
@MaxLength(24)
@IsString()
characterName: string;
}
8 changes: 5 additions & 3 deletions server/src/user/dto/charactername.set.dto.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { IsAlpha, IsNotEmpty } from 'class-validator';
import { IsString, Matches, MaxLength, MinLength } from 'class-validator';
import { SetCharacterName } from '@nw-company-tool/model';

export class SetCharacterNameDto implements SetCharacterName {
@IsAlpha()
@IsNotEmpty()
@Matches(/^[a-zA-Z0-9\s]+$/)
@MinLength(2)
@MaxLength(24)
@IsString()
characterName: string;
}

0 comments on commit 8741156

Please sign in to comment.