From b5422e772753a4a32be22819b8a0e7585676b1b0 Mon Sep 17 00:00:00 2001 From: Lakshay Manchanda Date: Mon, 16 Sep 2024 01:25:27 +0530 Subject: [PATCH] Profile diff storing in wrong collection resolved --- layer/utils/firestore.go | 2 +- layer/utils/logging.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/layer/utils/firestore.go b/layer/utils/firestore.go index 00d31f5..3a2e60a 100644 --- a/layer/utils/firestore.go +++ b/layer/utils/firestore.go @@ -60,7 +60,7 @@ func getLastDiff(client *firestore.Client, ctx context.Context, userId string, a func generateAndStoreDiff(client *firestore.Client, ctx context.Context, res Res, userId string, sessionId string) error { newDiff := resToDiff(res, userId) - _, err := client.Collection("users").Doc(userId).Collection("diffs").Doc("diff_"+userId).Set(ctx, newDiff) + _, _, err := client.Collection("profileDiffs").Add(ctx, diffToMap(newDiff)) if err != nil { return err } diff --git a/layer/utils/logging.go b/layer/utils/logging.go index 2251d74..3790519 100644 --- a/layer/utils/logging.go +++ b/layer/utils/logging.go @@ -18,6 +18,7 @@ func logProfileStored(client *firestore.Client, ctx context.Context, diff Diff, "sessionId": sessionId, }, Body: map[string]interface{}{ + "userId": userId, "profile": diffToMap(diff), }, } @@ -51,6 +52,7 @@ func LogHealth(client *firestore.Client, ctx context.Context, userId string, isS "sessionId": sessionId, }, Body: map[string]interface{}{ + "userId": userId, "serviceRunning": isServiceRunning, }, }