feat(inboxes): persist chatwoot working hours

This commit is contained in:
2026-06-05 05:19:36 +08:00
parent ff98202c38
commit 945782eb03
8 changed files with 347 additions and 75 deletions
+16
View File
@@ -7,6 +7,7 @@ import (
"strings"
"github.com/gin-gonic/gin"
"github.com/gochat/gochat/internal/repository"
"github.com/gochat/gochat/internal/service"
"github.com/gochat/gochat/pkg/response"
)
@@ -317,6 +318,8 @@ func applyCreateInboxForm(req *service.CreateInboxRequest, values map[string][]s
req.BusinessName = inboxStringPtr(value)
case "csat_config":
req.CsatConfig = inboxJSONObject(value)
case "working_hours":
req.WorkingHours = inboxWorkingHours(value)
}
}
}
@@ -369,6 +372,8 @@ func applyUpdateInboxForm(req *service.UpdateInboxRequest, values map[string][]s
req.BusinessName = inboxStringPtr(value)
case "csat_config":
req.CsatConfig = inboxJSONObject(value)
case "working_hours":
req.WorkingHours = inboxWorkingHours(value)
}
}
}
@@ -443,6 +448,17 @@ func inboxJSONObject(value string) map[string]any {
return data
}
func inboxWorkingHours(value string) []repository.WorkingHourUpdateParam {
if value == "" {
return nil
}
var data []repository.WorkingHourUpdateParam
if err := json.Unmarshal([]byte(value), &data); err != nil {
return nil
}
return data
}
// ========================================
// Member-action handlers (Chatwoot InboxesController member routes)
// ========================================