Add createdAt and updatedAt to all new put requests
This commit is contained in:
parent
15b676ce1c
commit
2a5df40ffa
|
@ -6,9 +6,11 @@ let initialised = false
|
||||||
const put =
|
const put =
|
||||||
dbPut =>
|
dbPut =>
|
||||||
async (doc, options = {}) => {
|
async (doc, options = {}) => {
|
||||||
const response = await dbPut(doc, options)
|
if (!doc.createdAt) {
|
||||||
// TODO: add created / updated
|
doc.createdAt = new Date().toISOString()
|
||||||
return response
|
}
|
||||||
|
doc.updatedAt = new Date().toISOString()
|
||||||
|
return dbPut(doc, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkInitialised = () => {
|
const checkInitialised = () => {
|
||||||
|
|
Loading…
Reference in New Issue