50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package cmd
|
|
|
|
import (
|
|
"kontor-api-gin/internal/api"
|
|
"kontor-api-gin/internal/config"
|
|
"log/slog"
|
|
|
|
"github.com/spf13/cobra"
|
|
"resty.dev/v3"
|
|
)
|
|
|
|
type Login struct {
|
|
Email string
|
|
Password string
|
|
}
|
|
|
|
type LoginResponse struct {
|
|
Token string
|
|
}
|
|
|
|
var checkCmd = &cobra.Command{
|
|
Use: "check",
|
|
Short: "Check Kontor Database",
|
|
Long: "Check Kontor Database to given file",
|
|
// Args: cobra.ExactArgs(1),
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
slog.Info("check kontor")
|
|
slog.Info("Verbosity level", "level", config.Verbose)
|
|
client := resty.New()
|
|
defer client.Close()
|
|
localServer := config.Config.Server["local"]
|
|
mainServer := config.Config.Server["main"]
|
|
|
|
localData, _ := api.GetData(localServer, config.Config.ApiVersion)
|
|
mainData, _ := api.GetData(mainServer, config.Config.ApiVersion)
|
|
|
|
slog.Info("comics local", "count", len(localData.Comic))
|
|
slog.Info("comics main", "count", len(mainData.Comic))
|
|
|
|
slog.Info("kontor.check_kontor.check_duplicate_links")
|
|
// check_duplicate_links(first_server, dirs)
|
|
slog.Info("kontor.check_kontor.check_media_dirs")
|
|
// check_media_dirs(first_server, dirs)
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(checkCmd)
|
|
}
|