Shop It Docs
Developer ResourcescatalogFeatured

Featured Module Feature List

Featured placement feature contract for admin and customer/mobile catalog surfaces.

Featured Module - Feature List

1. Feature Overview

The featured submodule manages curated storefront placements linked to products, with activation windows (startDate/endDate) and ordering.

2. Route Ownership and Surfaces

  • Admin controller: apps/api/src/modules/catalog/admin/featured/featured-admin.controller.ts
    • Base path: /api/admin/featured
  • Customer controller: apps/api/src/modules/catalog/customer/featured/featured-customer.controller.ts
    • Base path: /api/featured
  • Mobile composition: apps/api/src/modules/mobile/mobile.module.ts
    • Same customer controller additionally exposed as /api/mobile/featured

3. Admin Feature Matrix

FeatureBehavior
List featured rowsFilter/search/sort/paginate
Get featured rowNumeric :id lookup
Create featured rowValidates date window and optional category existence
Update featured rowPartial updates with same validation rules
Delete featured rowDeletes by id and invalidates cache

4. Customer/Mobile Feature Matrix

FeatureBehavior
Active featured listPublic endpoint (@Public())
Date-window filteringIncludes only records active at request time
Optional filterssearch, categoryId, isActive
SortingCustomer allowlist: order, createdAt
PaginationSupported (pagination=false by default)

5. Key Business Rules

  • Date invariant: startDate <= endDate when both are present.
  • Optional categoryId must refer to an existing category on admin writes.
  • Customer listing defaults to active records and valid date window.
  • Display ordering is controlled through integer order.

6. State Models

Active-window state model

  • active now: isActive=true and within [startDate, endDate] (null bounds allowed)
  • scheduled future: start date in future
  • expired: end date in past
  • inactive: isActive=false

7. Caching Strategy

Key PrefixUsed For
catalog:featured:list:Customer featured list cache

TTL resolution in customer service:

  • CATALOG_FEATURED_CACHE_TTL_SECONDS
  • fallback CATALOG_CACHE_TTL_SECONDS
  • fallback REDIS_CACHE_TTL_SECONDS

Admin invalidates:

  • catalog:featured:active*
  • catalog:featured:list:*

8. Rate Limiting

No explicit featured-specific rate limiter is implemented in featured controllers for this scope.

9. Queue/Worker Features

No BullMQ queue or worker is implemented for featured flows.

10. Error UX Mapping

errorCodeTypical UX Handling
FEATURED_NOT_FOUNDShow not-found state for edit/detail
FEATURED_INVALID_DATE_RANGEInline date-range validation message
FEATURED_INVALID_SORTReset customer sort to supported default
CATEGORY_NOT_FOUNDPrompt admin to choose an existing category

11. Integration Flows

An admin creates a featured product placement with date window.

  1. Admin calls POST /api/admin/featured with productId, startDate, endDate, and optional categoryId.
  2. System validates: date window (startDate <= endDate when both present).
  3. System validates: categoryId exists if provided.
  4. System sets order based on creation timestamp or explicit value.
  5. Admin calls PATCH /api/admin/featured/:id to adjust dates or toggle isActive.

A customer views active featured products on the storefront.

  1. Customer calls GET /api/featured to see active featured products.
  2. System filters: isActive = true and current time within [startDate, endDate] (null bounds allowed).
  3. System returns products ordered by order field.
  4. Customer can filter by categoryId or apply search query.
  5. Customer can sort by order or createdAt.

An admin reorders and manages featured placements.

  1. Admin calls POST /api/admin/featured/reorder with ordered array of featured IDs.
  2. System updates order values for all affected rows.
  3. Admin calls DELETE /api/admin/featured/:id to remove a featured placement.
  4. System deletes row and invalidates customer featured cache.

12. Release/QA Checklist

  • Verify admin CRUD + Featured_* permissions.
  • Verify date window validation on create/update.
  • Verify customer active-window filtering.
  • Verify cache invalidation after admin writes.
  • Verify mobile and non-mobile public route behavior parity.

See Also