40 lines
914 B
Rust
40 lines
914 B
Rust
// L'application peut avoir plusieurs sous servers
|
|
|
|
use std::hash::{Hash, Hasher};
|
|
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
use crate::store::models::Channel;
|
|
|
|
#[derive(Debug, Clone, sqlx::FromRow, Serialize, Deserialize)]
|
|
pub struct SubServer {
|
|
pub id: Uuid,
|
|
pub name: String,
|
|
pub password: String, // voir si on le hash, mais sera certainement pas nécessaire.
|
|
pub created_at: DateTime<Utc>,
|
|
}
|
|
|
|
impl SubServer {
|
|
pub fn new(name: String, password: String) -> Self {
|
|
Self {
|
|
id: Uuid::new_v4(),
|
|
name,
|
|
password,
|
|
created_at: Utc::now(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl PartialEq for SubServer {
|
|
fn eq(&self, other: &Self) -> bool {
|
|
self.id == other.id
|
|
}
|
|
}
|
|
|
|
impl Eq for SubServer {}
|
|
|
|
impl Hash for SubServer {
|
|
fn hash<H: Hasher>(&self, state: &mut H) {
|
|
self.id.hash(state);
|
|
}
|
|
} |