Add createdAd and updatedAt on bulkDocs

This commit is contained in:
Adria Navarro 2024-07-30 17:26:49 +02:00
parent e07bc5b572
commit 61d73b1f59
1 changed files with 5 additions and 1 deletions

View File

@ -308,8 +308,12 @@ export class DatabaseImpl implements Database {
}
async bulkDocs(documents: AnyDocument[]) {
const now = new Date().toISOString()
return this.performCall(db => {
return () => db.bulk({ docs: documents })
return () =>
db.bulk({
docs: documents.map(d => ({ createdAt: now, ...d, updatedAt: now })),
})
})
}