fix: accept datetime-local history filters
This commit is contained in:
@@ -256,6 +256,18 @@ func TestRawFrameHandlerRejectsInvalidLimit(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseRawFrameQueryAcceptsDatetimeLocalValues(t *testing.T) {
|
||||
request := httptest.NewRequest(http.MethodGet, "/api/history/raw-frames?dateFrom=2026-07-01T00:00:00&dateTo=2026-07-02T00:00:00", nil)
|
||||
|
||||
query, err := parseRawFrameQuery(request)
|
||||
if err != nil {
|
||||
t.Fatalf("parseRawFrameQuery() error = %v", err)
|
||||
}
|
||||
if query.DateFrom != "2026-07-01 00:00:00" || query.DateTo != "2026-07-02 00:00:00" {
|
||||
t.Fatalf("date range = %q -> %q", query.DateFrom, query.DateTo)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseMessageIDSupportsDecimalAndHex(t *testing.T) {
|
||||
for raw, want := range map[string]int64{
|
||||
"512": 512,
|
||||
@@ -323,8 +335,8 @@ func TestBuildRawFrameSQLUsesLiteralsForTDengine(t *testing.T) {
|
||||
VehicleKey: "JT808:013307811350",
|
||||
VIN: "VIN'1",
|
||||
MessageID: "0x0200",
|
||||
DateFrom: "2026-07-01 00:00:00",
|
||||
DateTo: "2026-07-01 23:59:59",
|
||||
DateFrom: "2026-07-01T00:00:00",
|
||||
DateTo: "2026-07-01T23:59:59",
|
||||
Limit: 20,
|
||||
Offset: 5,
|
||||
})
|
||||
@@ -336,6 +348,8 @@ func TestBuildRawFrameSQLUsesLiteralsForTDengine(t *testing.T) {
|
||||
"vehicle_key = 'JT808:013307811350'",
|
||||
"vin = 'VIN''1'",
|
||||
"message_id = 512",
|
||||
"ts >= '2026-07-01 00:00:00'",
|
||||
"ts <= '2026-07-01 23:59:59'",
|
||||
"LIMIT 20 OFFSET 5",
|
||||
} {
|
||||
if !strings.Contains(sqlText, want) {
|
||||
|
||||
Reference in New Issue
Block a user