feat: Implement repositories for authentication, certificates, metrics, and platform services
- Added AuthRepository for user and settings management with CRUD operations. - Introduced CertificateRepository to handle domains, certificates, and requirements. - Created MetricsRepository for managing metrics and logs. - Developed PlatformRepository for platform services and resources management. - Established RegistryRepository for registry and token operations. - Implemented ServiceRepository for CRUD operations on services. - Defined types and interfaces in types.ts for database interactions.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# Onebox Project Hints
|
||||
|
||||
## SSL Certificate Storage (November 2025)
|
||||
|
||||
SSL certificates are now stored directly in the SQLite database as PEM content instead of file paths:
|
||||
- `ISslCertificate` and `ICertificate` interfaces use `certPem`, `keyPem`, `fullchainPem` properties
|
||||
- Database migration 8 converted the `certificates` table schema
|
||||
- No filesystem storage for certificates - everything in DB
|
||||
- `reverseproxy.ts` reads certificate PEM content from database
|
||||
- `certmanager.ts` stores SmartACME certificates directly to database
|
||||
|
||||
## Architecture Notes
|
||||
|
||||
### Database Layer (November 2025 Refactoring)
|
||||
|
||||
The database layer has been refactored into a repository pattern:
|
||||
|
||||
**Directory Structure:**
|
||||
```
|
||||
ts/database/
|
||||
├── index.ts # Main OneboxDatabase class (composes repositories, handles migrations)
|
||||
├── types.ts # Shared types (TBindValue, TQueryFunction)
|
||||
├── base.repository.ts # Base repository class
|
||||
└── repositories/
|
||||
├── index.ts # Repository exports
|
||||
├── service.repository.ts # Services CRUD
|
||||
├── registry.repository.ts # Registries + Registry Tokens
|
||||
├── certificate.repository.ts # Domains, Certificates, Cert Requirements, SSL Certificates (legacy)
|
||||
├── auth.repository.ts # Users, Settings
|
||||
├── metrics.repository.ts # Metrics, Logs
|
||||
└── platform.repository.ts # Platform Services, Platform Resources
|
||||
```
|
||||
|
||||
**Import paths:**
|
||||
- Main: `import { OneboxDatabase } from './database/index.ts'`
|
||||
- Legacy (deprecated): `import { OneboxDatabase } from './classes/database.ts'` (re-exports from new location)
|
||||
|
||||
**API Compatibility:**
|
||||
- The `OneboxDatabase` class maintains the same public API
|
||||
- All methods delegate to the appropriate repository
|
||||
- No breaking changes for existing code
|
||||
|
||||
## Current Migration Version: 8
|
||||
|
||||
Migration 8 converted certificate storage from file paths to PEM content.
|
||||
|
||||
Reference in New Issue
Block a user