Skip to content

Commit b7f7306

Browse files
tpellissierclaude
andcommitted
Use shared OData type constants from common.constants instead of local duplicates
Import ODATA_TYPE_ONE_TO_MANY_RELATIONSHIP and ODATA_TYPE_MANY_TO_MANY_RELATIONSHIP from common.constants to maintain consistency with the rest of the codebase. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d3ab4cf commit b7f7306

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/PowerPlatform/Dataverse/models/relationship_info.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
from dataclasses import dataclass
99
from typing import Any, Dict, Optional
1010

11-
__all__ = ["RelationshipInfo"]
11+
from PowerPlatform.Dataverse.common.constants import (
12+
ODATA_TYPE_ONE_TO_MANY_RELATIONSHIP,
13+
ODATA_TYPE_MANY_TO_MANY_RELATIONSHIP,
14+
)
1215

13-
_OTM_ODATA_TYPE = "Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata"
14-
_MTM_ODATA_TYPE = "Microsoft.Dynamics.CRM.ManyToManyRelationshipMetadata"
16+
__all__ = ["RelationshipInfo"]
1517

1618

1719
@dataclass
@@ -137,7 +139,7 @@ def from_api_response(cls, response_data: Dict[str, Any]) -> RelationshipInfo:
137139
rel_id = response_data.get("MetadataId")
138140
schema_name = response_data.get("SchemaName", "")
139141

140-
if _OTM_ODATA_TYPE in odata_type:
142+
if ODATA_TYPE_ONE_TO_MANY_RELATIONSHIP in odata_type:
141143
return cls(
142144
relationship_id=rel_id,
143145
relationship_schema_name=schema_name,
@@ -147,7 +149,7 @@ def from_api_response(cls, response_data: Dict[str, Any]) -> RelationshipInfo:
147149
lookup_schema_name=response_data.get("ReferencingEntityNavigationPropertyName"),
148150
)
149151

150-
if _MTM_ODATA_TYPE in odata_type:
152+
if ODATA_TYPE_MANY_TO_MANY_RELATIONSHIP in odata_type:
151153
return cls(
152154
relationship_id=rel_id,
153155
relationship_schema_name=schema_name,

0 commit comments

Comments
 (0)