Files
MyClub/cleanup_nav.sh
Tomas Dvorak dfc079288f hot fix #1
2026-01-26 08:13:18 +01:00

64 lines
1.3 KiB
Bash

#!/bin/bash
echo "=== Cleaning Unwanted Navigation Items ==="
# Run Go program to clean navigation
cd /home/tdvorak/Desktop/PROG+HTML/Fotbal/fotbal-club
# Create a temporary Go program
cat > /tmp/cleanup_nav.go << 'EOF'
package main
import (
"fmt"
"log"
"fotbal-club/internal/config"
"fotbal-club/internal/models"
"fotbal-club/pkg/database"
)
func main() {
// Load configuration
if err := config.LoadConfig(); err != nil {
log.Fatal("Failed to load config:", err)
}
// Connect to database
db := database.GetDB()
// Clean up unwanted navigation items
unwantedPageTypes := []string{
"facilities",
"equipment",
"maintenance",
}
fmt.Println("Cleaning up unwanted navigation items...")
for _, pageType := range unwantedPageTypes {
var count int64
result := db.Model(&models.NavigationItem{}).Where("page_type = ?", pageType).Delete(&models.NavigationItem{})
if result.Error != nil {
fmt.Printf("Error deleting %s: %v\n", pageType, result.Error)
} else {
count = result.RowsAffected
if count > 0 {
fmt.Printf("Deleted %d navigation items with page_type '%s'\n", count, pageType)
}
}
}
fmt.Println("Navigation cleanup completed!")
}
EOF
# Run the temporary program
echo "Running navigation cleanup..."
go run /tmp/cleanup_nav.go
# Clean up
rm /tmp/cleanup_nav.go
echo "=== Navigation Cleanup Complete ==="