feat(data-access): add allByEnrollmentProductCode to SiteCollection#1455
feat(data-access): add allByEnrollmentProductCode to SiteCollection#1455jindaliiita merged 4 commits intomainfrom
Conversation
Adds allSiteIdsByProductCode to SiteEnrollmentCollection and allByEnrollmentProductCode to SiteCollection, enabling efficient site fetching scoped to a specific product (e.g. LLMO) using a single PostgREST JOIN query followed by a batch key lookup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Free trials dont have entitlement info. |
I am able to see it for site ID
|
|
This PR will trigger a minor release when merged. |
## [@adobe/spacecat-shared-data-access-v3.30.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.29.0...@adobe/spacecat-shared-data-access-v3.30.0) (2026-03-25) ### Features * **data-access:** add allByEnrollmentProductCode to SiteCollection ([#1455](#1455)) ([0225791](0225791))
|
🎉 This PR is included in version @adobe/spacecat-shared-data-access-v3.30.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
allSiteIdsByProductCode(productCode)toSiteEnrollmentCollection— performs a single PostgREST JOIN query (site_enrollments⨝entitlements) to return all site IDs enrolled in a given product codeallByEnrollmentProductCode(productCode, options)toSiteCollection— uses the above to scope site fetching to a specific product (e.g. LLMO), then batch-fetches full Site objects with caller-controlled field projection viaoptions.attributesMotivation
Required by the
optimize-at-edge-enabled-markingimport worker job, which previously fetched all sites viaSite.all(). Scoping to LLMO-enrolled sites reduces unnecessary data transfer and in-memory filtering as the DB scales.Test plan
SiteEnrollmentCollection—allSiteIdsByProductCode: falsy input, happy path with data, empty data, null data, DB errorSiteCollection—allByEnrollmentProductCode: falsy input, empty site IDs (early return), default options, custom options forwarded tobatchGetByKeys🤖 Generated with Claude Code