Fixing gather bug
All checks were successful
Deploy Promiscuity Auth API / deploy (push) Successful in 46s
Deploy Promiscuity Character API / deploy (push) Successful in 45s
Deploy Promiscuity Inventory API / deploy (push) Successful in 46s
Deploy Promiscuity Locations API / deploy (push) Successful in 58s
k8s smoke test / test (push) Successful in 8s
All checks were successful
Deploy Promiscuity Auth API / deploy (push) Successful in 46s
Deploy Promiscuity Character API / deploy (push) Successful in 45s
Deploy Promiscuity Inventory API / deploy (push) Successful in 46s
Deploy Promiscuity Locations API / deploy (push) Successful in 58s
k8s smoke test / test (push) Successful in 8s
This commit is contained in:
parent
52a76625a3
commit
0fc023b75c
@ -5,7 +5,7 @@ namespace LocationsApi.Models;
|
|||||||
public class LocationObject
|
public class LocationObject
|
||||||
{
|
{
|
||||||
[BsonElement("id")]
|
[BsonElement("id")]
|
||||||
public string Id { get; set; } = Guid.NewGuid().ToString("N");
|
public string ObjectId { get; set; } = Guid.NewGuid().ToString("N");
|
||||||
|
|
||||||
[BsonElement("objectType")]
|
[BsonElement("objectType")]
|
||||||
public string ObjectType { get; set; } = "gatherable";
|
public string ObjectType { get; set; } = "gatherable";
|
||||||
|
|||||||
@ -185,7 +185,7 @@ public class LocationStore
|
|||||||
var locationObject = location.LocationObject;
|
var locationObject = location.LocationObject;
|
||||||
if (locationObject is null)
|
if (locationObject is null)
|
||||||
return new InteractResult(InteractStatus.ObjectNotFound);
|
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);
|
return new InteractResult(InteractStatus.ObjectNotFound);
|
||||||
if (!string.Equals(locationObject.ObjectType, "gatherable", StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(locationObject.ObjectType, "gatherable", StringComparison.OrdinalIgnoreCase))
|
||||||
return new InteractResult(InteractStatus.UnsupportedObjectType);
|
return new InteractResult(InteractStatus.UnsupportedObjectType);
|
||||||
@ -196,7 +196,7 @@ public class LocationStore
|
|||||||
var remainingQuantity = locationObject.State.RemainingQuantity - quantityGranted;
|
var remainingQuantity = locationObject.State.RemainingQuantity - quantityGranted;
|
||||||
var objectFilter = Builders<Location>.Filter.And(
|
var objectFilter = Builders<Location>.Filter.And(
|
||||||
Builders<Location>.Filter.Eq(l => l.Id, locationId),
|
Builders<Location>.Filter.Eq(l => l.Id, locationId),
|
||||||
Builders<Location>.Filter.Eq("locationObject.id", locationObject.Id),
|
Builders<Location>.Filter.Eq("locationObject.id", locationObject.ObjectId),
|
||||||
Builders<Location>.Filter.Eq("locationObject.state.remainingQuantity", locationObject.State.RemainingQuantity)
|
Builders<Location>.Filter.Eq("locationObject.state.remainingQuantity", locationObject.State.RemainingQuantity)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ public class LocationStore
|
|||||||
|
|
||||||
return new InteractResult(
|
return new InteractResult(
|
||||||
InteractStatus.Ok,
|
InteractStatus.Ok,
|
||||||
locationObject.Id,
|
locationObject.ObjectId,
|
||||||
locationObject.ObjectType,
|
locationObject.ObjectType,
|
||||||
locationObject.State.ItemKey,
|
locationObject.State.ItemKey,
|
||||||
quantityGranted,
|
quantityGranted,
|
||||||
@ -400,7 +400,7 @@ public class LocationStore
|
|||||||
var normalizedItemKey = NormalizeItemKey(itemKey);
|
var normalizedItemKey = NormalizeItemKey(itemKey);
|
||||||
return new LocationObject
|
return new LocationObject
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid().ToString("N"),
|
ObjectId = Guid.NewGuid().ToString("N"),
|
||||||
ObjectType = "gatherable",
|
ObjectType = "gatherable",
|
||||||
ObjectKey = $"{normalizedItemKey}_node",
|
ObjectKey = $"{normalizedItemKey}_node",
|
||||||
Name = HumanizeItemKey(normalizedItemKey),
|
Name = HumanizeItemKey(normalizedItemKey),
|
||||||
@ -432,7 +432,7 @@ public class LocationStore
|
|||||||
{
|
{
|
||||||
return new LocationObject
|
return new LocationObject
|
||||||
{
|
{
|
||||||
Id = source.Id,
|
ObjectId = source.ObjectId,
|
||||||
ObjectType = source.ObjectType,
|
ObjectType = source.ObjectType,
|
||||||
ObjectKey = source.ObjectKey,
|
ObjectKey = source.ObjectKey,
|
||||||
Name = source.Name,
|
Name = source.Name,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user