1
0
Fork 0
mirror of synced 2024-07-14 18:55:45 +12:00

Add createdAt and updatedAt to all new put requests

This commit is contained in:
Rory Powell 2022-03-30 14:24:04 +01:00
parent 15b676ce1c
commit 2a5df40ffa

View file

@ -6,9 +6,11 @@ let initialised = false
const put =
dbPut =>
async (doc, options = {}) => {
const response = await dbPut(doc, options)
// TODO: add created / updated
return response
if (!doc.createdAt) {
doc.createdAt = new Date().toISOString()
}
doc.updatedAt = new Date().toISOString()
return dbPut(doc, options)
}
const checkInitialised = () => {