Skip to content

Test - #1033

Closed
SilviuMihnea wants to merge 2 commits into
dotnet:mainfrom
SilviuMihnea:test
Closed

Test#1033
SilviuMihnea wants to merge 2 commits into
dotnet:mainfrom
SilviuMihnea:test

Conversation

@SilviuMihnea

Copy link
Copy Markdown

No description provided.

Add new field model to catalog item

Add mock data for catalog items model

Add model support to catalog and facets

Introduce a first-class "Model" field across the catalog stack. Adds a DB migration (AddCatalogItemModel), entity configuration (max length + index), and Model property on CatalogItem. API changes: GetAllItems and GetCatalogFacets accept model filters; faceting now returns per-model counts and a model total; OpenAPI specs updated. Client and service updates propagate model query parameters and include model in CatalogResult/CatalogItem DTOs; UI components (Web/Hybrid/ClientApp) display model values and expose a model facet that is shown only when a brand is selected (and cleared when the brand is cleared). CatalogAI indexing now includes model. Tests: new Playwright e2e test and multiple functional tests verify model filtering and facets. Small routing/config updates were made to include the new test in Playwright runs.

Add inventory reservations and reservation logic

Introduce InventoryReservation and ReservationStatus types plus EF configuration and tests to support holding stock for order lines. Register InventoryReservations in CatalogContext and apply InventoryReservationEntityTypeConfiguration (unique index on OrderId/ProductId for idempotency, indexes for lookup/expiry). Extend CatalogItem with ReservedStock, AvailableToPromise and methods Reserve, CommitReservation and ReleaseReservation to manage holds and commits with domain validations. Add comprehensive unit tests covering reservation lifecycle and CatalogItem reservation behavior.

Add inventory reservation service and tests

Introduce an InventoryReservationService with IInventoryReservationService and InventoryOptions to hold, commit and release stock for orders (all-or-nothing reservations). Register the service and options in DI and add InventoryOptions to appsettings. Use Postgres xmin as a concurrency token on CatalogItem to prevent double-reserving the last unit. Add functional tests exercising reservation, commit/release semantics and concurrency, and ensure the service mutates the CatalogContext without calling SaveChanges so callers can persist changes transactionally.

Retry reservations; preserve ReservedStock

Prevent ReservedStock from being clobbered when updating a CatalogItem via SetValues. Refactor OrderStatusChangedToAwaitingValidation handler to use IInventoryReservationService, add retry-on-concurrency (DbUpdateConcurrencyException) with a new InventoryOptions.MaxReservationAttempts setting (and appsettings entry), and introduce a RejectAsync helper to fail orders after retries are exhausted. Add functional tests (StockReservationHandlerTests) to validate reservation behaviour, outbox entries, and various edge cases (redelivery, unknown products, concurrent orders).

Add StockConcurrencyRetry and commit events

Introduce StockConcurrencyRetry service and register it in DI; refactor integration handlers to use the retry helper when reserving or committing stock so DbUpdateConcurrencyExceptions are retried and handled explicitly. Add InventoryReservationCommittedIntegrationEvent to announce committed reservations. Change IInventoryReservationService API to return SettledReservationLine lists from CommitAsync/ReleaseAsync (and add the SettledReservationLine type) and update InventoryReservationService to return the committed/released lines. Update functional tests to reflect the new return types and add coverage for payment committing reservations and published committed events.

Release reservations on order cancellation

Add support for releasing inventory when an order is cancelled. Introduces OrderStatusChangedToCancelledIntegrationEvent and InventoryReservationReleasedIntegrationEvent (with ReservationReleaseReason) plus a handler that releases holds via IInventoryReservationService, persists an outbox event, and publishes it. Registers the new subscription in Catalog API startup. Update Order aggregate to raise OrderCancelledDomainEvent when stock rejection leads to cancellation so holds are released and customers are notified. Add and extend tests: functional tests for cancellation scenarios (release, idempotency, after-payment behavior, availability to other orders) and unit tests for the order cancellation path.

Add reservation expiry sweep and batch event save

Introduce a background ReservationExpiryService that periodically finds and releases expired inventory holds for stalled orders. Add InventoryReservationExpiredIntegrationEvent and a new ICatalogIntegrationEventService.SaveEventsAndCatalogContextChangesAsync to persist multiple integration events atomically with catalog changes. Implement GetExpiredOrderIdsAsync in IInventoryReservationService and InventoryReservationService to enumerate lapsed orders for sweeping. Update CatalogIntegrationEventService to support saving and logging multiple events in a single resilient transaction. The change ensures expired releases and their expiry notifications are saved together and published reliably so orders don't hold stock indefinitely.

Create inventory-reservation-status.md

Revert "Add model to catalog item"

This reverts commit 7eb03a9.

Add model to catalog item

Add new field model to catalog item

Add mock data for catalog items model

Add model support to catalog and facets

Introduce a first-class "Model" field across the catalog stack. Adds a DB migration (AddCatalogItemModel), entity configuration (max length + index), and Model property on CatalogItem. API changes: GetAllItems and GetCatalogFacets accept model filters; faceting now returns per-model counts and a model total; OpenAPI specs updated. Client and service updates propagate model query parameters and include model in CatalogResult/CatalogItem DTOs; UI components (Web/Hybrid/ClientApp) display model values and expose a model facet that is shown only when a brand is selected (and cleared when the brand is cleared). CatalogAI indexing now includes model. Tests: new Playwright e2e test and multiple functional tests verify model filtering and facets. Small routing/config updates were made to include the new test in Playwright runs.
@SilviuMihnea
SilviuMihnea deleted the test branch September 21, 2026 00:28
@SilviuMihnea

Copy link
Copy Markdown
Author

Sorry, opened this by mistake

@SilviuMihnea
SilviuMihnea restored the test branch September 21, 2026 00:30
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