Skip to content

Commit ce94f3d

Browse files
committed
Move AggregateId to Events
1 parent abd36be commit ce94f3d

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

equinox-fc/Domain/LocationEpoch.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ module Events =
1313
interface TypeShape.UnionContract.IUnionContract
1414
let codec = FsCodec.NewtonsoftJson.Codec.Create<Event>()
1515
let [<Literal>] categoryId = "LocationEpoch"
16+
let (|AggregateId|) (locationId, epochId) =
17+
let id = sprintf "%s_%s" (LocationId.toString locationId) (LocationEpochId.toString epochId)
18+
Equinox.AggregateId(categoryId, id)
1619

1720
module Folds =
1821

@@ -69,10 +72,7 @@ let sync (balanceCarriedForward : Folds.Balance option) (decide : (Folds.Balance
6972
type Service internal (resolve, ?maxAttempts) =
7073

7174
let log = Serilog.Log.ForContext<Service>()
72-
let (|AggregateId|) (locationId, epochId) =
73-
let id = sprintf "%s_%s" (LocationId.toString locationId) (LocationEpochId.toString epochId)
74-
Equinox.AggregateId(Events.categoryId, id)
75-
let (|Stream|) (AggregateId id) = Equinox.Stream<Events.Event,Folds.State>(log, resolve id, maxAttempts = defaultArg maxAttempts 2)
75+
let (|Stream|) (Events.AggregateId id) = Equinox.Stream<Events.Event,Folds.State>(log, resolve id, maxAttempts = defaultArg maxAttempts 2)
7676

7777
member __.Sync<'R>(locationId, epochId, prevEpochBalanceCarriedForward, decide, shouldClose) : Async<Result<'R>> =
7878
let (Stream stream) = (locationId, epochId)

equinox-fc/Domain/LocationSeries.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module Events =
1010
interface TypeShape.UnionContract.IUnionContract
1111
let codec = FsCodec.NewtonsoftJson.Codec.Create<Event>()
1212
let [<Literal>] categoryId = "LocationSeries"
13+
let (|AggregateId|) id = Equinox.AggregateId(categoryId, LocationId.toString id)
1314

1415
module Folds =
1516

@@ -28,8 +29,7 @@ let toActiveEpoch state =
2829
type Service internal (resolve, ?maxAttempts) =
2930

3031
let log = Serilog.Log.ForContext<Service>()
31-
let (|AggregateId|) id = Equinox.AggregateId(Events.categoryId, LocationId.toString id)
32-
let (|Stream|) (AggregateId id) = Equinox.Stream<Events.Event,Folds.State>(log, resolve id, maxAttempts = defaultArg maxAttempts 2)
32+
let (|Stream|) (Events.AggregateId id) = Equinox.Stream<Events.Event,Folds.State>(log, resolve id, maxAttempts = defaultArg maxAttempts 2)
3333

3434
member __.Read(locationId) : Async<LocationEpochId option> =
3535
let (Stream stream) = locationId

0 commit comments

Comments
 (0)