mirror of
https://github.com/morten-olsen/reservoir.git
synced 2026-02-08 01:46:24 +01:00
fix: postgres object compat
This commit is contained in:
@@ -27,10 +27,10 @@ type DocumentRow = {
|
|||||||
id: string;
|
id: string;
|
||||||
type: string;
|
type: string;
|
||||||
source: string | null;
|
source: string | null;
|
||||||
data: string;
|
data: string | unknown;
|
||||||
createdAt: string;
|
createdAt: string | Date;
|
||||||
updatedAt: string;
|
updatedAt: string | Date;
|
||||||
deletedAt: string | null;
|
deletedAt: string | Date | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Tables = {
|
type Tables = {
|
||||||
|
|||||||
@@ -49,15 +49,15 @@ class DocumentsService {
|
|||||||
action: 'inserted',
|
action: 'inserted',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const currentData = JSON.parse(current.data);
|
const currentData = typeof current.data === 'string' ? JSON.parse(current.data) : current.data;
|
||||||
if (equal(currentData, document.data)) {
|
if (equal(currentData, document.data)) {
|
||||||
return {
|
return {
|
||||||
...current,
|
...current,
|
||||||
data: currentData,
|
data: currentData,
|
||||||
id,
|
id,
|
||||||
createdAt: current.createdAt,
|
createdAt: new Date(current.createdAt).toISOString(),
|
||||||
updatedAt: current.updatedAt,
|
updatedAt: new Date(current.updatedAt).toISOString(),
|
||||||
deletedAt: current.deletedAt || null,
|
deletedAt: current.deletedAt ? new Date(current.deletedAt).toISOString() : null,
|
||||||
action: 'skipped',
|
action: 'skipped',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -72,9 +72,9 @@ class DocumentsService {
|
|||||||
...current,
|
...current,
|
||||||
id,
|
id,
|
||||||
data: document.data,
|
data: document.data,
|
||||||
createdAt: current.createdAt,
|
createdAt: new Date(current.createdAt).toISOString(),
|
||||||
updatedAt: now.toISOString(),
|
updatedAt: now.toISOString(),
|
||||||
deletedAt: current.deletedAt || null,
|
deletedAt: current.deletedAt ? new Date(current.deletedAt).toISOString() : null,
|
||||||
action: 'updated',
|
action: 'updated',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,3 +3,4 @@ packages:
|
|||||||
- ./apps/*
|
- ./apps/*
|
||||||
onlyBuiltDependencies:
|
onlyBuiltDependencies:
|
||||||
- better-sqlite3
|
- better-sqlite3
|
||||||
|
- esbuild
|
||||||
|
|||||||
Reference in New Issue
Block a user