Skip to content

Commit

Permalink
Moved sample namespaces around
Browse files Browse the repository at this point in the history
  • Loading branch information
stidsborg committed May 4, 2024
1 parent 6ab87a9 commit cedf9db
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cleipnir.Flows.Sample.Presentation.E_LoanApplication;
namespace Cleipnir.Flows.Sample.Presentation.D_LoanApplication;

public record CommandAndEvents;
public record PerformCreditCheck(string Id, Guid CustomerId, decimal Amount) : CommandAndEvents;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cleipnir.Flows.Sample.Presentation.E_LoanApplication;
namespace Cleipnir.Flows.Sample.Presentation.D_LoanApplication;

public static class CreditChecker1
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Cleipnir.Flows.Sample.Presentation.D_LoanApplication;

public class Example
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace Cleipnir.Flows.Sample.Presentation.D_LoanApplication;

public record LoanApplication(string Id, Guid CustomerId, decimal Amount, DateTime Created);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Cleipnir.ResilientFunctions.Reactive.Extensions;

namespace Cleipnir.Flows.Sample.Presentation.E_LoanApplication;
namespace Cleipnir.Flows.Sample.Presentation.D_LoanApplication;

public class LoanApplicationFlow : Flow<LoanApplication>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cleipnir.Flows.Sample.Presentation.E_LoanApplication;
namespace Cleipnir.Flows.Sample.Presentation.D_LoanApplication;

public static class MessageBroker
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cleipnir.Flows.Sample.Presentation.E_LoanApplication.Solution;
namespace Cleipnir.Flows.Sample.Presentation.D_LoanApplication.Solution;

public record CommandAndEvents;
public record PerformCreditCheck(string Id, Guid CustomerId, decimal Amount) : CommandAndEvents;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cleipnir.Flows.Sample.Presentation.E_LoanApplication.Solution;
namespace Cleipnir.Flows.Sample.Presentation.D_LoanApplication.Solution;

public static class CreditChecker1
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace Cleipnir.Flows.Sample.Presentation.D_LoanApplication.Solution;

public record LoanApplication(string Id, Guid CustomerId, decimal Amount, DateTime Created);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Cleipnir.ResilientFunctions.Reactive.Extensions;

namespace Cleipnir.Flows.Sample.Presentation.E_LoanApplication.Solution;
namespace Cleipnir.Flows.Sample.Presentation.D_LoanApplication.Solution;

public class LoanApplicationFlow : Flow<LoanApplication>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cleipnir.Flows.Sample.Presentation.E_LoanApplication.Solution;
namespace Cleipnir.Flows.Sample.Presentation.D_LoanApplication.Solution;

public static class MessageBroker
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cleipnir.Flows.Sample.Presentation.D_CustomerSignup;
namespace Cleipnir.Flows.Sample.Presentation.E_CustomerSignup;

public class SignupFlow : Flow<string>
{
Expand All @@ -7,15 +7,16 @@ public override async Task Run(string customerEmail)
// Flow:
// 1. send activation mail
// 2. wait for EmailVerified event or send reminder mail after 1 day
// * send a maximum of 5 reminders before failing flow
// * send a maximum of 3 reminders before failing flow
// 3. finally send welcome mail or fail

await SendActivationMail(customerEmail);

for (var i = 0; i <= 5; i++)
for (var i = 0; i <= 3; i++)
{
await SendReminderMail(customerEmail);
if (i == 5)

if (i == 3)
throw new UserSignupFailedException($"User '{customerEmail}' did not activate within threshold");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
using Cleipnir.ResilientFunctions.Reactive.Extensions;

namespace Cleipnir.Flows.Sample.Presentation.D_CustomerSignup.Solution;
namespace Cleipnir.Flows.Sample.Presentation.E_CustomerSignup.Solution;

public class SignupFlow : Flow<string>
{
public override async Task Run(string customerEmail)
{
await Effect.Capture("ActivationMail", () => SendActivationMail(customerEmail));

for (var i = 0; i <= 5; i++)
for (var i = 0; i <= 3; i++)
{
var emailVerifiedOption = await Messages
.OfType<EmailVerified>()
.TakeUntilTimeout($"Timeout_{i}", TimeSpan.FromDays(1))
.TakeUntilTimeout($"Timeout_{i}", expiresIn: TimeSpan.FromDays(1))
.SuspendUntilFirstOrNone();

if (emailVerifiedOption.HasValue)
break;

if (i == 5)
if (i == 3)
throw new UserSignupFailedException($"User '{customerEmail}' did not activate email within threshold");

await Effect.Capture($"Reminder_{i}", () => SendReminderMail(customerEmail));
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit cedf9db

Please sign in to comment.