Skip to content

Commit

Permalink
chore: Write GSI index partition key for meta documents (#3146)
Browse files Browse the repository at this point in the history
  • Loading branch information
khvn26 authored Dec 12, 2023
1 parent 352d6cc commit 76cc152
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/tests/unit/util/mappers/test_unit_mappers_dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ def test_map_environment_to_environment_v2_document__call_expected(
assert result == {
"document_key": ENVIRONMENTS_V2_ENVIRONMENT_META_DOCUMENT_KEY,
"environment_id": str(environment.id),
"environment_api_key": expected_api_key,
"allow_client_traits": True,
"amplitude_config": None,
"api_key": expected_api_key,
"dynatrace_config": None,
"feature_states": [
{
Expand Down
5 changes: 4 additions & 1 deletion api/util/mappers/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ def map_environment_to_environment_document(
def map_environment_to_environment_v2_document(
environment: "Environment",
) -> Document:
environment_document = map_environment_to_environment_document(environment)
environment_api_key = environment_document.pop("api_key")
return {
**map_environment_to_environment_document(environment),
**environment_document,
"document_key": ENVIRONMENTS_V2_ENVIRONMENT_META_DOCUMENT_KEY,
"environment_api_key": environment_api_key,
"environment_id": str(environment.id),
}

Expand Down

3 comments on commit 76cc152

@vercel
Copy link

@vercel vercel bot commented on 76cc152 Dec 12, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

docs – ./docs

docs-flagsmith.vercel.app
docs-git-main-flagsmith.vercel.app
docs.bullet-train.io
docs.flagsmith.com

@vercel
Copy link

@vercel vercel bot commented on 76cc152 Dec 12, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 76cc152 Dec 12, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.