This commit is contained in:
greeneclipse committed 2026-10-27 14:53:19 +01:00
1 parent c347d2418f
commit 1ad180a052
49 files changed
+6339 -89

No files matched your search

+12 -4
View File
@@ -157,8 +157,8 @@ func (s *Service) Create(ctx context.Context, companyID uuid.UUID, in CreateInpu
}
}
}
if feedType != "xml" && feedType != "csv" && feedType != "json" {
return nil, ClientMsg("feed_type must be xml, csv or json")
if !isSupportedFeedType(feedType) {
return nil, ClientMsg("feed_type must be xml, csv, json or excel")
}
interval := in.SyncIntervalMinutes
if interval <= 0 && in.SyncFrequencyHours > 0 {
@@ -260,6 +260,14 @@ func (s *Service) attachMappingFieldCounts(ctx context.Context, companyID uuid.U
return rows.Err()
}
func isSupportedFeedType(feedType string) bool {
switch feedType {
case "xml", "csv", "json", "excel":
return true
}
return false
}
func isCSVFeedType(feedType string) bool {
t := strings.ToLower(strings.TrimSpace(feedType))
return t == "csv" || t == "excel"
@@ -318,8 +326,8 @@ func (s *Service) Update(ctx context.Context, companyID, id uuid.UUID, body map[
return nil, err
}
feedType = strings.ToLower(strings.TrimSpace(feedType))
if feedType != "" && feedType != "xml" && feedType != "csv" && feedType != "json" {
return nil, ClientMsg("feed_type must be xml, csv or json")
if feedType != "" && !isSupportedFeedType(feedType) {
return nil, ClientMsg("feed_type must be xml, csv, json or excel")
}
interval := 0
switch v := body["sync_interval_minutes"].(type) {