Skip to content

Conversation

@vncloudsco
Copy link
Contributor

No description provided.

vncloudsco and others added 14 commits October 6, 2025 15:02
* feat: Update Features Backup & Restore
* feat: Update Features Backup & Restore
* feat: Update software
* feat: Update Features Backup & Restore
* Refactor services to use centralized API module and token storage

* Feat: Enhance Slave Mode UI with mode switch button and update node mode mutation

* feat: Improve SSLDialog layout with enhanced text wrapping for certificate fields
* feat: Update project goal description and remove security recommendation
* feat: Update project goal description and remove security recommendation
* feat: Update project goal description and remove security recommendation
* Refactor code structure for improved readability and maintainability
Copilot AI review requested due to automatic review settings October 8, 2025 01:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This is a major refactoring PR that reorganizes the API codebase from a flat controller-based structure to a domain-driven architecture. The primary purpose is to improve code organization, maintainability, and separation of concerns.

Key changes include:

  • Restructuring the codebase into domain-based modules (auth, alerts, backup, cluster, dashboard, domains, logs, modsec)
  • Implementing proper separation of concerns with controllers, services, repositories, and DTOs
  • Adding comprehensive type definitions and interfaces
  • Extracting business logic from controllers into dedicated service layers

Reviewed Changes

Copilot reviewed 141 out of 250 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/api/src/domains/modsec/ New ModSecurity domain with DTOs for rule management and CORS configuration
apps/api/src/domains/logs/ Logs domain with refactored service layer and extracted log parsing utilities
apps/api/src/domains/domains/ Domain management with nginx config generation and upstream health services
apps/api/src/domains/dashboard/ Dashboard domain with metrics collection and statistics services
apps/api/src/domains/cluster/ Cluster management with node synchronization and slave authentication
apps/api/src/domains/backup/ Backup system with comprehensive restore/import functionality
apps/api/src/domains/auth/ Authentication domain with complete 2FA and token management
apps/api/src/domains/alerts/ Alerts system with notification services and monitoring capabilities

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

id: `modsec_${Date.now()}_${index}`,
timestamp,
level,
type: 'error',
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log type 'error' is inconsistent with the ParsedLogEntry type definition. ModSecurity logs should use 'security' or 'modsecurity' type instead of 'error' to properly categorize security-related events.

Suggested change
type: 'error',
type: 'security',

Copilot uses AI. Check for mistakes.
responseTime?: number;
}
import logger from '../../utils/logger';
import prisma from '../../config/database';
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing import validation. The imports should be verified to exist and the file should handle potential import failures gracefully.

Suggested change
import prisma from '../../config/database';
let prisma: any;
try {
prisma = require('../../config/database').default || require('../../config/database');
} catch (error) {
logger.error("Failed to import prisma from '../../config/database':", error);
prisma = null;
}

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

Coverage Report for apps/api

Status Category Percentage Covered / Total
🔵 Lines 4.45% 531 / 11921
🔵 Statements 4.45% 531 / 11921
🔵 Functions 58.97% 92 / 156
🔵 Branches 64.97% 141 / 217
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/api/vitest.config.ts 0% 0% 0% 0% 1-32
apps/api/prisma/seed-safe.ts 0% 0% 0% 0% 1-253
apps/api/src/index.ts 0% 0% 0% 0% 1-104
apps/api/src/domains/account/account.controller.ts 0% 100% 100% 0% 2-392
apps/api/src/domains/account/account.repository.ts 0% 0% 0% 0% 1-185
apps/api/src/domains/account/account.service.ts 0% 0% 0% 0% 1-292
apps/api/src/domains/account/account.types.ts 100% 100% 100% 100%
apps/api/src/domains/account/account.validation.ts 0% 0% 0% 0% 1-62
apps/api/src/domains/account/index.ts 0% 100% 100% 0% 7-9
apps/api/src/domains/account/services/two-factor.service.ts 0% 0% 0% 0% 1-61
apps/api/src/domains/acl/acl.controller.ts 0% 100% 100% 0% 2-215
apps/api/src/domains/acl/acl.repository.ts 0% 0% 0% 0% 1-110
apps/api/src/domains/acl/acl.service.ts 0% 0% 0% 0% 1-125
apps/api/src/domains/acl/acl.types.ts 0% 100% 100% 0% 7-30
apps/api/src/domains/acl/index.ts 0% 100% 100% 0% 5-11
apps/api/src/domains/acl/services/acl-nginx.service.ts 0% 0% 0% 0% 1-272
apps/api/src/domains/alerts/alerts.controller.ts 0% 100% 100% 0% 8-294
apps/api/src/domains/alerts/alerts.repository.ts 0% 100% 100% 0% 6-227
apps/api/src/domains/alerts/alerts.service.ts 0% 100% 100% 0% 6-250
apps/api/src/domains/alerts/alerts.types.ts 100% 100% 100% 100%
apps/api/src/domains/alerts/index.ts 0% 100% 100% 0% 6-24
apps/api/src/domains/auth/auth.controller.ts 80% 71.42% 100% 80% 50-60, 105-113, 145-146, 197-201
apps/api/src/domains/auth/auth.repository.ts 97.91% 91.66% 100% 97.91% 133-134
apps/api/src/domains/auth/auth.routes.ts 100% 100% 100% 100%
apps/api/src/domains/auth/auth.service.ts 100% 100% 100% 100%
apps/api/src/domains/auth/auth.types.ts 100% 100% 100% 100%
apps/api/src/domains/auth/index.ts 0% 100% 100% 0% 4-8
apps/api/src/domains/backup/backup.controller.ts 0% 100% 100% 0% 3-384
apps/api/src/domains/backup/backup.repository.ts 0% 0% 0% 0% 1-385
apps/api/src/domains/backup/backup.routes.ts 0% 0% 0% 0% 1-107
apps/api/src/domains/backup/backup.service.ts 0% 0% 0% 0% 1-1095
apps/api/src/domains/backup/backup.types.ts 0% 100% 100% 0% 154-160
apps/api/src/domains/backup/index.ts 0% 0% 0% 0% 1-6
apps/api/src/domains/backup/services/backup-operations.service.ts 0% 0% 0% 0% 1-475
apps/api/src/domains/cluster/cluster.controller.ts 0% 100% 100% 0% 4-119
apps/api/src/domains/cluster/cluster.repository.ts 0% 0% 0% 0% 1-503
apps/api/src/domains/cluster/cluster.routes.ts 0% 0% 0% 0% 1-61
apps/api/src/domains/cluster/cluster.service.ts 0% 0% 0% 0% 1-144
apps/api/src/domains/cluster/cluster.types.ts 100% 100% 100% 100%
apps/api/src/domains/cluster/index.ts 0% 100% 100% 0% 2-24
apps/api/src/domains/cluster/node-sync.controller.ts 0% 100% 100% 0% 4-84
apps/api/src/domains/cluster/node-sync.routes.ts 0% 0% 0% 0% 1-26
apps/api/src/domains/cluster/middleware/slave-auth.middleware.ts 0% 100% 100% 0% 2-126
apps/api/src/domains/cluster/services/node-sync.service.ts 0% 0% 0% 0% 1-118
apps/api/src/domains/cluster/services/slave-status-checker.service.ts 0% 0% 0% 0% 1-59
apps/api/src/domains/dashboard/dashboard.controller.ts 0% 100% 100% 0% 7-84
apps/api/src/domains/dashboard/dashboard.repository.ts 0% 100% 100% 0% 6-114
apps/api/src/domains/dashboard/dashboard.service.ts 0% 100% 100% 0% 5-90
apps/api/src/domains/dashboard/dashboard.types.ts 100% 100% 100% 100%
apps/api/src/domains/dashboard/index.ts 0% 100% 100% 0% 6-21
apps/api/src/domains/dashboard/services/dashboard-stats.service.ts 0% 100% 100% 0% 6-215
apps/api/src/domains/domains/domains.controller.ts 0% 100% 100% 0% 2-326
apps/api/src/domains/domains/domains.repository.ts 0% 0% 0% 0% 1-312
apps/api/src/domains/domains/domains.service.ts 0% 0% 0% 0% 1-287
apps/api/src/domains/domains/domains.types.ts 100% 100% 100% 100%
apps/api/src/domains/domains/index.ts 0% 0% 0% 0% 1-7
apps/api/src/domains/domains/services/index.ts 0% 0% 0% 0% 1-3
apps/api/src/domains/domains/services/nginx-config.service.ts 0% 0% 0% 0% 1-290
apps/api/src/domains/domains/services/nginx-reload.service.ts 0% 0% 0% 0% 1-225
apps/api/src/domains/domains/services/upstream-health.service.ts 0% 0% 0% 0% 1-36
apps/api/src/domains/logs/logs.types.ts 100% 100% 100% 100%
apps/api/src/domains/logs/services/log-parser.service.ts 0% 0% 0% 0% 1-172
apps/api/src/domains/modsec/index.ts 0% 100% 100% 0% 2-8
apps/api/src/domains/modsec/modsec.controller.ts 0% 100% 100% 0% 2-359
apps/api/src/domains/modsec/modsec.repository.ts 0% 0% 0% 0% 1-164
apps/api/src/domains/modsec/modsec.service.ts 0% 0% 0% 0% 1-406
apps/api/src/domains/modsec/modsec.types.ts 100% 100% 100% 100%
apps/api/src/domains/modsec/services/crs-rules.service.ts 0% 100% 100% 0% 7-116
apps/api/src/domains/modsec/services/index.ts 0% 0% 0% 0% 1-2
apps/api/src/domains/modsec/services/modsec-setup.service.ts 0% 0% 0% 0% 1-177
apps/api/src/domains/performance/index.ts 0% 100% 100% 0% 9-25
apps/api/src/domains/performance/performance.controller.ts 0% 100% 100% 0% 10-104
apps/api/src/domains/performance/performance.repository.ts 0% 100% 100% 0% 8-123
apps/api/src/domains/performance/performance.service.ts 0% 100% 100% 0% 8-128
apps/api/src/domains/performance/performance.types.ts 0% 100% 100% 0% 83-89
apps/api/src/domains/performance/services/metrics.service.ts 0% 100% 100% 0% 8-184
apps/api/src/domains/ssl/index.ts 0% 100% 100% 0% 2-8
apps/api/src/domains/ssl/ssl.controller.ts 0% 100% 100% 0% 3-324
apps/api/src/domains/ssl/ssl.repository.ts 0% 0% 0% 0% 1-134
apps/api/src/domains/ssl/ssl.service.ts 0% 0% 0% 0% 1-508
apps/api/src/domains/ssl/ssl.types.ts 0% 100% 100% 0% 62-67
apps/api/src/domains/ssl/services/acme.service.ts 0% 0% 0% 0% 1-273
apps/api/src/domains/system/index.ts 0% 100% 100% 0% 4-10
apps/api/src/domains/system/system-config.controller.ts 0% 100% 100% 0% 3-184
apps/api/src/domains/system/system-config.repository.ts 0% 0% 0% 0% 1-166
apps/api/src/domains/system/system-config.routes.ts 0% 0% 0% 0% 1-27
apps/api/src/domains/system/system-config.service.ts 0% 0% 0% 0% 1-328
apps/api/src/domains/system/system.controller.ts 0% 100% 100% 0% 3-123
apps/api/src/domains/system/system.service.ts 0% 0% 0% 0% 1-155
apps/api/src/domains/system/system.types.ts 100% 100% 100% 100%
apps/api/src/domains/users/users.controller.ts 0% 100% 100% 0% 3-328
apps/api/src/domains/users/users.repository.ts 0% 0% 0% 0% 1-199
apps/api/src/domains/users/users.service.ts 0% 0% 0% 0% 1-325
apps/api/src/domains/users/users.types.ts 0% 100% 100% 0% 50-77
apps/api/src/middleware/slaveAuth.ts 0% 100% 100% 0% 2-164
apps/api/src/routes/index.ts 0% 0% 0% 0% 1-48
apps/api/src/shared/constants/paths.constants.ts 0% 100% 100% 0% 4-14
apps/api/src/shared/constants/timeouts.constants.ts 0% 100% 100% 0% 4-12
apps/api/src/shared/errors/app-error.ts 92.3% 100% 83.33% 92.3% 48-50
apps/api/src/shared/errors/index.ts 0% 0% 0% 0% 1
apps/api/src/shared/utils/response.util.ts 0% 100% 100% 0% 7-48
Generated in workflow #9 for commit caeb0cc by the Vitest Coverage Report Action

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 8, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
34 Security Hotspots
5.0% Duplication on New Code (required ≤ 3%)
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@vncloudsco vncloudsco merged commit e91213b into main Oct 8, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants