Closed Bonapara closed 1 month ago
Disclaimer: This comment was automatically generated with AI. It can give some useful hints as to where to look for, but sometimes it can also give very inaccurate answers so takes this with a pinch of salt :).
To trim whitespace at the beginning and end of strings for user input fields, follow these steps:
Locate DTO Files: The relevant DTO files for user input fields are located in the src/dto
directory.
Modify Setters or Validation Decorators: Implement trimming of whitespace in the setters or validation decorators for these fields. For example, in src/dto/UserInput.dto.ts
, modify the email field as follows:
import { IsEmail } from 'class-validator';
export class UserInputDTO {
private _email: string;
@IsEmail()
set email(value: string) {
this._email = value.trim();
}
get email(): string {
return this._email;
}
}
Should be solved as we added validation on emails! It doesn't trim but displays red borders
Current Behavior
I can create an email that has spaces at the end: "example@test.com "
Desired Behavior
We want to automatically remove spaces at the beginning and end of every field input.