updating unit movement
This commit is contained in:
@@ -41,7 +41,7 @@ public class LocationResponse
|
||||
public DateTime UpdatedAtUtc { get; set; }
|
||||
public bool IsVisible { get; set; } = true;
|
||||
|
||||
public static LocationResponse FromLocation(Location location) => new()
|
||||
public static LocationResponse FromLocation(Location location, bool revealDetails = true) => new()
|
||||
{
|
||||
Id = location.Id,
|
||||
Q = location.Q,
|
||||
@@ -51,16 +51,38 @@ public class LocationResponse
|
||||
OwnerUsername = location.OwnerUsername,
|
||||
Label = location.Label,
|
||||
Level = location.Level,
|
||||
BuildingType = location.BuildingType,
|
||||
BuildingStatus = (location.BuildingType == "LogCamp" || location.BuildingType == "Mine" || location.BuildingType == "Barracks") && string.IsNullOrWhiteSpace(location.BuildingStatus)
|
||||
BuildingType = revealDetails ? location.BuildingType : null,
|
||||
BuildingStatus = revealDetails && (location.BuildingType == "LogCamp" || location.BuildingType == "Mine" || location.BuildingType == "Barracks") && string.IsNullOrWhiteSpace(location.BuildingStatus)
|
||||
? "Built"
|
||||
: location.BuildingStatus,
|
||||
BuildingStartedAtUtc = location.BuildingStartedAtUtc,
|
||||
BuildingCompletesAtUtc = location.BuildingCompletesAtUtc,
|
||||
BuildingBuiltAtUtc = location.BuildingBuiltAtUtc,
|
||||
: revealDetails ? location.BuildingStatus : null,
|
||||
BuildingStartedAtUtc = revealDetails ? location.BuildingStartedAtUtc : null,
|
||||
BuildingCompletesAtUtc = revealDetails ? location.BuildingCompletesAtUtc : null,
|
||||
BuildingBuiltAtUtc = revealDetails ? location.BuildingBuiltAtUtc : null,
|
||||
HomeAssignedAtUtc = location.HomeAssignedAtUtc,
|
||||
UpdatedAtUtc = location.UpdatedAtUtc,
|
||||
IsVisible = true
|
||||
};
|
||||
|
||||
public static LocationResponse FromIntel(LocationIntel intel) => new()
|
||||
{
|
||||
Id = intel.Id,
|
||||
Q = intel.Q,
|
||||
R = intel.R,
|
||||
Terrain = intel.Terrain,
|
||||
Kind = intel.Kind,
|
||||
OwnerUsername = intel.OwnerUsername,
|
||||
Label = intel.Label,
|
||||
Level = intel.Level,
|
||||
BuildingType = intel.BuildingType,
|
||||
BuildingStatus = (intel.BuildingType == "LogCamp" || intel.BuildingType == "Mine" || intel.BuildingType == "Barracks") && string.IsNullOrWhiteSpace(intel.BuildingStatus)
|
||||
? "Built"
|
||||
: intel.BuildingStatus,
|
||||
BuildingStartedAtUtc = intel.BuildingStartedAtUtc,
|
||||
BuildingCompletesAtUtc = intel.BuildingCompletesAtUtc,
|
||||
BuildingBuiltAtUtc = intel.BuildingBuiltAtUtc,
|
||||
HomeAssignedAtUtc = intel.HomeAssignedAtUtc,
|
||||
UpdatedAtUtc = intel.ObservedAtUtc,
|
||||
IsVisible = true
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace LocationsApi.Models;
|
||||
|
||||
public class LocationIntel
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = "";
|
||||
|
||||
public string Username { get; set; } = "";
|
||||
public int Q { get; set; }
|
||||
public int R { get; set; }
|
||||
public string Terrain { get; set; } = "Field";
|
||||
public string Kind { get; set; } = "Open";
|
||||
public string? OwnerUsername { get; set; }
|
||||
public string? Label { get; set; }
|
||||
public int Level { get; set; } = 1;
|
||||
public string? BuildingType { get; set; }
|
||||
public string? BuildingStatus { get; set; }
|
||||
public DateTime? BuildingStartedAtUtc { get; set; }
|
||||
public DateTime? BuildingCompletesAtUtc { get; set; }
|
||||
public DateTime? BuildingBuiltAtUtc { get; set; }
|
||||
public DateTime? HomeAssignedAtUtc { get; set; }
|
||||
public DateTime ObservedAtUtc { get; set; } = DateTime.UtcNow;
|
||||
public DateTime CreatedAtUtc { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAtUtc { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
Reference in New Issue
Block a user