fix: properly store timestamps in versions (#8646)

This PR makes a more clear gap between `version_createdAt` /
`version_updatedAt` and `createdAt` / `updatedAt` columns / fields in
mongodb.

- `createdAt` - This should be a new value in a new version. Before this
change it was the same all the time. Should remain the same on autosave.
- The same for `updatedAt`, but it should be updated on every change
(including autosave)
- `version_createdAt` - Should remain equal to `createdAt` from the
parent collection / table
- `version_updatedAt` - On a latest version it makes sense this be the
same as `updatedAt` from the parent collection / table, as all the
`version_*` fields should be just synced with it
This commit is contained in:
Sasha
2024-10-11 17:01:21 +03:00
committed by GitHub
parent 067d353cdd
commit 8daac4e670
15 changed files with 128 additions and 48 deletions

View File

@@ -99,8 +99,6 @@ export const queryDrafts: QueryDrafts = async function queryDrafts(
_id: doc.parent,
id: doc.parent,
...doc.version,
createdAt: doc.createdAt,
updatedAt: doc.updatedAt,
}
return sanitizeInternalFields(doc)