From 9579f7e5b168e10fb3cc01859da6660fa70ed533 Mon Sep 17 00:00:00 2001 From: Leonardo Matos Date: Sat, 15 Feb 2020 01:56:44 -0300 Subject: [PATCH] fix(handle-callback): preset 'updated_at' on firestore coll --- lib/methods/handle-callback.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/methods/handle-callback.js b/lib/methods/handle-callback.js index 3cf33b0..cdf0c7e 100644 --- a/lib/methods/handle-callback.js +++ b/lib/methods/handle-callback.js @@ -30,6 +30,7 @@ const handleCallback = client => { // insert application with respective authentication data if (collRef) { + const firestoreTimestamp = admin.firestore.Timestamp.fromDate(new Date()) firestoreDoc = { application_id: application._id, application_app_id: application.app_id, @@ -37,8 +38,8 @@ const handleCallback = client => { authentication_id: authenticationId, authentication_permissions: JSON.stringify(authentication.permissions), store_id: storeId, - created_at: admin.firestore.Timestamp.fromDate(new Date()), - updated_at: null + created_at: firestoreTimestamp, + updated_at: firestoreTimestamp } } else { values = [