refactor(caesar): restructure the project to a monorepo
This commit is contained in:
parent
17ebd0261b
commit
b39e88107a
27 changed files with 195 additions and 142 deletions
61
caesar-core/src/relay/transfer.rs
Normal file
61
caesar-core/src/relay/transfer.rs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct TransferRequest {
|
||||
pub name: String,
|
||||
pub ip: String,
|
||||
pub local_room_id: String,
|
||||
pub relay_room_id: String,
|
||||
}
|
||||
impl TransferRequest {
|
||||
pub fn new(name: String, ip: String, local_room_id: String, relay_room_id: String) -> Self {
|
||||
Self {
|
||||
name,
|
||||
ip,
|
||||
local_room_id,
|
||||
relay_room_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct TransferResponse {
|
||||
pub name: String,
|
||||
pub ip: String,
|
||||
pub local_room_id: String,
|
||||
pub relay_room_id: String,
|
||||
}
|
||||
|
||||
impl TransferResponse {
|
||||
pub fn new(name: String, ip: String, local_room_id: String, relay_room_id: String) -> Self {
|
||||
Self {
|
||||
name,
|
||||
ip,
|
||||
local_room_id,
|
||||
relay_room_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_new() {
|
||||
let transfer = TransferResponse {
|
||||
name: "Test".to_string(),
|
||||
ip: "127.0.0.1".to_string(),
|
||||
local_room_id: "This_is_a_test_room_id".to_string(),
|
||||
relay_room_id: "This_is_a_test_room_id".to_string(),
|
||||
};
|
||||
assert_eq!(
|
||||
TransferResponse::new(
|
||||
"Test".to_string(),
|
||||
"127.0.0.1".to_string(),
|
||||
"This_is_a_test_room_id".to_string(),
|
||||
"This_is_a_test_room_id".to_string(),
|
||||
),
|
||||
transfer
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue