fix: correct timestamp/boolean types for PostgreSQL schema (Date not int, bool not 0/1)

This commit is contained in:
Marko Djordjevic 2026-02-17 22:50:31 +01:00
parent e00bd4d804
commit 69634909d1
9 changed files with 75 additions and 131 deletions

View file

@ -89,7 +89,7 @@ export async function POST(request: NextRequest): Promise<NextResponse> {
// Parse and prepare candle data
const candleData = rows.map((row) => {
let timestamp: number;
let timestamp: Date;
// Handle both date strings and Unix timestamps
if (typeof row.time === 'string') {
@ -98,7 +98,7 @@ export async function POST(request: NextRequest): Promise<NextResponse> {
if (isNaN(date.getTime())) {
throw new Error(`Invalid date format: ${row.time}`);
}
timestamp = date; // PostgreSQL timestamp type expects Date object or ISO string
timestamp = date;
} else if (typeof row.time === 'number') {
// If Unix timestamp (seconds), convert to Date
timestamp = new Date(row.time * 1000);