Skip to content

Commit

Permalink
Sync layout
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Jan 28, 2020
1 parent a2fc836 commit 4a01f00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions equinox-fc/Domain/LocationEpoch.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ module Location.Epoch
[<RequireQualifiedAccess>]
module Events =

let [<Literal>] 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 =
Expand All @@ -12,10 +17,6 @@ module Events =
| Delta of Delta
interface TypeShape.UnionContract.IUnionContract
let codec = FsCodec.NewtonsoftJson.Codec.Create<Event>()
let [<Literal>] category = "LocationEpoch"
let (|For|) (locationId, epochId) =
let id = sprintf "%s_%s" (LocationId.toString locationId) (LocationEpochId.toString epochId)
Equinox.AggregateId(category, id)

module Fold =

Expand Down
7 changes: 4 additions & 3 deletions equinox-fc/Domain/LocationSeries.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ module Location.Series
[<RequireQualifiedAccess>]
module Events =

let [<Literal>] 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<Event>()
let [<Literal>] 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

Expand Down

0 comments on commit 4a01f00

Please sign in to comment.