fix: Convert file created_at to ISO string format
Ensure consistent string representation of file creation timestamps across file storage and type definitions
This commit is contained in:
parent
de1ad09900
commit
670d66b01d
@ -174,7 +174,7 @@ class FileStorage {
|
||||
origin_name,
|
||||
name: uuid + ext,
|
||||
path: destPath,
|
||||
created_at: stats.birthtime,
|
||||
created_at: stats.birthtime.toISOString(),
|
||||
size: stats.size,
|
||||
ext: ext,
|
||||
type: fileType,
|
||||
@ -198,7 +198,7 @@ class FileStorage {
|
||||
origin_name: path.basename(filePath),
|
||||
name: path.basename(filePath),
|
||||
path: filePath,
|
||||
created_at: stats.birthtime,
|
||||
created_at: stats.birthtime.toISOString(),
|
||||
size: stats.size,
|
||||
ext: ext,
|
||||
type: fileType,
|
||||
@ -416,7 +416,7 @@ class FileStorage {
|
||||
origin_name: filename,
|
||||
name: uuid + ext,
|
||||
path: destPath,
|
||||
created_at: stats.birthtime,
|
||||
created_at: stats.birthtime.toISOString(),
|
||||
size: stats.size,
|
||||
ext: ext,
|
||||
type: fileType,
|
||||
|
||||
@ -2,6 +2,14 @@ import { Transaction } from 'dexie'
|
||||
|
||||
export async function upgradeToV5(tx: Transaction): Promise<void> {
|
||||
const topics = await tx.table('topics').toArray()
|
||||
const files = await tx.table('files').toArray()
|
||||
|
||||
for (const file of files) {
|
||||
if (file.created_at instanceof Date) {
|
||||
file.created_at = file.created_at.toISOString()
|
||||
await tx.table('files').put(file)
|
||||
}
|
||||
}
|
||||
|
||||
for (const topic of topics) {
|
||||
let hasChanges = false
|
||||
|
||||
@ -168,7 +168,7 @@ export interface FileType {
|
||||
size: number
|
||||
ext: string
|
||||
type: FileTypes
|
||||
created_at: Date
|
||||
created_at: string
|
||||
count: number
|
||||
tokens?: number
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user