Skip to content

Commit f856f5f

Browse files
authored
Align bounded context file names with public types (#172)
- Move Gameplay handlers into a dedicated internal handlers module. - Rename Accounting files so primary public types match file names. - Split Rondel grouped files into type-matching public API files. - Update project compile order and repository guidance for the new layout.
1 parent 6a87c85 commit f856f5f

32 files changed

Lines changed: 328 additions & 254 deletions

AGENTS.md

Lines changed: 9 additions & 9 deletions
Large diffs are not rendered by default.

src/Imperium/Accounting/Commands.fs renamed to src/Imperium/Accounting/AccountingCommand.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ open Imperium
44
open Imperium.Primitives
55
open FsToolkit.ErrorHandling
66

7+
// ──────────────────────────────────────────────────────────────────────────
8+
// Commands
9+
// ──────────────────────────────────────────────────────────────────────────
10+
711
type AccountingCommand =
812
| ChargeNationForRondelMovement of ChargeNationForRondelMovementCommand
913
| VoidRondelCharge of VoidRondelChargeCommand
File renamed without changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Imperium.Accounting
2+
3+
// ──────────────────────────────────────────────────────────────────────────
4+
// Dependencies
5+
// ──────────────────────────────────────────────────────────────────────────
6+
7+
type PublishAccountingEvent = AccountingEvent -> Async<unit>
8+
9+
type AccountingDependencies = { Publish: PublishAccountingEvent }
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Imperium.Accounting
2+
3+
// ──────────────────────────────────────────────────────────────────────────
4+
// Dependencies
5+
// ──────────────────────────────────────────────────────────────────────────
6+
7+
/// Publish accounting domain events to the event bus.
8+
/// CancellationToken flows implicitly through Async context.
9+
type PublishAccountingEvent = AccountingEvent -> Async<unit>
10+
11+
/// Unified dependencies for all Accounting handlers.
12+
type AccountingDependencies = { Publish: PublishAccountingEvent }

src/Imperium/Accounting/Events.fs renamed to src/Imperium/Accounting/AccountingEvent.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ namespace Imperium.Accounting
33
open Imperium
44
open Imperium.Primitives
55

6+
// ──────────────────────────────────────────────────────────────────────────
7+
// Events
8+
// ──────────────────────────────────────────────────────────────────────────
9+
610
type AccountingEvent =
711
| RondelInvoicePaid of RondelInvoicePaidEvent
812
| RondelInvoicePaymentFailed of RondelInvoicePaymentFailedEvent
File renamed without changes.

src/Imperium/Accounting/Dependencies.fs

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/Imperium/Accounting/Dependencies.fsi

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/Imperium/Gameplay/Gameplay.fs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,6 @@ namespace Imperium.Gameplay
66

77
[<RequireQualifiedAccess>]
88
module Gameplay =
9-
module internal Handlers =
10-
let startGame state (command: StartGameCommand) =
11-
match state with
12-
| Some _ -> GameplayEffects.none
13-
| None ->
14-
let newState =
15-
{ GameId = command.GameId
16-
Status = InSetup
17-
Players = command.Players
18-
CompletedInitializations = Set.empty }
19-
20-
let newCommand =
21-
SetRondelToStartingPositions { GameId = command.GameId; Nations = NationId.all }
22-
23-
GameplayEffects.create newState |> GameplayEffects.withCommand newCommand
24-
25-
let rondelPositionedAtStart state (event: RondelPositionedAtStartInboundEvent) =
26-
match state with
27-
| Some s when s.CompletedInitializations |> Set.contains GameInitialization.Rondel |> not ->
28-
GameplayEffects.create
29-
{ s with
30-
Status = InPlay
31-
CompletedInitializations = s.CompletedInitializations |> Set.add GameInitialization.Rondel }
32-
|> GameplayEffects.withEvent (SetupCompleted { GameId = event.GameId })
33-
| _ -> GameplayEffects.none
34-
359
let execute deps command =
3610
async {
3711
let gameId =

0 commit comments

Comments
 (0)