Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
95918e0
Merge pull request #105 from odimsom/dev
odimsom May 17, 2026
3c11a49
Merge pull request #106 from odimsom/qa
odimsom May 17, 2026
bcbe65b
chore(deps): bump nodemailer in /notification-service
dependabot[bot] May 17, 2026
50d8cc8
chore(deps-dev): bump hono in /frontend/web-admin
dependabot[bot] May 17, 2026
1f7cd0e
Merge pull request #116 from odimsom/dependabot/npm_and_yarn/frontend…
odimsom May 17, 2026
84a7765
Merge pull request #115 from odimsom/dependabot/npm_and_yarn/notifica…
odimsom May 17, 2026
349d8ea
Merge pull request #122 from odimsom/dev
odimsom May 17, 2026
a2b22d6
chore(deps-dev): bump postcss in /frontend/web-admin (#118)
dependabot[bot] May 17, 2026
c0ef4d8
chore(deps): bump ip-address and express-rate-limit (#119)
dependabot[bot] May 17, 2026
c368485
chore(deps-dev): bump @hono/node-server in /frontend/web-admin (#120)
dependabot[bot] May 17, 2026
36ca76b
chore(deps-dev): bump @xmldom/xmldom in /frontend/web-admin (#121)
dependabot[bot] May 17, 2026
a1a439f
Merge pull request #123 from odimsom/qa
odimsom May 17, 2026
61f6e1a
chore(deps): bump the docker-images group with 2 updates (#124)
dependabot[bot] May 17, 2026
e4e8680
chore(deps): bump mongoose in /scripts in the scripts-deps group (#126)
dependabot[bot] May 17, 2026
a4eaf39
chore(deps-dev): bump the frontend-root group (#129)
dependabot[bot] May 17, 2026
b847de4
chore(deps): bump the notification-deps group (#134)
dependabot[bot] May 17, 2026
c5e0392
chore(deps): bump the actions group with 13 updates (#137)
dependabot[bot] May 17, 2026
c03d1c1
chore(deps): bump the auth-prod group in /auth with 2 updates (#138)
dependabot[bot] May 17, 2026
b3bbef5
chore(deps): bump the angular group (#139)
dependabot[bot] May 17, 2026
dfa254f
chore(deps-dev): bump the tailwind group (#140)
dependabot[bot] May 17, 2026
9fc2a9e
chore(deps-dev): bump @playwright/test (#141)
dependabot[bot] May 17, 2026
196e771
chore(deps): bump the landing-deps group (#142)
dependabot[bot] May 17, 2026
b4cacff
Bump the ef-core group with 7 updates (#146)
dependabot[bot] May 17, 2026
7ac5b0e
chore(deps): bump aspnet group - Microsoft.Extensions.Configuration/H…
dependabot[bot] May 17, 2026
24dde83
chore(deps): bump testing group - FluentAssertions, Test.Sdk, xunit r…
dependabot[bot] May 17, 2026
a0ef989
chore(deps): bump redis in /services/reports-service (#125)
dependabot[bot] May 17, 2026
81ecdcb
chore(deps): bump tower-http in /services/reports-service (#127)
dependabot[bot] May 17, 2026
e889314
chore(deps): bump axum from 0.7.9 to 0.8.9 in /services/catalog-servi…
dependabot[bot] May 17, 2026
5ac07a8
chore(deps): bump axum from 0.7.9 to 0.8.9 in /services/reports-servi…
dependabot[bot] May 17, 2026
1b76aee
chore(deps): bump redis in /services/catalog-service (#131)
dependabot[bot] May 17, 2026
6c9aa70
chore(deps): bump tower in /services/catalog-service (#133)
dependabot[bot] May 17, 2026
8426c8e
chore(deps): bump thiserror in /services/catalog-service (#135)
dependabot[bot] May 17, 2026
eb2c2df
chore(deps-dev): bump the auth-dev group in /auth with 4 updates (#143)
dependabot[bot] May 17, 2026
e0916bf
chore(deps-dev): bump the other-frontend group in /frontend/web-admin…
dependabot[bot] May 17, 2026
5343f54
chore(deps-dev): bump jsdom from 28.1.0 to 29.1.1 in /frontend/web-ad…
dependabot[bot] May 17, 2026
dd53215
chore(deps): bump path-to-regexp from 8.3.0 to 8.4.2 in /auth (#149)
dependabot[bot] May 17, 2026
4b71d08
chore(deps): bump brace-expansion from 1.1.12 to 2.1.0 in /auth (#150)
dependabot[bot] May 17, 2026
b20f76a
fix(deps): downgrade tailwindcss to v3, bump prometheus and tower-htt…
odimsom May 17, 2026
7215d60
fix(web-admin): downgrade tailwindcss/daisyui back to v3/v4 compat (#…
odimsom May 17, 2026
dced382
fix(devops): redirect devops.tucolmadord.com root to /grafana/
May 17, 2026
93742b2
actualizaciones de varias
May 19, 2026
a81540b
actualizaciones de varias
May 19, 2026
2d724d4
Merge branch 'dev' into fix/devops-root-redirect-compose
odimsom May 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using TuColmadoRD.Core.Domain.Entities.Inventory;
using TuColmadoRD.Core.Domain.Entities.Sales;
using TuColmadoRD.Core.Domain.Entities.System;
using TuColmadoRD.Core.Domain.Enums.Inventory_Purchasing;
using TuColmadoRD.Core.Domain.ValueObjects;
using TuColmadoRD.Core.Domain.ValueObjects.Base;
using TuColmadoRD.Core.Domain.Interfaces.Repositories.Logistics;
Expand Down Expand Up @@ -59,6 +58,9 @@ public SalesModuleTests()
_tenant.Object,
_shiftService.Object,
_productRepo.Object,
new Mock<IPresentationRepository>().Object,
new Mock<IPackagedStockRepository>().Object,
new Mock<IStockContainerRepository>().Object,
_saleRepo.Object,
_sequence.Object,
_shiftRepo.Object,
Expand All @@ -75,7 +77,6 @@ public SalesModuleTests()
_tenant.Object,
_shiftService.Object,
_saleRepo.Object,
_productRepo.Object,
_shiftRepo.Object,
_outboxRepo.Object,
_uow.Object,
Expand Down Expand Up @@ -107,7 +108,7 @@ public async Task CreateSale_WithValidItems_ShouldPersistSaleAndCommit()
.ReturnsAsync(new List<Product> { product }.AsReadOnly());

var command = new CreateSaleCommand(
new List<SaleItemRequest> { new(product.Id, 2m) }.AsReadOnly(),
new List<SaleItemRequest> { new(product.Id, Guid.NewGuid(), 2m) }.AsReadOnly(),
new List<SalePaymentRequest> { new(1, 300m, null, null) }.AsReadOnly(),
null);

Expand All @@ -131,7 +132,7 @@ public async Task CreateSale_WithoutOpenShift_ShouldReturnShiftNotFoundError()
DomainError.Business("shift.not_found", "No hay turno abierto")));

var command = new CreateSaleCommand(
new List<SaleItemRequest> { new(Guid.NewGuid(), 1m) }.AsReadOnly(),
new List<SaleItemRequest> { new(Guid.NewGuid(), Guid.NewGuid(), 1m) }.AsReadOnly(),
new List<SalePaymentRequest>().AsReadOnly(),
null);

Expand Down Expand Up @@ -219,14 +220,10 @@ private Shift BuildShift()

private Product BuildProduct()
{
var cost = Money.FromDecimal(80m).Result!;
var price = Money.FromDecimal(100m).Result!;
var taxRate = TaxRate.Create(0.18m).Result!;
var result = Product.Create(_tenantId, "Producto Test", Guid.NewGuid(), cost, price, taxRate, UnitType.Unit);
var result = Product.Create(_tenantId, "Producto Test", Guid.NewGuid(), taxRate);
result.IsGood.Should().BeTrue("el producto de prueba debe crearse sin errores");
var product = result.Result!;
product.AdjustStock(100m); // stock inicial para que las ventas puedan descontar
return product;
return result.Result!;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using FluentAssertions;
using TuColmadoRD.Core.Domain.Entities.Inventory;
using TuColmadoRD.Core.Domain.Entities.Inventory.Events;
using TuColmadoRD.Core.Domain.Enums.Inventory_Purchasing;
using TuColmadoRD.Core.Domain.ValueObjects;

namespace TuColmadoRD.Tests.Inventory;
Expand All @@ -13,95 +12,90 @@ public void Create_WhenDataIsValid_ReturnsProductAndEmitsCreatedEvent()
{
var tenantId = Guid.NewGuid();
var categoryId = Guid.NewGuid();
var cost = Money.FromDecimal(50m).Result!;
var sale = Money.FromDecimal(75m).Result!;
var taxRate = TaxRate.Create(0.18m).Result!;

var result = Product.Create(tenantId, "Coca Cola 2L", categoryId, cost, sale, taxRate, UnitType.Unit);
var result = Product.Create(tenantId, "Coca Cola 2L", categoryId, taxRate);

result.IsGood.Should().BeTrue();
result.Result.Name.Should().Be("Coca Cola 2L");
result.Result!.Name.Should().Be("Coca Cola 2L");
result.Result.CategoryId.Should().Be(categoryId);
result.Result.StockQuantity.Should().Be(0m);
result.Result.IsActive.Should().BeTrue();
result.Result.DomainEvents.Should().ContainSingle(e => e is ProductCreatedDomainEvent);
}

[Fact]
public void Create_WhenSalePriceIsBelowCost_ReturnsValidationError()
public void Create_WhenNameIsEmpty_ReturnsValidationError()
{
var tenantId = Guid.NewGuid();
var categoryId = Guid.NewGuid();
var cost = Money.FromDecimal(80m).Result!;
var sale = Money.FromDecimal(70m).Result!;
var taxRate = TaxRate.Create(0.18m).Result!;
var taxRate = TaxRate.Create(0m).Result!;

var result = Product.Create(tenantId, " ", categoryId, taxRate);

result.IsGood.Should().BeFalse();
result.Error!.Code.Should().Be("product.name_required");
}

[Fact]
public void Create_WhenTenantIdIsEmpty_ReturnsValidationError()
{
var categoryId = Guid.NewGuid();
var taxRate = TaxRate.Create(0m).Result!;

var result = Product.Create(tenantId, "Leche", categoryId, cost, sale, taxRate, UnitType.Liter);
var result = Product.Create(Guid.Empty, "Leche", categoryId, taxRate);

result.IsGood.Should().BeFalse();
result.Error.Code.Should().Be("product.sale_price_below_cost");
result.Error!.Code.Should().Be("product.tenant_required");
}

[Fact]
public void UpdatePrice_WhenDataIsValid_UpdatesPricesAndEmitsEvent()
public void UpdateName_WhenDataIsValid_UpdatesName()
{
var product = CreateValidProduct();
var newCost = Money.FromDecimal(60m).Result!;
var newSale = Money.FromDecimal(95m).Result!;

var result = product.UpdatePrice(newCost, newSale);
var result = product.UpdateName("Azucar Morena");

result.IsGood.Should().BeTrue();
product.CostPrice.Amount.Should().Be(60m);
product.SalePrice.Amount.Should().Be(95m);
product.DomainEvents.Should().Contain(e => e is ProductPriceUpdatedDomainEvent);
product.Name.Should().Be("Azucar Morena");
}

[Fact]
public void AdjustStock_WhenResultWouldBeNegative_ReturnsBusinessError()
public void UpdateName_WhenNameIsEmpty_ReturnsValidationError()
{
var product = CreateValidProduct();

var result = product.AdjustStock(-1m);
var result = product.UpdateName(" ");

result.IsGood.Should().BeFalse();
result.Error.Code.Should().Be("product.insufficient_stock");
product.StockQuantity.Should().Be(0m);
result.Error!.Code.Should().Be("product.name_required");
product.Name.Should().Be("Test Product");
}

[Fact]
public void RehydrateForCatalogSync_SetsGivenIdAndClearsDomainEvents()
public void Rehydrate_SetsGivenIdAndHasNoDomainEvents()
{
var productId = Guid.NewGuid();
var tenantId = Guid.NewGuid();
var categoryId = Guid.NewGuid();
var cost = Money.FromDecimal(40m).Result!;
var sale = Money.FromDecimal(65m).Result!;
var taxRate = TaxRate.Create(0.18m).Result!;

var result = Product.RehydrateForCatalogSync(productId, tenantId, categoryId, "Arroz", cost, sale, taxRate);
var product = Product.Rehydrate(productId, tenantId, "Arroz", categoryId, taxRate);

result.IsGood.Should().BeTrue();
result.Result.Id.Should().Be(productId);
result.Result.UnitType.Should().Be(UnitType.Unit);
result.Result.DomainEvents.Should().BeEmpty();
product.Id.Should().Be(productId);
product.Name.Should().Be("Arroz");
product.DomainEvents.Should().BeEmpty();
}

[Fact]
public void UpdateFromCatalogSync_WhenDataIsValid_UpdatesCoreFields()
public void UpdateItbisRate_WhenCalled_UpdatesRate()
{
var product = CreateValidProduct();
var newCategoryId = Guid.NewGuid();
var newCost = Money.FromDecimal(25m).Result!;
var newSale = Money.FromDecimal(38m).Result!;
var newRate = TaxRate.Create(0.18m).Result!;

var result = product.UpdateFromCatalogSync(newCategoryId, " Azucar Morena ", newCost, newSale);
var result = product.UpdateItbisRate(newRate);

result.IsGood.Should().BeTrue();
product.Name.Should().Be("Azucar Morena");
product.CategoryId.Should().Be(newCategoryId);
product.CostPrice.Amount.Should().Be(25m);
product.SalePrice.Amount.Should().Be(38m);
product.ItbisRate.Should().Be(newRate);
}

[Fact]
Expand All @@ -119,11 +113,9 @@ private static Product CreateValidProduct()
{
var tenantId = Guid.NewGuid();
var categoryId = Guid.NewGuid();
var cost = Money.FromDecimal(10m).Result!;
var sale = Money.FromDecimal(15m).Result!;
var taxRate = TaxRate.Create(0.18m).Result!;

var created = Product.Create(tenantId, "Test Product", categoryId, cost, sale, taxRate, UnitType.Unit);
var created = Product.Create(tenantId, "Test Product", categoryId, taxRate);

return created.Result!;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,12 @@ public async Task SyncAsync_WhenCloudReturnsProducts_UpsertsExistingProduct()
var fakeHandler = new FakeHttpMessageHandler(HttpStatusCode.OK, payload);
using var setup = CreateSetup(true, fakeHandler, null);

var existing = Product.RehydrateForCatalogSync(
var existing = Product.Rehydrate(
productId,
setup.TenantProvider.TenantId,
Guid.NewGuid(),
(Guid)setup.TenantProvider.TenantId,
"Viejo",
Money.FromDecimal(0).Result,
Money.FromDecimal(100).Result,
TaxRate.Create(0).Result).Result;
Guid.NewGuid(),
TaxRate.Create(0).Result!);

setup.DbContext.Products.Add(existing);
await setup.DbContext.SaveChangesAsync();
Expand Down
Loading