Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions api/internal/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@
import (
"context"
"database/sql"
"encoding/json"

Check failure on line 35 in api/internal/sync/sync.go

View workflow job for this annotation

GitHub Actions / Go Dependency Vulnerability Scan (api)

"encoding/json" imported and not used
"fmt"
"log"
"os"
"path/filepath"
"time"

"github.com/lib/pq"
"github.com/streamspace/streamspace/api/internal/db"
)

Expand Down Expand Up @@ -401,20 +402,14 @@
// Convert manifest to JSON string for storage
manifestJSON := template.Manifest

// Convert tags slice to JSON for database storage
tagsJSON, err := json.Marshal(template.Tags)
if err != nil {
return fmt.Errorf("failed to marshal tags for template %s: %w", template.Name, err)
}

_, err = tx.ExecContext(ctx, `
INSERT INTO catalog_templates (
repository_id, name, display_name, description, category,
app_type, icon_url, manifest, tags, created_at, updated_at
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
`, repoID, template.Name, template.DisplayName, template.Description,
template.Category, template.AppType, template.Icon, manifestJSON,
string(tagsJSON), time.Now(), time.Now())
pq.Array(template.Tags), time.Now(), time.Now())

if err != nil {
return fmt.Errorf("failed to insert template %s: %w", template.Name, err)
Expand Down Expand Up @@ -449,20 +444,14 @@

// Insert new plugins
for _, plugin := range plugins {
// Convert tags slice to JSON for database storage
tagsJSON, err := json.Marshal(plugin.Tags)
if err != nil {
return fmt.Errorf("failed to marshal tags for plugin %s: %w", plugin.Name, err)
}

_, err = tx.ExecContext(ctx, `
INSERT INTO catalog_plugins (
repository_id, name, version, display_name, description, category,
plugin_type, icon_url, manifest, tags, created_at, updated_at
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
`, repoID, plugin.Name, plugin.Version, plugin.DisplayName, plugin.Description,
plugin.Category, plugin.PluginType, plugin.Icon, plugin.Manifest,
string(tagsJSON), time.Now(), time.Now())
pq.Array(plugin.Tags), time.Now(), time.Now())

if err != nil {
return fmt.Errorf("failed to insert plugin %s: %w", plugin.Name, err)
Expand Down
Loading