Skip to content

Commit 7a429b6

Browse files
committed
Fix graphql mutation
1 parent c0f2a45 commit 7a429b6

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ __pycache__/
99

1010
# Distribution / packaging
1111
.Python
12-
.idea
1312
.pytest_cache/
1413
env/
1514
build/
@@ -102,6 +101,8 @@ ENV/
102101

103102
# IDE
104103
.vscode/
104+
.idea
105+
.gitpod.yml
105106

106107
# Tentacles manager temporary files
107108
octobot/creator_temp/

octobot/community/authentication.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,9 @@ async def _load_device_if_selected(self):
240240
await self.load_user_devices()
241241
if len(self.user_account.get_all_user_devices_raw_data()) == 0:
242242
await self.select_device(
243-
await self.create_new_device()
243+
self.user_account.get_device_id(
244+
await self.create_new_device()
245+
)
244246
)
245247
# more than one possible device, can't auto-select one
246248

@@ -257,7 +259,7 @@ async def on_new_device_select(self):
257259
await self._update_feed_device_uuid()
258260

259261
async def _fetch_devices(self):
260-
query, variables = graphql_requests.select_devices(self.user_account.gql_user_id)
262+
query, variables = graphql_requests.select_devices()
261263
return await self.async_graphql_query(query, "devices", variables=variables, expected_code=200)
262264

263265
async def fetch_device(self, device_id):

octobot/community/graphql_requests.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
def create_new_device_query() -> (str, dict):
1919
return """
2020
mutation CreateDevice {
21-
createDevice
21+
createDevice {
22+
_id
23+
name
24+
user_id
25+
uuid
26+
}
2227
}
2328
""", {}
2429

@@ -35,13 +40,13 @@ def select_device(device_id) -> (str, dict):
3540
""", {"_id": device_id}
3641

3742

38-
def select_devices(user_id) -> (str, dict):
43+
def select_devices() -> (str, dict):
3944
return """
40-
query SelectDevices($user_id: ObjectId) {
41-
devices(query: {user_id: $user_id}) {
45+
query SelectDevices {
46+
devices {
4247
_id
4348
uuid
4449
name
4550
}
4651
}
47-
""", {"user_id": user_id}
52+
""", {}

0 commit comments

Comments
 (0)