Fixing coord bug
All checks were successful
All checks were successful
This commit is contained in:
parent
d615527dcc
commit
c296ebc9cb
@ -1,12 +1,8 @@
|
|||||||
using MongoDB.Bson.Serialization.Attributes;
|
|
||||||
|
|
||||||
namespace CharacterApi.Models;
|
namespace CharacterApi.Models;
|
||||||
|
|
||||||
public class Coord
|
public class Coord
|
||||||
{
|
{
|
||||||
[BsonElement("x")]
|
|
||||||
public int X { get; set; }
|
public int X { get; set; }
|
||||||
|
|
||||||
[BsonElement("y")]
|
|
||||||
public int Y { get; set; }
|
public int Y { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
12
microservices/CharacterApi/Models/LocationCoord.cs
Normal file
12
microservices/CharacterApi/Models/LocationCoord.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using MongoDB.Bson.Serialization.Attributes;
|
||||||
|
|
||||||
|
namespace CharacterApi.Models;
|
||||||
|
|
||||||
|
public class LocationCoord
|
||||||
|
{
|
||||||
|
[BsonElement("x")]
|
||||||
|
public int X { get; set; }
|
||||||
|
|
||||||
|
[BsonElement("y")]
|
||||||
|
public int Y { get; set; }
|
||||||
|
}
|
||||||
@ -13,5 +13,5 @@ public class VisibleLocation
|
|||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
[BsonElement("coord")]
|
[BsonElement("coord")]
|
||||||
public Coord Coord { get; set; } = new();
|
public LocationCoord Coord { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,7 +85,7 @@ public class CharacterStore
|
|||||||
|
|
||||||
var update = Builders<VisibleLocation>.Update
|
var update = Builders<VisibleLocation>.Update
|
||||||
.SetOnInsert(l => l.Name, DefaultLocationName(x, y))
|
.SetOnInsert(l => l.Name, DefaultLocationName(x, y))
|
||||||
.SetOnInsert(l => l.Coord, new Coord { X = x, Y = y })
|
.SetOnInsert(l => l.Coord, new LocationCoord { X = x, Y = y })
|
||||||
.SetOnInsert(l => l.Id, ObjectId.GenerateNewId().ToString())
|
.SetOnInsert(l => l.Id, ObjectId.GenerateNewId().ToString())
|
||||||
.SetOnInsert("createdUtc", DateTime.UtcNow);
|
.SetOnInsert("createdUtc", DateTime.UtcNow);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user