Skip to content

Commit

Permalink
Merge pull request #221 from Real-Dev-Squad/fix/wrongCollection
Browse files Browse the repository at this point in the history
Profile diff storing in wrong collection resolved
  • Loading branch information
lakshayman authored Sep 15, 2024
2 parents ab7ec4e + b5422e7 commit 72f1c6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion layer/utils/firestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions layer/utils/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
}
Expand Down Expand Up @@ -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,
},
}
Expand Down

0 comments on commit 72f1c6c

Please sign in to comment.