Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { UsersModule } from './users/users.module';
import { AuthModule } from './auth/auth.module';
import { PropertiesModule } from './properties/properties.module';
import { PrismaModule } from './database/prisma.module';
import { AppController } from './app.controller';
import { AuthModule } from './auth/auth.module';

@Module({
imports: [
Expand All @@ -14,8 +14,8 @@ import { AuthModule } from './auth/auth.module';
}),
PrismaModule,
UsersModule,
PropertiesModule,
AuthModule,
PropertiesModule,
],
controllers: [AppController],
})
Expand Down
6 changes: 5 additions & 1 deletion src/auth/dto/auth.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ import {
IsOptional,
IsString,
MinLength,
Matches,
} from 'class-validator';

export class RegisterDto {
@IsEmail()
email: string;

@IsString()
@MinLength(8)
@MinLength(8, { message: 'Password must be at least 8 characters long' })
@Matches(/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/, {
message: 'Password is too weak. It must contain at least one uppercase letter, one lowercase letter, and at least one number or special character.',
})
password: string;

@IsString()
Expand Down
26 changes: 26 additions & 0 deletions src/auth/dto/register.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { IsEmail, IsNotEmpty, IsString, MinLength, Matches } from 'class-validator';

export class RegisterDto {
@IsEmail({}, { message: 'Please provide a valid email address' })
@IsNotEmpty({ message: 'Email is required' })
email: string;

@IsString()
@MinLength(8, { message: 'Password must be at least 8 characters long' })
@Matches(/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/, {
message: 'Password is too weak. It must contain at least one uppercase letter, one lowercase letter, and at least one number or special character.',
})
password: string;

@IsString()
@IsNotEmpty({ message: 'First name is required' })
firstName: string;

@IsString()
@IsNotEmpty({ message: 'Last name is required' })
lastName: string;

@IsString()
@IsNotEmpty({ message: 'Phone number is required' })
phone: string;
}
Loading