Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add API endpoint to retrieve secured Algolia API key for an EnterpriseCustomer #1039

Merged
merged 3 commits into from
Mar 3, 2025

Conversation

adamstankiewicz
Copy link
Member

@adamstankiewicz adamstankiewicz commented Feb 28, 2025

Ticket: ENT-10079

Adds a new API GET /api/v1/enterprise-customer/<enterprise_uuid>/secured-algolia-api-key/ to return the following response structure:

{
  "algolia": {
    "secured_api_key": "...",
    "valid_until": "2025-02-28T12:00:00Z"
  },
  "catalog_uuids_to_catalog_query_uuids": {
    "catalog_uuid_1": "catalog_query_uuid_1",
    "catalog_uuid_2": "catalog_query_uuid_2"
  }
}

When using this secured Algolia API key to filter Algolia search results for all content available to an enterprise customer, no additional client-side filters are needed to be passed as the generated secured Algolia API key itself baked in filtering search results by any CatalogQuery associated with the customers' EnterpriseCatalog records.

By default, this secured Algolia API key is valid for 1 hour, though it is configurable via the Django setting SECURED_ALGOLIA_API_KEY_EXPIRATION. The expiration is returned as an ISO timestamp.

Also included in this API response is a mapping of EnterpriseCatalog uuids to their associated CatalogQuery uuids. These mappings would be used by frontends when further filtering down all content available to the enterprise customer to a specific catalog, i.e.:

  • Determine enterprise catalog UUID associated with a subsidy (e.g., subscription license).
  • Find catalog query UUID associated with the above enterprise catalog UUID (discerned through these mappings).
  • Add additional filter on the frontend for the found catalog query UUID.

image

Post-review

  • Squash commits into discrete sets of changes
  • Ensure that once the changes have been deployed to stage, prod is manually deployed

@adamstankiewicz adamstankiewicz force-pushed the ags/ent-10079-2 branch 3 times, most recently from 6084c69 to 3513537 Compare February 28, 2025 20:48
Copy link
Contributor

@iloveagent57 iloveagent57 left a comment

Choose a reason for hiding this comment

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

This is great, couple of minor suggestions!

@adamstankiewicz adamstankiewicz merged commit 579c177 into master Mar 3, 2025
5 of 6 checks passed
@adamstankiewicz adamstankiewicz deleted the ags/ent-10079-2 branch March 3, 2025 16:57
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