Skip to content

Commit

Permalink
accommodate for string environment_id column
Browse files Browse the repository at this point in the history
  • Loading branch information
khvn26 committed Dec 9, 2023
1 parent 48f9289 commit 9bb5473
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def flagsmith_environments_v2_table(dynamodb) -> Table:
},
],
AttributeDefinitions=[
{"AttributeName": "environment_id", "AttributeType": "N"},
{"AttributeName": "environment_id", "AttributeType": "S"},
{"AttributeName": "document_key", "AttributeType": "S"},
],
BillingMode="PAY_PER_REQUEST",
Expand Down
2 changes: 1 addition & 1 deletion api/environments/dynamodb/dynamodb_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def get_identity_overrides_by_feature_id(
try:
response = self._table.query(
KeyConditionExpression=Key(ENVIRONMENTS_V2_PARTITION_KEY).eq(
environment_id,
str(environment_id),
)
& Key(ENVIRONMENTS_V2_SORT_KEY).begins_with(
get_environments_v2_identity_override_document_key(
Expand Down
2 changes: 1 addition & 1 deletion api/environments/dynamodb/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _save(self):


class IdentityOverrideV2(BaseModel):
environment_id: int
environment_id: str
document_key: str
environment_api_key: str
feature_state: FeatureStateModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_environment_v2_wrapper__get_identity_overrides__return_expected(
identity_uuid = str(uuid.uuid4())
identifier = "identity1"
override_document = {
"environment_id": environment.id,
"environment_id": str(environment.id),
"document_key": f"identity_override:{feature.id}:{identity_uuid}",
"environment_api_key": environment.api_key,
"identifier": identifier,
Expand Down Expand Up @@ -67,7 +67,7 @@ def test_environment_v2_wrapper__update_identity_overrides__put_expected(
identity_uuid = str(uuid.uuid4())
override_document = IdentityOverrideV2.parse_obj(
{
"environment_id": environment.id,
"environment_id": str(environment.id),
"document_key": f"identity_override:{feature.id}:{identity_uuid}",
"environment_api_key": environment.api_key,
"feature_state": map_feature_state_to_engine(feature_state),
Expand Down Expand Up @@ -105,7 +105,7 @@ def test_environment_v2_wrapper__update_identity_overrides__delete_expected(
override_document_data = map_identity_override_to_identity_override_document(
IdentityOverrideV2.parse_obj(
{
"environment_id": environment.id,
"environment_id": str(environment.id),
"document_key": f"identity_override:{feature.id}:{identity_uuid}",
"environment_api_key": environment.api_key,
"feature_state": map_feature_state_to_engine(feature_state),
Expand Down
2 changes: 1 addition & 1 deletion api/util/mappers/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def map_environment_to_environment_v2_document(
return {
**map_environment_to_environment_document(environment),
"document_key": "META",
"environment_id": _decimal_encoder(environment.id),
"environment_id": str(environment.id),
}


Expand Down

0 comments on commit 9bb5473

Please sign in to comment.