fix
This commit is contained in:
1 parent
feebf7d3c1
commit
486502852e
41 files changed
+1311
-259
No files matched your search
@@ -29,6 +29,7 @@ type CreateInput struct {
|
||||
SyncFrequencyHours int // legacy alias; converted to minutes when SyncIntervalMinutes unset
|
||||
Options map[string]any
|
||||
RequestHeaders map[string]string
|
||||
ContentLanguage string
|
||||
}
|
||||
|
||||
func (s *Service) List(ctx context.Context, companyID uuid.UUID, limit, offset int, q string) ([]map[string]any, int64, int64, int64, error) {
|
||||
@@ -121,6 +122,9 @@ func (s *Service) Create(ctx context.Context, companyID uuid.UUID, in CreateInpu
|
||||
if opts == nil {
|
||||
opts = map[string]any{}
|
||||
}
|
||||
if in.ContentLanguage != "" {
|
||||
opts["content_language"] = in.ContentLanguage
|
||||
}
|
||||
if len(in.RequestHeaders) > 0 {
|
||||
encrypted, err := encryptFeedHeaders(in.RequestHeaders)
|
||||
if err != nil {
|
||||
@@ -336,6 +340,10 @@ func (s *Service) Update(ctx context.Context, companyID, id uuid.UUID, body map[
|
||||
}
|
||||
}
|
||||
|
||||
contentLanguage := ""
|
||||
if raw, ok := body["content_language"].(string); ok {
|
||||
contentLanguage = strings.ToLower(strings.TrimSpace(raw))
|
||||
}
|
||||
var encryptedHeaders *string
|
||||
if rawHeaders, exists := body["request_headers"]; exists {
|
||||
headers := map[string]string{}
|
||||
@@ -364,10 +372,10 @@ func (s *Service) Update(ctx context.Context, companyID, id uuid.UUID, body map[
|
||||
(CASE WHEN $8 <> '' THEN COALESCE(options, '{}'::jsonb) || jsonb_build_object('item_path', to_jsonb($8::text)) ELSE COALESCE(options, '{}'::jsonb) END) - 'request_headers_encrypted'
|
||||
ELSE
|
||||
(CASE WHEN $8 <> '' THEN COALESCE(options, '{}'::jsonb) || jsonb_build_object('item_path', to_jsonb($8::text)) ELSE COALESCE(options, '{}'::jsonb) END) || jsonb_build_object('request_headers_encrypted', $9::text)
|
||||
END,
|
||||
END || CASE WHEN $10::text <> '' THEN jsonb_build_object('content_language', $10::text) ELSE '{}'::jsonb END,
|
||||
updated_at = now()
|
||||
WHERE id = $1 AND company_id = $2`,
|
||||
id, companyID, name, url, status, feedType, interval, strings.TrimSpace(itemPath), encryptedHeaders)
|
||||
id, companyID, name, url, status, feedType, interval, strings.TrimSpace(itemPath), encryptedHeaders, contentLanguage)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user