chore: build
ci-api / test (push) Failing after 8m7s
ci-web / test (push) Failing after 5m5s

This commit is contained in:
Xor290
2026-09-20 12:18:33 +02:00
parent 8f4c7fa47a
commit 919c807004
174 changed files with 9669 additions and 1308 deletions
+5 -8
View File
@@ -21,7 +21,6 @@ type settingsResponse struct {
BotTokenConfigured bool `json:"bot_token_configured"`
ChatID string `json:"chat_id"`
NotifyNewOrder bool `json:"notify_new_order"`
NotifyStatusChange bool `json:"notify_status_change"`
}
func toResponse(s *Settings) settingsResponse {
@@ -30,7 +29,6 @@ func toResponse(s *Settings) settingsResponse {
BotTokenConfigured: s.BotToken != "",
ChatID: s.ChatID,
NotifyNewOrder: s.NotifyNewOrder,
NotifyStatusChange: s.NotifyStatusChange,
}
}
@@ -44,11 +42,10 @@ func (h *Handler) Get(c *gin.Context) {
}
type updateRequest struct {
Enabled bool `json:"enabled"`
BotToken string `json:"bot_token"`
ChatID string `json:"chat_id" binding:"required_if=Enabled true"`
NotifyNewOrder bool `json:"notify_new_order"`
NotifyStatusChange bool `json:"notify_status_change"`
Enabled bool `json:"enabled"`
BotToken string `json:"bot_token"`
ChatID string `json:"chat_id" binding:"required_if=Enabled true"`
NotifyNewOrder bool `json:"notify_new_order"`
}
func (h *Handler) Update(c *gin.Context) {
@@ -57,7 +54,7 @@ func (h *Handler) Update(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"error": "validation error", "details": err.Error()})
return
}
settings, err := h.service.Update(c.Request.Context(), req.Enabled, req.BotToken, req.ChatID, req.NotifyNewOrder, req.NotifyStatusChange)
settings, err := h.service.Update(c.Request.Context(), req.Enabled, req.BotToken, req.ChatID, req.NotifyNewOrder)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to update telegram settings"})
return