mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 15:12:09 +01:00
feat: complete development environment setup and code quality improvements
- Set up pre-commit hooks with husky and lint-staged for automated code quality - Improved TypeScript type safety by replacing 'any' types with proper generics - Fixed markdown linting violations (MD030 spacing) across all documentation - Fixed compound adjective hyphenation in technical documentation - Fixed invalid JSON union syntax in API documentation examples - Automated code formatting and linting on commit - Enhanced error handling with better type constraints - Configured biome and markdownlint for consistent code style - All changes verified with successful production build
This commit is contained in:
@ -68,7 +68,7 @@ export class SecurityMetricsService {
|
||||
.slice(0, 5);
|
||||
|
||||
// User risk scores - transform data to match expected format
|
||||
const transformedEvents = events.map(event => ({
|
||||
const transformedEvents = events.map((event) => ({
|
||||
userId: event.userId || undefined,
|
||||
user: event.user ? { email: event.user.email } : undefined,
|
||||
eventType: event.eventType as SecurityEventType,
|
||||
@ -76,7 +76,8 @@ export class SecurityMetricsService {
|
||||
severity: event.severity as AuditSeverity,
|
||||
country: event.country || undefined,
|
||||
}));
|
||||
const userRiskScores = await this.calculateUserRiskScores(transformedEvents);
|
||||
const userRiskScores =
|
||||
await this.calculateUserRiskScores(transformedEvents);
|
||||
|
||||
// Calculate overall security score
|
||||
const securityScore = this.calculateSecurityScore({
|
||||
@ -122,7 +123,9 @@ export class SecurityMetricsService {
|
||||
country?: string;
|
||||
}>
|
||||
): Promise<Array<{ userId: string; email: string; riskScore: number }>> {
|
||||
const userEvents = events.filter((e) => e.userId) as Array<typeof events[0] & { userId: string }>;
|
||||
const userEvents = events.filter((e) => e.userId) as Array<
|
||||
(typeof events)[0] & { userId: string }
|
||||
>;
|
||||
const userScores = new Map<
|
||||
string,
|
||||
{ email: string; score: number; events: typeof userEvents }
|
||||
|
||||
Reference in New Issue
Block a user