Registry Mirror
Skip to content

Conversation

@grandnode-dev

@grandnode-dev grandnode-dev commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Type: feature

Issue

A customer sees a reservation only as a line of text inside an order. There is no place in the account that lists what is booked and when.

Solution

  • New account page Reservations (/account/reservations, ReservationController.List), linked in the account navigation after Orders.
  • One row per booked order item: product (linked when published), the dates as the order shows them (store time, ReservationDateFormat), the resource of a day range or the parameter of a slot, and the order number linking to the order details.
  • Upcoming first (soonest first), then past (latest first), paged as one list; a heading row marks where each part begins. A reservation is upcoming until the end of the customer's today, so today's bookings stay at the top.
  • Data: GetCustomerReservationsQuery reads the customer's orders in the store (not cancelled, not deleted, with a reservation item), then groups their booked ProductReservation slots by order item in the database, in one read. The slot query carries the product ids so it uses the existing ProductId+Date index; no new index or collection. One customer's reservations are few, so they are ordered and paged in memory, dates compared in UTC on MongoDB and LiteDB.
  • Slots booked before Hold reservation slots in the cart on the slot itself #1158 have no OrderItemId; they are shown with the order's item of their product.
  • The tab follows a new setting CustomerSettings.HideReservationsTab (Customer settings in Admin and Store, like the other "Hide ... tab" settings). Off by default, so the tab is shown; a store that sells no reservations hides it there.
  • Themes: Modern and Nordic override neither the account navigation nor the account pages; the new page uses the same classes as the other account tables. Checked in Nordic light and dark.
  • New resources in DefaultLanguage.xml and Upgrade/en_250.xml.

Breaking changes

None.

Testing

Unit tests: GetCustomerReservationsQueryHandlerTests (MongoDB + LiteDB: only the customer's own, store-scoped, cancelled/deleted excluded, one row per item, ordering, paging across upcoming/past), GetCustomerReservationsHandlerTests, navigation tests. Catalog, Checkout and Web test projects pass.

E2E (shared reservations DB):

  1. Log in as customer@yourstore.com; My account → Reservations shows "You have no reservations yet."
  2. Book Trailforge Camping Tent Rental 12/14–12/16 and a Climbing Wall Session slot, check out with Cash on delivery.
  3. The page lists the tent (12/14 – 12/16, Tent 1) and the climbing slot (12/15 9:00, Beginner) under Upcoming, both linking to the order.
  4. Move the climbing booking into the past in the DB → it moves under Past.
  5. customer2@yourstore.com sees no reservations.
  6. Cancel the order in Admin → the customer's list is empty again.
  7. Admin → Settings → Customer settings → tick "Hide 'Reservations' tab" → the tab is gone and /account/reservations redirects to the account info.

A new account page shows what the customer's orders booked, one row per
order item: upcoming first, then past, with the store-time dates the order
shows, the resource or parameter, and a link to the order. Cancelled and
deleted orders do not appear. The tab shows only in stores that have
reservation products (cached; cleared with the product lists).
Copilot AI balanced review requested due to automatic review settings December 1, 2026 20:16
private readonly List<Order> _orders = [];
private readonly List<CustomerReservation> _reservations = [];
private GetCustomerReservationsQuery? _query;
private GetCustomerReservationsHandler _handler;

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved defects can merge legacy bookings or omit them across pages, hide accessible reservations when store limits are ignored, and display deleted-product bookings in the wrong time zone.

4 open issues
What changed in this PR

Adds a Reservations page to customer accounts, bringing booked slots and their order details into a single paged view.

Changes:

  • Adds the account route, navigation tab, and reservation table with upcoming and past sections.
  • Adds customer/store-scoped reservation queries and a cached check controlling tab visibility.
  • Adds translation resources and tests for queries, presentation, navigation, and cache invalidation.

Validation was limited to source inspection; tests and builds were not run.

File Description
src/​Web/​Grand.Web/​Views/​Shared/​Components/​CustomerNavigation/​Default.cshtml Adds the Reservations navigation link.
src/​Web/​Grand.Web/​Views/​Reservation/​List.cshtml Renders reservation groups, details, and pagination.
src/​Web/​Grand.Web/​Features/​Models/​Orders/​GetCustomerReservations.cs Defines the page-model request.
src/​Web/​Grand.Web/​Features/​Handlers/​Orders/​GetCustomerReservationsHandler.cs Prepares reservation rows and formatted dates.
src/​Web/​Grand.Web/​Features/​Handlers/​Customers/​GetNavigationHandler.cs Controls reservation-tab visibility.
src/​Web/​Grand.Web/​Endpoints/​EndpointProvider.cs Registers /account/reservations.
src/​Web/​Grand.Web/​Controllers/​ReservationController.cs Handles authenticated reservation-page requests.
src/​Web/​Grand.Web/​App_Data/​Resources/​Upgrade/​en_250.xml Adds reservation-page translation resources.
src/​Web/​Grand.Web.Models/​Orders/​CustomerReservationListModel.cs Defines reservation rows and paging state.
src/​Web/​Grand.Web.Models/​Customer/​CustomerNavigationModel.cs Adds reservation visibility and tab identifiers.
src/​Tests/​Grand.Web.Tests/​Features/​Handlers/​Orders/​GetCustomerReservationsHandlerTests.cs Tests row preparation and date display.
src/​Tests/​Grand.Web.Tests/​Features/​Handlers/​Customers/​GetNavigationHandlerTests.cs Tests reservation-tab visibility.
src/​Tests/​Grand.Business.Checkout.Tests/​Queries/​Handlers/​Orders/​GetCustomerReservationsQueryHandlerTests.cs Tests reservation filtering, grouping, ordering, and paging.
src/​Tests/​Grand.Business.Catalog.Tests/​Queries/​Handlers/​HasReservationProductsQueryHandlerTests.cs Tests product detection and store-specific caching.
src/​Tests/​Grand.Business.Catalog.Tests/​Events/​Handlers/​Cache/​ProductCacheEventHandlerTests.cs Checks reservation-cache invalidation.
src/​Core/​Grand.Infrastructure/​Caching/​Constants/​ProductCacheKey.cs Defines reservation-product cache keys.
src/​Business/​Grand.Business.Core/​Utilities/​Checkout/​CustomerReservation.cs Defines grouped booking data.
src/​Business/​Grand.Business.Core/​Queries/​Checkout/​Orders/​GetCustomerReservationsQuery.cs Defines reservation-query scope and pagination.
src/​Business/​Grand.Business.Core/​Queries/​Catalog/​HasReservationProductsQuery.cs Defines the reservation-product existence query.
src/​Business/​Grand.Business.Checkout/​Queries/​Handlers/​Orders/​GetCustomerReservationsQueryHandler.cs Retrieves, groups, sorts, and pages booked slots.
src/​Business/​Grand.Business.Catalog/​Queries/​Handlers/​HasReservationProductsQueryHandler.cs Caches reservation-product availability per store.
src/​Business/​Grand.Business.Catalog/​Events/​Handlers/​Cache/​ProductCacheEventHandler.cs Invalidates the new cache on product-list changes.

Review effort: Balanced

return await _cacheBase.GetAsync(string.Format(CacheKey.PRODUCTS_RESERVATION_KEY, request.StoreId),
() => _productRepository.AnyAsync(_productRepository.Table.Where(x =>
x.ProductTypeId == ProductType.Reservation &&
(!x.LimitedToStores || x.Stores.Contains(request.StoreId))), cancellationToken));
var productIds = orders.SelectMany(x => x.ProductIds).Distinct().ToList();
var reservations = _productReservationRepository.Table
.Where(x => productIds.Contains(x.ProductId) && orderIds.Contains(x.OrderId))
.GroupBy(x => new { x.OrderId, x.OrderItemId, x.ProductId })
Comment on lines +58 to +60
.OrderBy(x => x.FirstDate).ThenBy(x => x.OrderItemId);
var past = reservations.Where(x => x.LastDate < request.UpcomingFromUtc)
.OrderByDescending(x => x.FirstDate).ThenBy(x => x.OrderItemId);
Comment on lines +87 to +88
Date = await FormatDate(product, orderItem?.RentalStartDateUtc ?? reservation.FirstDate,
orderItem?.RentalEndDateUtc),
support added 2 commits December 1, 2026 21:44
The tab follows CustomerSettings.HideReservationsTab (Admin and Store
settings) instead of a cached check for reservation products, which hid
booked reservations once their product was deleted. The customer's
reservations are read once and ordered and paged in memory, comparing
dates in UTC on both data providers.
@grandnode-dev
grandnode-dev merged commit 6f0d0fc into develop Dec 2, 2026
9 checks passed
@grandnode-dev
grandnode-dev deleted the feature/reservation-customer-account branch December 2, 2026 05:49
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.

2 participants