diff --git a/equinox-fc/Domain/LocationEpoch.fs b/equinox-fc/Domain/LocationEpoch.fs index e2f41d27f..e5c0f571d 100644 --- a/equinox-fc/Domain/LocationEpoch.fs +++ b/equinox-fc/Domain/LocationEpoch.fs @@ -4,6 +4,11 @@ module Location.Epoch [] module Events = + let [] category = "LocationEpoch" + let (|For|) (locationId, epochId) = + let id = sprintf "%s_%s" (LocationId.toString locationId) (LocationEpochId.toString epochId) + Equinox.AggregateId (category, id) + type CarriedForward = { initial : int } type Delta = { value : int } type Event = @@ -12,10 +17,6 @@ module Events = | Delta of Delta interface TypeShape.UnionContract.IUnionContract let codec = FsCodec.NewtonsoftJson.Codec.Create() - let [] category = "LocationEpoch" - let (|For|) (locationId, epochId) = - let id = sprintf "%s_%s" (LocationId.toString locationId) (LocationEpochId.toString epochId) - Equinox.AggregateId(category, id) module Fold = diff --git a/equinox-fc/Domain/LocationSeries.fs b/equinox-fc/Domain/LocationSeries.fs index 7c7d1e6c8..d1ff8972e 100644 --- a/equinox-fc/Domain/LocationSeries.fs +++ b/equinox-fc/Domain/LocationSeries.fs @@ -4,19 +4,20 @@ module Location.Series [] module Events = + let [] category = "LocationSeries" + let (|For|) id = Equinox.AggregateId (category, LocationId.toString id) + type Started = { epochId : LocationEpochId } type Event = | Started of Started interface TypeShape.UnionContract.IUnionContract let codec = FsCodec.NewtonsoftJson.Codec.Create() - let [] category = "LocationSeries" - let (|For|) id = Equinox.AggregateId(category, LocationId.toString id) module Fold = type State = LocationEpochId let initial = LocationEpochId.parse -1 - let evolve _state = function + let private evolve _state = function | Events.Started e -> e.epochId let fold = Seq.fold evolve