chore: apply ESLint auto-fix across entire backend
Build and Push Multi-Platform Images / build-and-push (push) Successful in 41s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 41s
Reformats code style (line breaks, indentation, type annotations) without changing logic. Also includes minor feature additions bundled in the same lint run (stats service, user-settings groups, agrarmonitor polling improvements). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
import { CanActivate, ExecutionContext, Injectable, Logger, UnauthorizedException } from '@nestjs/common';
|
||||
import {
|
||||
CanActivate,
|
||||
ExecutionContext,
|
||||
Injectable,
|
||||
Logger,
|
||||
UnauthorizedException,
|
||||
} from '@nestjs/common';
|
||||
import { ApiKeysService } from './api-keys.service';
|
||||
|
||||
@Injectable()
|
||||
@@ -33,8 +39,8 @@ export class ApiKeyGuard implements CanActivate {
|
||||
|
||||
this.logger.log(
|
||||
`[${method} ${url}] key source: ${apiKey ? source : 'NONE'} | ` +
|
||||
`headers: ${JSON.stringify(Object.keys(request.headers))} | ` +
|
||||
`key prefix: ${apiKey ? String(apiKey).slice(0, 8) + '…' : 'n/a'}`,
|
||||
`headers: ${JSON.stringify(Object.keys(request.headers))} | ` +
|
||||
`key prefix: ${apiKey ? String(apiKey).slice(0, 8) + '…' : 'n/a'}`,
|
||||
);
|
||||
|
||||
if (!apiKey) {
|
||||
@@ -44,11 +50,15 @@ export class ApiKeyGuard implements CanActivate {
|
||||
|
||||
try {
|
||||
const keyEntry = await this.apiKeysService.validateKey(apiKey as string);
|
||||
this.logger.log(`[${method} ${url}] accepted – key "${keyEntry.name}" (id=${keyEntry.id})`);
|
||||
this.logger.log(
|
||||
`[${method} ${url}] accepted – key "${keyEntry.name}" (id=${keyEntry.id})`,
|
||||
);
|
||||
request.apiKeyMetadata = { id: keyEntry.id, name: keyEntry.name };
|
||||
return true;
|
||||
} catch (err) {
|
||||
this.logger.warn(`[${method} ${url}] rejected – validation failed: ${err.message}`);
|
||||
this.logger.warn(
|
||||
`[${method} ${url}] rejected – validation failed: ${err.message}`,
|
||||
);
|
||||
throw new UnauthorizedException(err.message || 'Invalid API Key');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user