chore: build
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user