From 0fc023b75cc000b3125c26158ff960eff692feba Mon Sep 17 00:00:00 2001 From: Zeeshaun Date: Thu, 19 Mar 2026 17:01:47 -0500 Subject: [PATCH] Fixing gather bug --- microservices/LocationsApi/Models/LocationObject.cs | 2 +- microservices/LocationsApi/Services/LocationStore.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/microservices/LocationsApi/Models/LocationObject.cs b/microservices/LocationsApi/Models/LocationObject.cs index df340ce..b5d8431 100644 --- a/microservices/LocationsApi/Models/LocationObject.cs +++ b/microservices/LocationsApi/Models/LocationObject.cs @@ -5,7 +5,7 @@ namespace LocationsApi.Models; public class LocationObject { [BsonElement("id")] - public string Id { get; set; } = Guid.NewGuid().ToString("N"); + public string ObjectId { get; set; } = Guid.NewGuid().ToString("N"); [BsonElement("objectType")] public string ObjectType { get; set; } = "gatherable"; diff --git a/microservices/LocationsApi/Services/LocationStore.cs b/microservices/LocationsApi/Services/LocationStore.cs index 87523ca..8a63434 100644 --- a/microservices/LocationsApi/Services/LocationStore.cs +++ b/microservices/LocationsApi/Services/LocationStore.cs @@ -185,7 +185,7 @@ public class LocationStore var locationObject = location.LocationObject; if (locationObject is null) return new InteractResult(InteractStatus.ObjectNotFound); - if (!string.Equals(locationObject.Id, objectId, StringComparison.Ordinal)) + if (!string.Equals(locationObject.ObjectId, objectId, StringComparison.Ordinal)) return new InteractResult(InteractStatus.ObjectNotFound); if (!string.Equals(locationObject.ObjectType, "gatherable", StringComparison.OrdinalIgnoreCase)) return new InteractResult(InteractStatus.UnsupportedObjectType); @@ -196,7 +196,7 @@ public class LocationStore var remainingQuantity = locationObject.State.RemainingQuantity - quantityGranted; var objectFilter = Builders.Filter.And( Builders.Filter.Eq(l => l.Id, locationId), - Builders.Filter.Eq("locationObject.id", locationObject.Id), + Builders.Filter.Eq("locationObject.id", locationObject.ObjectId), Builders.Filter.Eq("locationObject.state.remainingQuantity", locationObject.State.RemainingQuantity) ); @@ -216,7 +216,7 @@ public class LocationStore return new InteractResult( InteractStatus.Ok, - locationObject.Id, + locationObject.ObjectId, locationObject.ObjectType, locationObject.State.ItemKey, quantityGranted, @@ -400,7 +400,7 @@ public class LocationStore var normalizedItemKey = NormalizeItemKey(itemKey); return new LocationObject { - Id = Guid.NewGuid().ToString("N"), + ObjectId = Guid.NewGuid().ToString("N"), ObjectType = "gatherable", ObjectKey = $"{normalizedItemKey}_node", Name = HumanizeItemKey(normalizedItemKey), @@ -432,7 +432,7 @@ public class LocationStore { return new LocationObject { - Id = source.Id, + ObjectId = source.ObjectId, ObjectType = source.ObjectType, ObjectKey = source.ObjectKey, Name = source.Name,