完成后端登录dto验证

This commit is contained in:
2025-05-06 22:52:51 +08:00
parent cab4fdb6e1
commit 94cc8feda8
30 changed files with 7027 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import { BadRequestException, Injectable } from '@nestjs/common';
import { LoginDto } from './dto/login.dto';
@Injectable()
export class AuthService {
async loginWithPassword(loginDto: LoginDto) {
const { account, password } = loginDto;
if (!account || !password) {
throw new BadRequestException('account and password are required');
}
return { message: 'Logged in with password', data: loginDto };
}
async loginWithPhone(loginDto: LoginDto) {
const { phone, code } = loginDto;
if (!phone || !code) {
throw new BadRequestException('Phone number and code are required');
}
return { message: 'Logged in with phone', data: loginDto };
}
async loginWithEmail(loginDto: LoginDto) {
const { email, code } = loginDto;
if (!email || !code) {
throw new BadRequestException('Email and code are required');
}
return { message: 'Logged in with email', data: loginDto };
}
}