kanban dashboard refactor

This commit is contained in:
Mazyar
2026-05-27 22:06:23 +03:30
parent 42cd0452ce
commit ce2dc7a61b
12 changed files with 457 additions and 176 deletions
+34
View File
@@ -7,6 +7,7 @@ import (
"tm/pkg/authorization"
"tm/pkg/config"
"tm/pkg/filestore"
"tm/pkg/gorules"
"tm/pkg/hcaptcha"
"tm/pkg/logger"
"tm/pkg/mongo"
@@ -359,3 +360,36 @@ func InitAISummarizerStorage(conf AISummarizerConfig, log logger.Logger) *ai_sum
return storage
}
// InitGoRulesClient initializes the GoRules SDK client.
func InitGoRulesClient(conf GoRulesConfig, log logger.Logger) gorules.Client {
if conf.BaseURL == "" || conf.Token == "" || conf.RuleID == "" {
log.Warn("GoRules client not configured, falling back to static Kanban statuses", map[string]interface{}{})
return nil
}
timeout := conf.Timeout
if timeout <= 0 {
timeout = 10 * time.Second
}
client, err := gorules.New(gorules.Config{
BaseURL: conf.BaseURL,
Token: conf.Token,
Timeout: timeout,
}, log)
if err != nil {
log.Error("Failed to initialize GoRules client", map[string]interface{}{
"error": err.Error(),
})
return nil
}
log.Info("GoRules client initialized successfully", map[string]interface{}{
"base_url": conf.BaseURL,
"timeout": timeout,
"rule_id": conf.RuleID,
})
return client
}