- Add #domain, #protocol, #utils aliases to package.json imports map - Replace all relative imports (./, ../, ../..) in app/ and database/mongo_migrations/ with the corresponding #alias imports, eliminating relative path traversal across the codebase - Remove dead code: ConfigurationVersionModel.findByConfigurationIdentifier (unused, superseded by paginateVersions) and unused exception classes (NotFoundException, UnprocessableEntityException, DatabaseException) from app/exceptions/index.ts, keeping only BadRequestException - Fix pre-existing syntax error in configuration_version.ts (mismatched parenthesis) that broke tsc - Fix eqeqeq violation in configuration_service.ts and isNaN -> Number.isNaN in configuration_engine.ts / cwmp-1-0.ts / exchange_controller.ts - Fix no-shadow violation in cwmp-1-0.ts EventStruct constructor - Prettier formatting pass on touched files Validated: tsc --noEmit clean, eslint app/ clean, full test suite green.
20 lines
864 B
TypeScript
20 lines
864 B
TypeScript
import { MongoMigration } from '#database/mongo_migrator'
|
|
|
|
export default class CreateConfigurationsCollection extends MongoMigration {
|
|
async up(): Promise<void> {
|
|
const collection = this.db.collection('configurations')
|
|
await collection.createIndex({ identifier: 1 }, { unique: true, name: 'idx_identifier' })
|
|
await collection.createIndex({ enabled: 1, priority: -1 }, { name: 'idx_enabled_priority' })
|
|
await collection.createIndex({ tags: 1 }, { name: 'idx_tags' })
|
|
await collection.createIndex({ 'criteria.productClass': 1 }, { name: 'idx_criteria_product_class' })
|
|
await collection.createIndex(
|
|
{ 'criteria.manufacturer': 1, 'criteria.productClass': 1 },
|
|
{ name: 'idx_criteria_manufacturer_product_class' }
|
|
)
|
|
}
|
|
|
|
async down(): Promise<void> {
|
|
await this.db.dropCollection('configurations').catch(() => {})
|
|
}
|
|
}
|