feat(data-access): add allByEnrollmentProductCode to SiteCollection#1455
Open
jindaliiita wants to merge 1 commit intomainfrom
Open
feat(data-access): add allByEnrollmentProductCode to SiteCollection#1455jindaliiita wants to merge 1 commit intomainfrom
jindaliiita wants to merge 1 commit 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>
Contributor
|
Free trials dont have entitlement info. |
Contributor
Author
I am able to see it for site ID
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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