From ef1c8ac421517c856205e3b98467932a189ffaeb Mon Sep 17 00:00:00 2001 From: Ruben Bartelink Date: Sat, 7 Dec 2019 03:21:57 +0000 Subject: [PATCH] Move AggregateId to Events --- equinox-fc/Domain/Allocation.fs | 4 ++-- equinox-fc/Domain/Allocator.fs | 4 ++-- equinox-fc/Domain/Ticket.fs | 4 ++-- equinox-fc/Domain/TicketList.fs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/equinox-fc/Domain/Allocation.fs b/equinox-fc/Domain/Allocation.fs index e89a81be8..9b6f61b1e 100644 --- a/equinox-fc/Domain/Allocation.fs +++ b/equinox-fc/Domain/Allocation.fs @@ -32,6 +32,7 @@ module Events = interface TypeShape.UnionContract.IUnionContract let codec = FsCodec.NewtonsoftJson.Codec.Create() let [] categoryId = "Allocation" + let (|AggregateId|) id = Equinox.AggregateId(categoryId, AllocationId.toString id) module Folds = @@ -218,8 +219,7 @@ let sync (updates : Update seq, command : Command) (state : Folds.State) : (bool type Service internal (resolve, ?maxAttempts) = let log = Serilog.Log.ForContext() - let (|AggregateId|) id = Equinox.AggregateId(Events.categoryId, AllocationId.toString id) - let (|Stream|) (AggregateId id) = Equinox.Stream(log, resolve id, maxAttempts = defaultArg maxAttempts 3) + let (|Stream|) (Events.AggregateId id) = Equinox.Stream(log, resolve id, maxAttempts = defaultArg maxAttempts 3) member __.Sync(allocationId,updates,command) : Async = let (Stream stream) = allocationId diff --git a/equinox-fc/Domain/Allocator.fs b/equinox-fc/Domain/Allocator.fs index 7b8c792df..50037d911 100644 --- a/equinox-fc/Domain/Allocator.fs +++ b/equinox-fc/Domain/Allocator.fs @@ -16,6 +16,7 @@ module Events = interface TypeShape.UnionContract.IUnionContract let codec = FsCodec.NewtonsoftJson.Codec.Create() let [] categoryId = "Allocator" + let (|AggregateId|) id = Equinox.AggregateId(categoryId, AllocatorId.toString id) module Folds = @@ -40,8 +41,7 @@ let decideComplete allocationId reason : Folds.State -> Events.Event list = func type Service internal (resolve, ?maxAttempts) = let log = Serilog.Log.ForContext() - let (|AggregateId|) id = Equinox.AggregateId(Events.categoryId, AllocatorId.toString id) - let (|Stream|) (AggregateId id) = Equinox.Stream(log, resolve id, maxAttempts = defaultArg maxAttempts 3) + let (|Stream|) (Events.AggregateId id) = Equinox.Stream(log, resolve id, maxAttempts = defaultArg maxAttempts 3) member __.Commence(allocatorId, allocationId, cutoff) : Async = let (Stream stream) = allocatorId diff --git a/equinox-fc/Domain/Ticket.fs b/equinox-fc/Domain/Ticket.fs index b5a98c057..f4f0957a9 100644 --- a/equinox-fc/Domain/Ticket.fs +++ b/equinox-fc/Domain/Ticket.fs @@ -13,6 +13,7 @@ module Events = interface TypeShape.UnionContract.IUnionContract let codec = FsCodec.NewtonsoftJson.Codec.Create() let [] categoryId = "Ticket" + let (|AggregateId|) id = Equinox.AggregateId(categoryId, TicketId.toString id) module Folds = @@ -50,8 +51,7 @@ let decide (allocator : AllocatorId) (command : Command) (state : Folds.State) : type Service internal (resolve, ?maxAttempts) = let log = Serilog.Log.ForContext() - let (|AggregateId|) id = Equinox.AggregateId(Events.categoryId, TicketId.toString id) - let (|Stream|) (AggregateId id) = Equinox.Stream(log, resolve id, maxAttempts = defaultArg maxAttempts 3) + let (|Stream|) (Events.AggregateId id) = Equinox.Stream(log, resolve id, maxAttempts = defaultArg maxAttempts 3) /// Attempts to achieve the intent represented by `command`. High level semantics as per comments on Command (see decide for lowdown) /// `false` is returned if a competing allocator holds it (or we're attempting to jump straight to Allocated without first Reserving) diff --git a/equinox-fc/Domain/TicketList.fs b/equinox-fc/Domain/TicketList.fs index f843e60c9..348e07384 100644 --- a/equinox-fc/Domain/TicketList.fs +++ b/equinox-fc/Domain/TicketList.fs @@ -11,6 +11,7 @@ module Events = interface TypeShape.UnionContract.IUnionContract let codec = FsCodec.NewtonsoftJson.Codec.Create() let [] categoryId = "TicketList" + let (|AggregateId|) id = Equinox.AggregateId(categoryId, TicketListId.toString id) module Folds = @@ -31,8 +32,7 @@ let interpret (allocatorId : AllocatorId, allocated : TicketId list) (state : Fo type Service internal (resolve, ?maxAttempts) = let log = Serilog.Log.ForContext() - let (|AggregateId|) id = Equinox.AggregateId(Events.categoryId, TicketListId.toString id) - let (|Stream|) (AggregateId id) = Equinox.Stream(log, resolve id, maxAttempts = defaultArg maxAttempts 3) + let (|Stream|) (Events.AggregateId id) = Equinox.Stream(log, resolve id, maxAttempts = defaultArg maxAttempts 3) member __.Sync(pickListId,allocatorId,assignedTickets) : Async = let (Stream stream) = pickListId