Skip to content

Commit cc71c31

Browse files
kjlippoldKen Lippold
andauthored
Fixed save datastream metadata issue (#19)
Co-authored-by: Ken Lippold <klippold@Kens-MacBook-Pro-2.local>
1 parent c282317 commit cc71c31

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/hydroserverpy/api/services/iam/workspace.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ def add_collaborator(
8787
)
8888

8989
def edit_collaborator_role(
90-
self, uid: Union[UUID, str], email: EmailStr, role: Union["Role", UUID, str]
90+
self, uid: Union[UUID, str], email: EmailStr, role: Union["Role", UUID, str], role_id: UUID
9191
) -> "Collaborator":
9292
"""Edit the role of a collaborator in a workspace."""
9393

9494
path = f"/{self.client.base_route}/{self.model.get_route()}/{str(uid)}/collaborators"
9595
headers = {"Content-type": "application/json"}
9696
body = {
9797
"email": email,
98-
"roleId": normalize_uuid(role)
98+
"roleId": normalize_uuid(role if role is not ... else role_id)
9999
}
100100

101101
response = self.client.request(
@@ -165,6 +165,7 @@ def update_api_key(
165165
uid: Union[UUID, str],
166166
api_key_id: Union[UUID, str],
167167
role: Union["Role", UUID, str] = ...,
168+
role_id: UUID = ...,
168169
name: str = ...,
169170
description: Optional[str] = ...,
170171
is_active: bool = ...,
@@ -175,7 +176,7 @@ def update_api_key(
175176
path = f"/{self.client.base_route}/{self.model.get_route()}/{str(uid)}/api-keys/{api_key_id}"
176177
headers = {"Content-type": "application/json"}
177178
body = {
178-
"roleId": normalize_uuid(role),
179+
"roleId": normalize_uuid(role if role is not ... else role_id),
179180
"name": name,
180181
"description": description,
181182
"isActive": is_active,

src/hydroserverpy/api/services/sta/datastream.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,15 @@ def update(
155155
name: str = ...,
156156
description: str = ...,
157157
thing: Union["Thing", UUID, str] = ...,
158+
thing_id: UUID = ...,
158159
sensor: Union["Sensor", UUID, str] = ...,
160+
sensor_id: UUID = ...,
159161
observed_property: Union["ObservedProperty", UUID, str] = ...,
162+
observed_property_id: UUID = ...,
160163
processing_level: Union["ProcessingLevel", UUID, str] = ...,
164+
processing_level_id: UUID = ...,
161165
unit: Union["Unit", UUID, str] = ...,
166+
unit_id: UUID = ...,
162167
observation_type: str = ...,
163168
result_type: str = ...,
164169
sampled_medium: str = ...,
@@ -186,11 +191,15 @@ def update(
186191
body = {
187192
"name": name,
188193
"description": description,
189-
"thingId": normalize_uuid(thing),
190-
"sensorId": normalize_uuid(sensor),
191-
"observedPropertyId": normalize_uuid(observed_property),
192-
"processingLevelId": normalize_uuid(processing_level),
193-
"unitId": normalize_uuid(unit),
194+
"thingId": normalize_uuid(thing if thing is not ... else thing_id),
195+
"sensorId": normalize_uuid(sensor if sensor is not ... else sensor_id),
196+
"observedPropertyId": normalize_uuid(
197+
observed_property if observed_property is not ... else observed_property_id
198+
),
199+
"processingLevelId": normalize_uuid(
200+
processing_level if processing_level is not ... else processing_level_id
201+
),
202+
"unitId": normalize_uuid(unit if unit is not ... else unit_id),
194203
"observationType": observation_type,
195204
"resultType": result_type,
196205
"sampledMedium": sampled_medium,

0 commit comments

Comments
 (0)