fix(openflare): serialize access log snowflake IDs as strings

- Return AccessLogView.id as string to avoid JS Number precision loss
- Store OpenFlareAccessLog IDs as uint64 with json id,string
- Update frontend AccessLogItem.id type to string
This commit is contained in:
ryan
2026-06-19 17:40:30 +08:00
parent 3187934f72
commit b6c4181c70
12 changed files with 4556 additions and 678 deletions
@@ -4,6 +4,7 @@ package observability
import (
"context"
"errors"
"strconv"
"strings"
"time"
@@ -41,7 +42,7 @@ type AccessLogQuery struct {
// AccessLogView is a single access log row.
type AccessLogView struct {
ID uint `json:"id"`
ID string `json:"id"`
NodeID string `json:"node_id"`
NodeName string `json:"node_name"`
LoggedAt time.Time `json:"logged_at"`
@@ -209,7 +210,7 @@ func ListAccessLogs(ctx context.Context, input AccessLogQuery) (*AccessLogList,
continue
}
views = append(views, AccessLogView{
ID: item.ID,
ID: formatAccessLogID(item.ID),
NodeID: item.NodeID,
NodeName: nodeNames[item.NodeID],
LoggedAt: item.LoggedAt,
@@ -634,3 +635,7 @@ func normalizeFoldMinutes(value int) (int, error) {
return 0, errors.New("fold_minutes 仅支持 3 或 5")
}
}
func formatAccessLogID(id uint64) string {
return strconv.FormatUint(id, 10)
}