empty auth

This commit is contained in:
sdraris 2025-08-26 11:21:30 +02:00
parent 963797c7ae
commit 16aed5a76d
7 changed files with 0 additions and 112 deletions

View File

@ -1,18 +0,0 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AuthController } from './auth.controller';
describe('AuthController', () => {
let controller: AuthController;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [AuthController],
}).compile();
controller = module.get<AuthController>(AuthController);
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});

View File

@ -1,22 +0,0 @@
import { Body, Controller, Get, Post } from '@nestjs/common';
import { AuthService } from './auth.service';
import { LoginDto } from './dto/login.dto';
import { RegisterDto } from './dto/register.dto';
@Controller('auth')
export class AuthController {
constructor(private readonly authService: AuthService) {}
//Route pour se connecter
@Post('login')
login(@Body() loginDto: LoginDto) {
return this.authService.login(loginDto);
}
//Route pour s'inscrire
@Post('register')
register(@Body() registerDto: RegisterDto) {
return this.authService.register(registerDto);
}
}

View File

@ -1,9 +0,0 @@
import { Module } from '@nestjs/common';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
@Module({
controllers: [AuthController],
providers: [AuthService]
})
export class AuthModule {}

View File

@ -1,18 +0,0 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AuthService } from './auth.service';
describe('AuthService', () => {
let service: AuthService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [AuthService],
}).compile();
service = module.get<AuthService>(AuthService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
});

View File

@ -1,21 +0,0 @@
import { Injectable } from '@nestjs/common';
import { LoginDto } from './dto/login.dto';
import { RegisterDto } from './dto/register.dto';
@Injectable()
export class AuthService {
register(registerDto: RegisterDto) {
return {
message: `User registered successfully ${registerDto}`,
user: registerDto,
};
}
login(loginDto: LoginDto) {
return {
message: `Login successful ${loginDto.email}`,
user: loginDto,
};
}
}

View File

@ -1,9 +0,0 @@
import { IsEmail, MinLength } from 'class-validator';
export class LoginDto {
@IsEmail()
email: string;
@MinLength(8)
password: string;
}

View File

@ -1,15 +0,0 @@
import { IsEmail, IsNotEmpty, MaxLength, MinLength } from "class-validator";
export class RegisterDto {
@IsEmail()
email: string;
@IsNotEmpty()
username: string;
@MinLength(8)
password: string;
}