sheepd/src/server_core/model.rs
JMARyA 125d50530d
mqtt connections
almost working, need encryption
2025-04-28 23:33:11 +02:00

24 lines
567 B
Rust

use crate::api;
use crate::generate_token;
use owl::prelude::*;
#[model]
pub struct Machine {
pub id: Id,
pub hostname: String,
pub token: String,
pub identity: (String, String),
pub next_token: Option<String>,
}
impl Machine {
pub fn from_join_param(join: api::JoinParams) -> Self {
Self {
id: Id::String(join.machine_id.trim().to_string()),
hostname: join.hostname.trim().to_string(),
identity: join.identity,
token: generate_token(),
next_token: None,
}
}
}