Refactor backend into domain-first slices

This commit is contained in:
2026-03-19 18:15:44 -04:00
parent 07a3142316
commit 9a5040cf1f
53 changed files with 94 additions and 140 deletions

View File

@@ -0,0 +1,83 @@
namespace SpaceGame.Api.Universe.Contracts;
public sealed record StarSnapshot(
string Kind,
string Color,
string Glow,
float Size,
float OrbitRadius,
float OrbitSpeed,
float OrbitPhaseAtEpoch);
public sealed record MoonSnapshot(
string Label,
float Size,
string Color,
float OrbitRadius,
float OrbitSpeed,
float OrbitPhaseAtEpoch,
float OrbitInclination,
float OrbitLongitudeOfAscendingNode);
public sealed record SystemSnapshot(
string Id,
string Label,
Vector3Dto GalaxyPosition,
IReadOnlyList<StarSnapshot> Stars,
IReadOnlyList<PlanetSnapshot> Planets);
public sealed record PlanetSnapshot(
string Label,
string PlanetType,
string Shape,
IReadOnlyList<MoonSnapshot> Moons,
float OrbitRadius,
float OrbitSpeed,
float OrbitEccentricity,
float OrbitInclination,
float OrbitLongitudeOfAscendingNode,
float OrbitArgumentOfPeriapsis,
float OrbitPhaseAtEpoch,
float Size,
string Color,
bool HasRing);
public sealed record ResourceNodeSnapshot(
string Id,
string SystemId,
Vector3Dto LocalPosition,
string? CelestialId,
string SourceKind,
float OreRemaining,
float MaxOre,
string ItemId);
public sealed record ResourceNodeDelta(
string Id,
string SystemId,
Vector3Dto LocalPosition,
string? CelestialId,
string SourceKind,
float OreRemaining,
float MaxOre,
string ItemId);
public sealed record CelestialSnapshot(
string Id,
string SystemId,
string Kind,
Vector3Dto OrbitalAnchor,
float LocalSpaceRadius,
string? ParentNodeId,
string? OccupyingStructureId,
string? OrbitReferenceId);
public sealed record CelestialDelta(
string Id,
string SystemId,
string Kind,
Vector3Dto OrbitalAnchor,
float LocalSpaceRadius,
string? ParentNodeId,
string? OccupyingStructureId,
string? OrbitReferenceId);

View File

@@ -0,0 +1,58 @@
namespace SpaceGame.Api.Universe.Contracts;
public sealed record WorldSnapshot(
string Label,
int Seed,
long Sequence,
int TickIntervalMs,
double OrbitalTimeSeconds,
OrbitalSimulationSnapshot OrbitalSimulation,
DateTimeOffset GeneratedAtUtc,
IReadOnlyList<SystemSnapshot> Systems,
IReadOnlyList<CelestialSnapshot> Celestials,
IReadOnlyList<ResourceNodeSnapshot> Nodes,
IReadOnlyList<StationSnapshot> Stations,
IReadOnlyList<ClaimSnapshot> Claims,
IReadOnlyList<ConstructionSiteSnapshot> ConstructionSites,
IReadOnlyList<MarketOrderSnapshot> MarketOrders,
IReadOnlyList<PolicySetSnapshot> Policies,
IReadOnlyList<ShipSnapshot> Ships,
IReadOnlyList<FactionSnapshot> Factions);
public sealed record WorldDelta(
long Sequence,
int TickIntervalMs,
double OrbitalTimeSeconds,
OrbitalSimulationSnapshot OrbitalSimulation,
DateTimeOffset GeneratedAtUtc,
bool RequiresSnapshotRefresh,
IReadOnlyList<SimulationEventRecord> Events,
IReadOnlyList<CelestialDelta> Celestials,
IReadOnlyList<ResourceNodeDelta> Nodes,
IReadOnlyList<StationDelta> Stations,
IReadOnlyList<ClaimDelta> Claims,
IReadOnlyList<ConstructionSiteDelta> ConstructionSites,
IReadOnlyList<MarketOrderDelta> MarketOrders,
IReadOnlyList<PolicySetDelta> Policies,
IReadOnlyList<ShipDelta> Ships,
IReadOnlyList<FactionDelta> Factions,
ObserverScope? Scope = null);
public sealed record SimulationEventRecord(
string EntityKind,
string EntityId,
string Kind,
string Message,
DateTimeOffset OccurredAtUtc,
string Family = "simulation",
string ScopeKind = "universe",
string? ScopeEntityId = null,
string Visibility = "public");
public sealed record ObserverScope(
string ScopeKind,
string? SystemId = null,
string? CelestialId = null);
public sealed record OrbitalSimulationSnapshot(
double SimulatedSecondsPerRealSecond);