@jcbuisson/express-x-drizzle 3.1.25 → 3.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/drizzle-plugins.mjs +5 -3
package/package.json
CHANGED
package/src/drizzle-plugins.mjs
CHANGED
|
@@ -144,7 +144,7 @@ export function drizzleOfflinePlugin(app, db, metadata, models) {
|
|
|
144
144
|
const existingTime = existingMeta
|
|
145
145
|
? new Date(existingMeta.deleted_at || existingMeta.updated_at || existingMeta.created_at)
|
|
146
146
|
: null
|
|
147
|
-
if (existingTime && existingTime
|
|
147
|
+
if (existingTime && existingTime >= ts) {
|
|
148
148
|
const value = (await tx.select().from(model).where(eq(model.uid, uid)))[0] ?? undefined
|
|
149
149
|
return [value, existingMeta]
|
|
150
150
|
}
|
|
@@ -202,8 +202,10 @@ export function drizzleOfflinePlugin(app, db, metadata, models) {
|
|
|
202
202
|
return await db.transaction(async (tx) => {
|
|
203
203
|
const ts = new Date(deleted_at)
|
|
204
204
|
const existingMeta = (await tx.select().from(metadata).where(eq(metadata.uid, uid)))[0] ?? null
|
|
205
|
-
const
|
|
206
|
-
|
|
205
|
+
const existingTime = existingMeta
|
|
206
|
+
? new Date(existingMeta.deleted_at || existingMeta.updated_at || existingMeta.created_at)
|
|
207
|
+
: null
|
|
208
|
+
if (existingTime && existingTime > ts) {
|
|
207
209
|
const value = (await tx.select().from(model).where(eq(model.uid, uid)))[0] ?? undefined
|
|
208
210
|
return [value, existingMeta]
|
|
209
211
|
}
|