Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Added error messages with localization

Yevhenii Kulisidi80fb5e7e60fd
diff --git a/src/auth/dtos/register.dto.ts b/src/auth/dtos/register.dto.ts
index b5eebcbd0..818fbafc5 100644
--- a/src/auth/dtos/register.dto.ts
+++ b/src/auth/dtos/register.dto.ts
@@ -1,16 +1,16 @@
-import { IsBoolean, IsEmail, IsNotEmpty } from 'class-validator'
+import { IsEmail, IsNotEmpty, IsBoolean } from 'class-validator'
import { IsPassword } from '../decorators'
export namespace RegisterDto {
export class Request {
- @IsEmail()
+ @IsEmail({}, { message: 'validation.isEmail' })
public readonly email: string
- @IsPassword()
+ @IsPassword({ message: 'validation.isPassword' })
public readonly password: string
- @IsNotEmpty()
- @IsBoolean()
+ @IsNotEmpty({ message: 'validation.isNotEmpty' })
+ @IsBoolean({ message: 'validation.isBoolean' })
public readonly checkIfLeaked: boolean
}
diff --git a/src/i18n/en/validation.json b/src/i18n/en/validation.json
new file mode 100644
index 000000000..5f1b15854
--- /dev/null
+++ b/src/i18n/en/validation.json
@@ -0,0 +1,6 @@
+{
+ "isEmail": "Please enter the valid email.",
+ "isPassword": "Please enter the valid password.",
+ "isNotEmpty": "This field is required.",
+ "isBoolean": "Please enter the valid value (true or false)."
+}