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 <timo@koesters.xyz>
Co-authored-by: Guillem Nieto <gnieto.talo@gmail.com>
This commit is contained in:
gnieto 2020-06-03 13:41:30 +02:00 committed by Timo Kösters
parent 720d48bd67
commit ed9b544ace
4 changed files with 190 additions and 26 deletions

View file

@ -81,6 +81,11 @@ fn setup_rocket() -> rocket::Rocket {
client_server::create_content_route,
client_server::get_content_route,
client_server::get_content_thumbnail_route,
client_server::get_devices_route,
client_server::get_device_route,
client_server::update_device_route,
client_server::delete_device_route,
client_server::delete_devices_route,
client_server::options_route,
server_server::well_known_server,
server_server::get_server_version,