From 03d8bcb38e41d55bf43eaf2fbda3b8c8b17fb2cf Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Mon, 4 Nov 2024 14:57:50 +0330 Subject: [PATCH] feat: add creation time for insertion! --- utils/persist_payload.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/persist_payload.py b/utils/persist_payload.py index 3abc11c..210ba3e 100644 --- a/utils/persist_payload.py +++ b/utils/persist_payload.py @@ -56,7 +56,11 @@ def persist_http(self, payload: HTTPPayload, update: bool = False) -> None: try: if not update: self.client[self.db][self.external_msgs_collection].insert_one( - payload.model_dump() + { + **payload.model_dump(), + "createdAt": datetime.now().replace(tzinfo=timezone.utc), + "updatedAt": datetime.now().replace(tzinfo=timezone.utc), + } ) logging.info( "Added HTTP Payload for community id: "