refactor: massive codebase stabilization, strict TS, UI/UX overhaul, and central logging

This commit is contained in:
iqubik
2026-03-28 18:33:13 +03:00
parent 388417cec9
commit 8f8a3bf724
69 changed files with 4272 additions and 1693 deletions
+19 -5
View File
@@ -1,19 +1,33 @@
import { Controller, Post, Body } from '@nestjs/common';
import {
Controller,
Post,
Body,
HttpException,
HttpStatus,
} from '@nestjs/common';
import { AuthService } from './auth.service';
import { Public } from './public.decorator';
interface LoginDto {
login: string;
password: string;
}
@Controller('auth')
export class AuthController {
constructor(private authService: AuthService) {}
@Public()
@Post('login')
async login(@Body() req) {
async login(@Body() req: LoginDto) {
const user = await this.authService.validateUser(req.login, req.password);
if (!user) {
throw new Error('Invalid credentials');
throw new HttpException(
'Неверный логин или пароль',
HttpStatus.UNAUTHORIZED,
);
}
return this.authService.login(user);
return this.authService.login(user as { login: string });
}
@Post('change-password')
@@ -27,4 +41,4 @@ export class AuthController {
await this.authService.updateAdminProfile(body.login, body.password);
return { success: true };
}
}
}