-
Notifications
You must be signed in to change notification settings - Fork 2k
refactor(core): promote Money value object to BuildingBlocks and adopt in Billing top-ups #1316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
94127a5
7864674
b5d2d6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| namespace FSH.Modules.Catalog.Domain; | ||
| namespace FSH.Framework.Core.Domain; | ||
|
|
||
| public sealed record Money | ||
| { | ||
|
|
@@ -8,10 +8,6 @@ public sealed record Money | |
| public Money(decimal amount, string currency) | ||
| { | ||
| ArgumentException.ThrowIfNullOrWhiteSpace(currency); | ||
| if (amount < 0) | ||
| { | ||
| throw new ArgumentOutOfRangeException(nameof(amount), "Amount cannot be negative."); | ||
|
Comment on lines
-11
to
-13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Removing this guard makes the shared Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved in 7864674. The promoted |
||
| } | ||
| Amount = amount; | ||
| Currency = currency.ToUpperInvariant(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds a shared domain primitive under
src/BuildingBlocks, butAGENTS.mdgolden rule 4 says “Do NOT modifysrc/BuildingBlockswithout explicit approval” and.agents/rules/buildingblocks-protection.mdsays to “Confirm explicit approval.” I don't see that approval in this reviewed change/context; because Core is consumed by every module, this should not land until the approval is recorded or the type stays module-local.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acknowledged. This BuildingBlocks change is deliberate, not incidental: it promotes
Moneyto a shared domain primitive, stays dependency-free, and passes the BuildingBlocks independence/immutability/layering arch tests. Whether the golden-rule-4 approval bar is satisfied is a maintainer call, so flagging it here for explicit sign-off rather than self-approving.