-
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.
Added Products and Categories to DB of Warehouse module
- Loading branch information
1 parent
2f179e0
commit 5c60031
Showing
52 changed files
with
508 additions
and
184 deletions.
There are no files selected for viewing
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...SharedKernel/Domain/Base/AggregateRoot.cs → ...SharedKernel/Domain/Base/AggregateRoot.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
2 changes: 1 addition & 1 deletion
2
...n/SharedKernel/Domain/Base/DomainEvent.cs → ...n.SharedKernel/Domain/Base/DomainEvent.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
4 changes: 2 additions & 2 deletions
4
...Common/SharedKernel/Domain/Base/Entity.cs → ...Common.SharedKernel/Domain/Base/Entity.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
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,3 @@ | ||
namespace Common.SharedKernel.Domain.Base; | ||
|
||
public record ValueObject { } |
4 changes: 2 additions & 2 deletions
4
.../SharedKernel/Domain/Entities/Currency.cs → ....SharedKernel/Domain/Entities/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
2 changes: 1 addition & 1 deletion
2
...mon/SharedKernel/Domain/Entities/Money.cs → ...mon.SharedKernel/Domain/Entities/Money.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
2 changes: 1 addition & 1 deletion
2
...rnel/Domain/Exceptions/DomainException.cs → ...rnel/Domain/Exceptions/DomainException.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
5 changes: 3 additions & 2 deletions
5
...rnel/Domain/Exceptions/GuardClausesExt.cs → ...rnel/Domain/Exceptions/GuardClausesExt.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
3 changes: 3 additions & 0 deletions
3
src/Common/Common.SharedKernel/Domain/Identifiers/ProductId.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,3 @@ | ||
namespace Common.SharedKernel.Domain.Identifiers; | ||
|
||
public record ProductId(Guid Value); |
2 changes: 1 addition & 1 deletion
2
...nel/Domain/Interfaces/IAuditableEntity.cs → ...nel/Domain/Interfaces/IAuditableEntity.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
4 changes: 2 additions & 2 deletions
4
...Kernel/Domain/Interfaces/IDomainEvents.cs → ...Kernel/Domain/Interfaces/IDomainEvents.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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
src/Modules/Orders/Modules.Orders.Domain/Customers/CustomerCreatedEvent.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
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
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
4 changes: 2 additions & 2 deletions
4
src/Modules/Orders/Modules.Orders.Domain/Orders/OrderCreatedEvent.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
2 changes: 1 addition & 1 deletion
2
src/Modules/Orders/Modules.Orders.Domain/Orders/OrderReadyForShippingEvent.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
63 changes: 0 additions & 63 deletions
63
src/Modules/Orders/Modules.Orders.Domain/Products/Product.cs
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/Modules/Orders/Modules.Orders.Domain/Products/ProductByIdSpec.cs
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
src/Modules/Orders/Modules.Orders.Domain/Products/ProductCreatedEvent.cs
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
src/Modules/Orders/Modules.Orders.Domain/Products/ProductId.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
src/Modules/Warehouse/Modules.Warehouse.Application/Categories/CategoryService.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,19 @@ | ||
using Modules.Warehouse.Application.Common.Interfaces; | ||
using Modules.Warehouse.Domain.Categories; | ||
|
||
namespace Modules.Warehouse.Application.Categories; | ||
|
||
public class CategoryRepository : ICategoryRepository | ||
{ | ||
private readonly IWarehouseDbContext _dbContext; | ||
|
||
public CategoryRepository(IWarehouseDbContext dbContext) | ||
{ | ||
_dbContext = dbContext; | ||
} | ||
|
||
public bool CategoryExists(string categoryName) | ||
{ | ||
return _dbContext.Categories.Any(c => c.Name == categoryName); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Modules/Warehouse/Modules.Warehouse.Application/Common/Interfaces/IWarehouseDbContext.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,12 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Modules.Warehouse.Domain.Categories; | ||
using Modules.Warehouse.Domain.Products; | ||
|
||
namespace Modules.Warehouse.Application.Common.Interfaces; | ||
|
||
public interface IWarehouseDbContext | ||
{ | ||
public DbSet<Category> Categories { get; } | ||
|
||
public DbSet<Product> Products { get; } | ||
} |
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: 26 additions & 0 deletions
26
.../Warehouse/Modules.Warehouse.Application/Products/Queries/GetProducts/GetProductsQuery.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,26 @@ | ||
using MediatR; | ||
using Microsoft.EntityFrameworkCore; | ||
using Modules.Warehouse.Application.Common.Interfaces; | ||
|
||
namespace Modules.Warehouse.Application.Products.Queries.GetProducts; | ||
|
||
public record GetProductsQuery : IRequest<IEnumerable<ProductDto>>; | ||
|
||
public record ProductDto(Guid Id, string Sku, string Name, decimal Price); | ||
|
||
public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, IEnumerable<ProductDto>> | ||
{ | ||
private readonly IWarehouseDbContext _dbContext; | ||
|
||
public GetProductsQueryHandler(IWarehouseDbContext dbContext) | ||
{ | ||
_dbContext = dbContext; | ||
} | ||
|
||
public async Task<IEnumerable<ProductDto>> Handle(GetProductsQuery request, CancellationToken cancellationToken) | ||
{ | ||
return await _dbContext.Products | ||
.Select(p => new ProductDto(p.Id.Value, p.Sku.Value, p.Name, p.Price.Amount)) | ||
.ToListAsync(cancellationToken: cancellationToken); | ||
} | ||
} |
Oops, something went wrong.