fix: safe domains scan - use time.Time for timestamp columns instead of string
This commit is contained in:
parent
43199e52bc
commit
aa0e75d35f
|
|
@ -15,6 +15,11 @@ import (
|
|||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
// formatTime formats a time.Time to a string for JSON output.
|
||||
func formatTime(t time.Time) string {
|
||||
return t.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
// LinkPreview represents the OG metadata extracted from a URL.
|
||||
type LinkPreview struct {
|
||||
URL string `json:"link_preview_url"`
|
||||
|
|
@ -330,8 +335,8 @@ type SafeDomain struct {
|
|||
Category string `json:"category"`
|
||||
IsApproved bool `json:"is_approved"`
|
||||
Notes *string `json:"notes"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// ListSafeDomains returns all safe domains, optionally filtered.
|
||||
|
|
@ -362,6 +367,7 @@ func (s *LinkPreviewService) ListSafeDomains(ctx context.Context, category strin
|
|||
for rows.Next() {
|
||||
var d SafeDomain
|
||||
if err := rows.Scan(&d.ID, &d.Domain, &d.Category, &d.IsApproved, &d.Notes, &d.CreatedAt, &d.UpdatedAt); err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to scan safe domain row")
|
||||
continue
|
||||
}
|
||||
domains = append(domains, d)
|
||||
|
|
|
|||
Loading…
Reference in a new issue