feat(inboxes): persist chatwoot working hours
This commit is contained in:
@@ -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)
|
||||
// ========================================
|
||||
|
||||
Reference in New Issue
Block a user