-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e4c6a3
commit 57f421f
Showing
9 changed files
with
75 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
Src/Product.Domain/Aggregates/Product/Entities/CommenterUser.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Product.Domain.Aggregates.ProductAggregate; | ||
|
||
public class CommenterUser | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Src/Product.Domain/Aggregates/Product/Exceptions/InvalidCurrencyException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Product.Domain.Aggregates.Product.Exceptions; | ||
|
||
public class InvalidCurrencyException : Exception | ||
{ | ||
public InvalidCurrencyException() : base(message: "Currency is not valid") | ||
{ | ||
|
||
} | ||
public InvalidCurrencyException(string msg) : base(message: msg) | ||
{ | ||
|
||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Src/Product.Domain/Aggregates/Product/Exceptions/InvalidPriceException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Product.Domain.Aggregates.Product.Exceptions; | ||
|
||
public class InvalidPriceException : Exception | ||
{ | ||
public InvalidPriceException() : base(message: "Price is not valid") | ||
{ | ||
|
||
} | ||
public InvalidPriceException(string msg) : base(message: msg) | ||
{ | ||
|
||
} | ||
} |
14 changes: 13 additions & 1 deletion
14
Src/Product.Domain/Aggregates/Product/ValueObjects/Currency.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 12 additions & 14 deletions
26
Src/Product.Domain/Aggregates/Product/ValueObjects/Price.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
using Product.Domain.Aggregates.Product.Exceptions; | ||
using Product.Domain.Base; | ||
using Product.Domain.Exceptions; | ||
|
||
namespace Product.Domain.Aggregates.ProductAggregate; | ||
|
||
public class Price : ValueObject | ||
{ | ||
public int Value { get; private set; } | ||
public Currency Currency { get; private set; } | ||
public int Value { get; } | ||
public Currency Currency { get; } | ||
|
||
public Price() | ||
public Price(int price , Currency currency) | ||
{ | ||
if (price is 0) | ||
throw new InvalidPriceException("price can not be 0"); | ||
|
||
if(price < 0) | ||
throw new InvalidPriceException("price can not be negative"); | ||
|
||
Value = price; | ||
Currency = currency; | ||
} | ||
protected override IEnumerable<object> GetEqualityComponents() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
private void SetValue(int value) | ||
{ | ||
if (value is 0) | ||
throw new DomainValidationException("price can not be 0"); | ||
|
||
if(value < 0) | ||
throw new DomainValidationException("price can not be negative"); | ||
|
||
Value = value; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Product.Domain.Base; | ||
|
||
namespace Product.Domain.Shared.Entity; | ||
|
||
public class UserModel : BaseEntity | ||
{ | ||
|
||
} |