When using the Firestore admin SDK, we can retrieve document timestamps (createTime, updateTime, readTime). These timestamps are useful for backend applications that utilize Firestore. This proposal suggests including these timestamps in Fireorm entities, allowing users to automatically access them without manual creation.
Steps to Reproduce
Create an entity and save it to Firestore using Fireorm.
Retrieve the entity and attempt to access its timestamps (createTime, updateTime, readTime).
Expected Behavior
Entities should automatically include createTime, updateTime, and readTime properties, populated with the corresponding Firestore document timestamps.
Actual Behavior
Currently, entities do not include these timestamps automatically and require manual creation and management.
Acceptance Criteria
Add support for Firestore timestamps (createTime, updateTime, readTime) in entities.
Ensure that these properties can be overridden by the user if necessary.
Provide TypeScript support for the new properties.
Add unit tests to validate the inclusion and correctness of the timestamps.
Additional Context
December 17, 2022: Initial proposal for including Firestore timestamps in entities.
Description
When using the Firestore admin SDK, we can retrieve document timestamps (
createTime
,updateTime
,readTime
). These timestamps are useful for backend applications that utilize Firestore. This proposal suggests including these timestamps in Fireorm entities, allowing users to automatically access them without manual creation.Steps to Reproduce
createTime
,updateTime
,readTime
).Expected Behavior
Entities should automatically include
createTime
,updateTime
, andreadTime
properties, populated with the corresponding Firestore document timestamps.Actual Behavior
Currently, entities do not include these timestamps automatically and require manual creation and management.
Acceptance Criteria
createTime
,updateTime
,readTime
) in entities.Additional Context
Proposed API Changes
Add Timestamp Properties to Entities:
createTime
,updateTime
, andreadTime
properties.Update Repository Methods:
Provide TypeScript Support:
Timestamped
wrapper to add typing for the new properties.Unit Tests:
Example Implementation
Original Issue