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,
|
origin_name,
|
||||||
name: uuid + ext,
|
name: uuid + ext,
|
||||||
path: destPath,
|
path: destPath,
|
||||||
created_at: stats.birthtime,
|
created_at: stats.birthtime.toISOString(),
|
||||||
size: stats.size,
|
size: stats.size,
|
||||||
ext: ext,
|
ext: ext,
|
||||||
type: fileType,
|
type: fileType,
|
||||||
@ -198,7 +198,7 @@ class FileStorage {
|
|||||||
origin_name: path.basename(filePath),
|
origin_name: path.basename(filePath),
|
||||||
name: path.basename(filePath),
|
name: path.basename(filePath),
|
||||||
path: filePath,
|
path: filePath,
|
||||||
created_at: stats.birthtime,
|
created_at: stats.birthtime.toISOString(),
|
||||||
size: stats.size,
|
size: stats.size,
|
||||||
ext: ext,
|
ext: ext,
|
||||||
type: fileType,
|
type: fileType,
|
||||||
@ -416,7 +416,7 @@ class FileStorage {
|
|||||||
origin_name: filename,
|
origin_name: filename,
|
||||||
name: uuid + ext,
|
name: uuid + ext,
|
||||||
path: destPath,
|
path: destPath,
|
||||||
created_at: stats.birthtime,
|
created_at: stats.birthtime.toISOString(),
|
||||||
size: stats.size,
|
size: stats.size,
|
||||||
ext: ext,
|
ext: ext,
|
||||||
type: fileType,
|
type: fileType,
|
||||||
|
|||||||
@ -2,6 +2,14 @@ import { Transaction } from 'dexie'
|
|||||||
|
|
||||||
export async function upgradeToV5(tx: Transaction): Promise<void> {
|
export async function upgradeToV5(tx: Transaction): Promise<void> {
|
||||||
const topics = await tx.table('topics').toArray()
|
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) {
|
for (const topic of topics) {
|
||||||
let hasChanges = false
|
let hasChanges = false
|
||||||
|
|||||||
@ -168,7 +168,7 @@ export interface FileType {
|
|||||||
size: number
|
size: number
|
||||||
ext: string
|
ext: string
|
||||||
type: FileTypes
|
type: FileTypes
|
||||||
created_at: Date
|
created_at: string
|
||||||
count: number
|
count: number
|
||||||
tokens?: number
|
tokens?: number
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user