Files
spacedrive/core/src/node/mod.rs
Oscar Beaumont 3804f034f1 Move Rust backend to rspc (#345)
* move Rust backend to rspc

* move server to Axum + remove parts of old bridge

* move frontend over to @rspc/client

* move core to rspc + update deps

* fix Typescript errors + upgrade deps

* document invalidate_query! macro

* general cleanup + upgrade to PCR 0.6.0

* prisma error handling

* upgrade to rspc 0.0.4

* update vite-plugin-ssr

* fix typescript

* fix builds

* put landing page app name back

* hardcode ffmpeg version on Windows

* rename 'command' to 'mutation' to line up with react-query terminology

* upgrade rspc to v0.0.5 + fix types

* use shared ffmpeg binaries

* general Typescript cleanup

* fix clippy workflow failing due to tauri proc-macro

Co-authored-by: Brendan Allan <brendonovich@outlook.com>
2022-08-03 08:36:03 -07:00

47 lines
958 B
Rust

use chrono::{DateTime, Utc};
use int_enum::IntEnum;
use rspc::Type;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
mod config;
use crate::prisma::node;
pub use config::*;
#[derive(Debug, Clone, Serialize, Deserialize, Type)]
pub struct LibraryNode {
pub uuid: Uuid,
pub name: String,
pub platform: Platform,
pub last_seen: DateTime<Utc>,
}
impl From<node::Data> for LibraryNode {
fn from(data: node::Data) -> Self {
Self {
uuid: Uuid::from_slice(&data.pub_id).unwrap(),
name: data.name,
platform: IntEnum::from_int(data.platform).unwrap(),
last_seen: data.last_seen.into(),
}
}
}
impl From<Box<node::Data>> for LibraryNode {
fn from(data: Box<node::Data>) -> Self {
Self::from(*data)
}
}
#[allow(clippy::upper_case_acronyms)]
#[repr(i32)]
#[derive(Debug, Clone, Copy, Serialize, Deserialize, Type, Eq, PartialEq, IntEnum)]
pub enum Platform {
Unknown = 0,
Windows = 1,
MacOS = 2,
Linux = 3,
IOS = 4,
Android = 5,
}