From 0883c446595a53a53eca46b3b0e08f7878ddbb7a Mon Sep 17 00:00:00 2001 From: gnieto Date: Wed, 3 Jun 2020 13:41:30 +0200 Subject: [PATCH] Implement devices API (#20) small improvements Cargo fmt Simplify insert and update methods Review feedback Remove has_device method calls Load all devices with a single db call Remove device as in logout Put all metadata on the same tree Create userdevice key fucntion Implement devices API Implement all the devices endpoints. There's a couple of pending tasks: - Integrate the "logout" logic once it lands to master (this should remove the given device from the database). - Track and store last seen timestamp and IP. Co-authored-by: timokoesters Co-authored-by: Guillem Nieto --- src/database/users.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/database/users.rs b/src/database/users.rs index e216301a..3a437d35 100644 --- a/src/database/users.rs +++ b/src/database/users.rs @@ -430,7 +430,7 @@ impl Users { userdeviceid.push(0xff); userdeviceid.extend_from_slice(device_id.as_bytes()); - if self.userdeviceid_metadata.get(userdeviceid)?.is_none() { + if self.userdeviceid_metadata.get(&userdeviceid)?.is_none() { return Err(Error::BadRequest("device does not exist")); }