50 lines
2.0 KiB
PowerShell
50 lines
2.0 KiB
PowerShell
# Fix all simple imports to use MongoDB services
|
|
|
|
$replacements = @{
|
|
'from ''@services/activity.service''' = 'from ''@services/activity.mongo.service'''
|
|
'from ''../services/activity.service''' = 'from ''../services/activity.mongo.service'''
|
|
'from ''@services/notification.service''' = 'from ''@services/notification.mongo.service'''
|
|
'from ''../services/notification.service''' = 'from ''../services/notification.mongo.service'''
|
|
'from ''@services/configReader.service''' = 'from ''@services/configReader.mongo.service'''
|
|
'from ''../services/configReader.service''' = 'from ''../services/configReader.mongo.service'''
|
|
'from ''./configReader.service''' = 'from ''./configReader.mongo.service'''
|
|
'from ''../services/holiday.service''' = 'from ''../services/holiday.mongo.service'''
|
|
'from ''../services/workflow.service''' = 'from ''../services/workflow.service.mongo'''
|
|
'from ''../services/worknote.service''' = 'from ''../services/worknote.mongo.service'''
|
|
|
|
# Service instance renames
|
|
'\bactivityService\b' = 'activityMongoService'
|
|
'\bnotificationService\b' = 'notificationMongoService'
|
|
'\bholidayService\b' = 'holidayMongoService'
|
|
'\bworkNoteService\b' = 'workNoteMongoService'
|
|
}
|
|
|
|
$files = @(
|
|
'src/controllers/conclusion.controller.ts',
|
|
'src/controllers/document.controller.ts',
|
|
'src/controllers/notification.controller.ts',
|
|
'src/controllers/tat.controller.ts',
|
|
'src/routes/workflow.routes.ts',
|
|
'src/emailtemplates/emailPreferences.helper.ts',
|
|
'src/routes/debug.routes.ts',
|
|
'src/services/ai.service.ts',
|
|
'src/utils/tatTimeUtils.ts'
|
|
)
|
|
|
|
foreach ($file in $files) {
|
|
if (Test-Path $file) {
|
|
$content = Get-Content $file -Raw
|
|
|
|
foreach ($key in $replacements.Keys) {
|
|
$content = $content -replace $key, $replacements[$key]
|
|
}
|
|
|
|
Set-Content $file $content -NoNewline
|
|
Write-Host "✓ Updated: $file"
|
|
} else {
|
|
Write-Host "✗ Not found: $file"
|
|
}
|
|
}
|
|
|
|
Write-Host "`n✅ Import replacements complete!"
|