-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: add product ports and adapters #23
Conversation
WalkthroughThe recent update focuses on enhancing product management within the ByteMeBurger system. It introduces a new Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (4)
Files skipped from review as they are similar to previous changes (4)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 3
Out of diff range and nitpick comments (2)
src/FIAP.TechChallenge.ByteMeBurger.Domain/Base/Entity.cs (1)
Line range hint
19-19
: Add null checks before accessingId
inGetHashCode
to prevent possible null reference exceptions.- return Id.GetHashCode(); + return Id?.GetHashCode() ?? 0;src/FIAP.TechChallenge.ByteMeBurger.Domain/Entities/Product.cs (1)
52-60
: MethodUpdate
should ensure immutability of theProduct
by returning a new instance rather than modifying existing one.Consider returning a new
Product
instance with updated values to ensure the entity remains immutable.
public DateTime CreationDate { get; set; } | ||
|
||
public DateTime? LastUpdate { get; set; } |
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.
Ensure CreationDate
is set in constructor to avoid uninitialized state.
- public DateTime CreationDate { get; set; }
+ public DateTime CreationDate { get; private set; } = DateTime.UtcNow;
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
public DateTime CreationDate { get; set; } | |
public DateTime? LastUpdate { get; set; } | |
public DateTime CreationDate { get; private set; } = DateTime.UtcNow; | |
public DateTime? LastUpdate { get; set; } |
public void Create() | ||
{ | ||
CreationDate = DateTime.UtcNow; | ||
} |
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.
Method Create
should be called within constructors to ensure CreationDate
is always initialized.
+ Create();
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
public void Create() | |
{ | |
CreationDate = DateTime.UtcNow; | |
} | |
public void Create() | |
{ | |
CreationDate = DateTime.UtcNow; | |
Create(); | |
} |
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.
Actionable comments posted: 5
src/FIAP.TechChallenge.ByteMeBurger.Api/Model/CreateProductCommandDto.cs
Outdated
Show resolved
Hide resolved
// TODO make this iternal | ||
public Product ToProduct() => new Product(Guid.NewGuid(), Name, Description, Category, Price, Images); |
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.
The method ToProduct
should be internal as noted in the TODO comment to encapsulate the conversion logic within the API layer.
- public Product ToProduct() => new Product(Guid.NewGuid(), Name, Description, Category, Price, Images);
+ internal Product ToProduct() => new Product(Guid.NewGuid(), Name, Description, Category, Price, Images);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
// TODO make this iternal | |
public Product ToProduct() => new Product(Guid.NewGuid(), Name, Description, Category, Price, Images); | |
// TODO make this iternal | |
internal Product ToProduct() => new Product(Guid.NewGuid(), Name, Description, Category, Price, Images); |
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Refactor