Skip to content

feat(product): T1 — domain entities + DTO (Product, ProductCategory, BaseEntity)#51

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/product-t1-domain
Open

feat(product): T1 — domain entities + DTO (Product, ProductCategory, BaseEntity)#51
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/product-t1-domain

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the domain layer for the Product microservice under src/Services/Product/Product.Domain/.

Entities (Product.Domain.Entities):

  • BaseEntity — shared audit base with Id, CreatedBy/UpdatedBy ([MaxLength(40)]), and CreatedDate/UpdatedDate
  • Product — ported from monolith, drops ICollection<OrderDetail> OrderDetails nav property; includes self-referential Parent/Children and required ProductCategory FK
  • ProductCategoryName/Description/Icon + ICollection<Product> Products collection

DTOs (Product.Domain.DTOs):

  • ProductDto — matches monolith's ProductVM shape, flattens category to ProductCategoryName
  • CategoryDto — lightweight projection (Id, Name, Description, Icon)

Removes .gitkeep placeholders from Entities/ and Interfaces/.

All builds pass: Product.Domain.csproj and Product.API.csproj. No forbidden references (OrderDetail, Order, Customer, ApplicationUser).

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/bc5a9156cad244339c8ad8d1601e6dc2
Requested by: @mbatchelor81


Open in Devin Review

…BaseEntity)

Add domain layer for Product microservice:
- BaseEntity with audit fields (Id, CreatedBy, UpdatedBy, timestamps)
- Product entity (drops OrderDetails nav property from monolith)
- ProductCategory entity with Products collection
- ProductDto matching monolith ProductVM shape
- CategoryDto for category projections
- Remove .gitkeep placeholders from Entities/ and Interfaces/
@mbatchelor81 mbatchelor81 self-assigned this Jun 26, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Open in Devin Review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 DbContext does not register new entity DbSets

The new Product and ProductCategory entities are defined but ProductDbContext (src/Services/Product/Product.Infrastructure/Data/ProductDbContext.cs) has no DbSet<> properties for them and no entity configuration in OnModelCreating. EF Core can still discover entities via navigation properties if one is registered, but currently neither is registered. This means any attempt to query or persist these entities will fail until DbSet<Product> and DbSet<ProductCategory> are added. This is likely intentional scaffolding (the TODO comment in OnModelCreating says as much), but it's worth tracking to ensure it doesn't get forgotten.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct — DbSet<Product> and DbSet<ProductCategory> registration is intentionally out of scope for this domain-only PR. The existing TODO in OnModelCreating tracks this; it'll be wired up when the Infrastructure layer task lands.

Comment on lines +14 to +20
public int? ParentId { get; set; }
public Product? Parent { get; set; }

public int ProductCategoryId { get; set; }
public required ProductCategory ProductCategory { get; set; }

public ICollection<Product> Children { get; } = [];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Self-referencing Product relationship needs explicit EF Core configuration

The Product entity has a self-referencing parent-child relationship (ParentId/Parent/Children at lines 14-20). EF Core's conventions may handle this, but the cascade delete behavior for self-referencing relationships often requires explicit configuration to avoid cycles (e.g., .OnDelete(DeleteBehavior.Restrict)). Without this, migrations may fail on SQL Server or PostgreSQL depending on provider defaults. The ProductDbContext.OnModelCreating currently has a TODO placeholder, so this should be addressed when that configuration is implemented.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged — the self-referencing relationship will need .OnDelete(DeleteBehavior.Restrict) (or similar) in OnModelCreating. That's Infrastructure-layer work, intentionally deferred to a later task when ProductDbContext configuration is implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant