test: comprehensive test suites and quality gates pass across backend, storefront and admin
- Backend (NestJS): 82 suites, 641 tests passing; 0 ESLint errors; 0 tsc errors. Hardened SSL cert/key matching, SSRF IP pinning, and eBank validation. - Admin Panel (Vite/React): 48 suites, 300 tests passing; 0 ESLint errors; 0 tsc errors. Full coverage across all pages and settings. - Storefront (Next.js): 62 suites, 368 tests passing; 0 ESLint errors; 0 tsc errors. - Fixed unmount lifecycle guards, promise error handling, and component edge cases.
This commit is contained in:
1 parent
1e73715169
commit
ddbf1ca026
439 files changed
+32911
-6107
No files matched your search
@@ -4,12 +4,12 @@ import {
|
||||
UnauthorizedException,
|
||||
Inject,
|
||||
forwardRef,
|
||||
} from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { ApiKeysService } from '../admin/api-keys.service';
|
||||
} from "@nestjs/common";
|
||||
import { AuthGuard } from "@nestjs/passport";
|
||||
import { ApiKeysService } from "../admin/api-keys.service";
|
||||
|
||||
@Injectable()
|
||||
export class JwtAuthGuard extends AuthGuard('jwt') {
|
||||
export class JwtAuthGuard extends AuthGuard("jwt") {
|
||||
constructor(
|
||||
@Inject(forwardRef(() => ApiKeysService))
|
||||
private readonly apiKeysService?: ApiKeysService,
|
||||
@@ -20,9 +20,9 @@ export class JwtAuthGuard extends AuthGuard('jwt') {
|
||||
async canActivate(context: ExecutionContext): Promise<boolean> {
|
||||
const request = context.switchToHttp().getRequest();
|
||||
const apiKeyHeader =
|
||||
request.headers['x-api-key'] ||
|
||||
(request.headers['authorization']?.startsWith('ApiKey ')
|
||||
? request.headers['authorization'].replace('ApiKey ', '').trim()
|
||||
request.headers["x-api-key"] ||
|
||||
(request.headers["authorization"]?.startsWith("ApiKey ")
|
||||
? request.headers["authorization"].replace("ApiKey ", "").trim()
|
||||
: null);
|
||||
|
||||
if (apiKeyHeader && this.apiKeysService) {
|
||||
@@ -32,7 +32,7 @@ export class JwtAuthGuard extends AuthGuard('jwt') {
|
||||
return true;
|
||||
} catch (err: unknown) {
|
||||
throw new UnauthorizedException(
|
||||
(err as Error)?.message || 'کلید API نامعتبر است',
|
||||
(err as Error)?.message || "کلید API نامعتبر است",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ export class JwtAuthGuard extends AuthGuard('jwt') {
|
||||
throw (
|
||||
(err as Error) ||
|
||||
new UnauthorizedException(
|
||||
'لطفا ابتدا وارد حساب کاربری خود شوید یا API Key معتبر ارسال کنید',
|
||||
"لطفا ابتدا وارد حساب کاربری خود شوید یا API Key معتبر ارسال کنید",
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user