fix: correct timestamp/boolean types for PostgreSQL schema (Date not int, bool not 0/1)
This commit is contained in:
parent
e00bd4d804
commit
69634909d1
9 changed files with 75 additions and 131 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue