diff --git a/internal/repository/postgres.go b/internal/repository/postgres.go index 4cb6bf9..119bf5d 100644 --- a/internal/repository/postgres.go +++ b/internal/repository/postgres.go @@ -99,14 +99,17 @@ func (p *Postgres) ListModules(tenantID string) []*store.Module { for rows.Next() { var m store.Module m.TenantID = tenantID - var doh, dc *string + var doh, dc, cron *string var refresh *int32 - if err := rows.Scan(&m.ID, &m.Type, &m.Name, &m.Enabled, &m.Priority, &doh, &refresh, &m.CronExpr, &dc); err != nil { + if err := rows.Scan(&m.ID, &m.Type, &m.Name, &m.Enabled, &m.Priority, &doh, &refresh, &cron, &dc); err != nil { continue } if refresh != nil { m.RefreshIntervalSec = int(*refresh) } + if cron != nil { + m.CronExpr = *cron + } if doh != nil && *doh != "" { m.DohProfileID = doh } @@ -122,12 +125,12 @@ func (p *Postgres) GetModule(tenantID, moduleID string) (*store.Module, error) { ctx := context.Background() var m store.Module m.TenantID = tenantID - var doh, dc *string + var doh, dc, cron *string var refresh *int32 err := p.pool.QueryRow(ctx, ` SELECT id, type, name, enabled, priority, doh_profile_id::text, refresh_interval_sec, cron_expr, default_community_id::text FROM module WHERE id = $1 AND tenant_id = $2 AND deleted_at IS NULL`, moduleID, tenantID).Scan( - &m.ID, &m.Type, &m.Name, &m.Enabled, &m.Priority, &doh, &refresh, &m.CronExpr, &dc) + &m.ID, &m.Type, &m.Name, &m.Enabled, &m.Priority, &doh, &refresh, &cron, &dc) if err != nil { if errors.Is(err, pgx.ErrNoRows) { return nil, store.ErrNotFound @@ -137,6 +140,9 @@ func (p *Postgres) GetModule(tenantID, moduleID string) (*store.Module, error) { if refresh != nil { m.RefreshIntervalSec = int(*refresh) } + if cron != nil { + m.CronExpr = *cron + } if doh != nil && *doh != "" { m.DohProfileID = doh }