69 lines
3.2 KiB
PowerShell
69 lines
3.2 KiB
PowerShell
# Enhanced script to remove client_id from entity files
|
|
Write-Host "Starting enhanced client_id removal from entity files..." -ForegroundColor Green
|
|
|
|
# List of entity files that have client_id
|
|
$entityFiles = @(
|
|
"app/database/entity/users/users.entity.go",
|
|
"app/database/entity/article_category_details/article_category_details.entity.go",
|
|
"app/database/entity/advertisement.entity.go",
|
|
"app/database/entity/activity_logs.entity.go",
|
|
"app/database/entity/articles.entity.go",
|
|
"app/database/entity/article_approvals.entity.go",
|
|
"app/database/entity/article_comments.entity.go",
|
|
"app/database/entity/audit_trails.entity.go",
|
|
"app/database/entity/article_files.entity.go",
|
|
"app/database/entity/article_categories.entity.go",
|
|
"app/database/entity/csrf_token_records.entity.go",
|
|
"app/database/entity/feedbacks.entity.go",
|
|
"app/database/entity/forgot_passwords.entity.go",
|
|
"app/database/entity/magazines.entity.go",
|
|
"app/database/entity/master_modules.entity.go",
|
|
"app/database/entity/one_time_passwords.entity.go",
|
|
"app/database/entity/magazine_files.entity.go",
|
|
"app/database/entity/master_menus.entity.go",
|
|
"app/database/entity/user_roles.entity.go",
|
|
"app/database/entity/subscription.entity.go",
|
|
"app/database/entity/user_levels.entity.go",
|
|
"app/database/entity/user_role_level_details.entity.go",
|
|
"app/database/entity/user_role_accesses.entity.go"
|
|
)
|
|
|
|
$processedFiles = 0
|
|
$totalFiles = $entityFiles.Count
|
|
|
|
foreach ($filePath in $entityFiles) {
|
|
if (Test-Path $filePath) {
|
|
$processedFiles++
|
|
Write-Progress -Activity "Processing entity files" -Status "Processing $([System.IO.Path]::GetFileName($filePath))" -PercentComplete (($processedFiles / $totalFiles) * 100)
|
|
|
|
Write-Host "Processing: $filePath" -ForegroundColor Yellow
|
|
|
|
$content = Get-Content $filePath -Raw
|
|
|
|
# More specific patterns to remove ClientId field
|
|
$content = $content -replace '\s*ClientId\s+\*uuid\.UUID\s+`json:"client_id"[^`]*`\s*\n', ''
|
|
$content = $content -replace '\s*ClientId\s+\*uuid\.UUID\s+`json:"client_id"[^`]*`\s*', ''
|
|
$content = $content -replace '\s*ClientId\s+\*uuid\.UUID\s*\n', ''
|
|
$content = $content -replace '\s*ClientId\s+\*uuid\.UUID\s*', ''
|
|
|
|
# Remove ClientId field with different patterns
|
|
$content = $content -replace '\s*ClientId\s+\*uuid\.UUID\s+`json:"client_id"[^`]*`\s*\n', ''
|
|
$content = $content -replace '\s*ClientId\s+\*uuid\.UUID\s+`json:"client_id"[^`]*`\s*', ''
|
|
|
|
# Remove uuid import if no more uuid usage
|
|
if ($content -notmatch 'uuid\.') {
|
|
$content = $content -replace '"github\.com/google/uuid"\s*\n', ''
|
|
$content = $content -replace 'github\.com/google/uuid\s*\n', ''
|
|
}
|
|
|
|
# Clean up extra empty lines
|
|
$content = $content -replace '\n\s*\n\s*\n', "`n`n"
|
|
|
|
# Write back to file
|
|
Set-Content -Path $filePath -Value $content -NoNewline
|
|
}
|
|
}
|
|
|
|
Write-Host "Enhanced entity client_id removal process completed!" -ForegroundColor Green
|
|
Write-Host "Processed $processedFiles entity files" -ForegroundColor Cyan
|