pinakes-core: update remaining modules and tests

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I9e0ff5ea33a5cf697473423e88f167ce6a6a6964
This commit is contained in:
raf 2026-03-08 00:42:29 +03:00
commit 3d9f8933d2
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
44 changed files with 1207 additions and 578 deletions

View file

@ -17,6 +17,7 @@ use crate::{
pub struct DeviceId(pub Uuid);
impl DeviceId {
#[must_use]
pub fn new() -> Self {
Self(Uuid::now_v7())
}
@ -70,7 +71,7 @@ impl std::str::FromStr for DeviceType {
"tablet" => Ok(Self::Tablet),
"server" => Ok(Self::Server),
"other" => Ok(Self::Other),
_ => Err(format!("unknown device type: {}", s)),
_ => Err(format!("unknown device type: {s}")),
}
}
}
@ -93,6 +94,7 @@ pub struct SyncDevice {
}
impl SyncDevice {
#[must_use]
pub fn new(
user_id: UserId,
name: String,
@ -150,7 +152,7 @@ impl std::str::FromStr for SyncChangeType {
"deleted" => Ok(Self::Deleted),
"moved" => Ok(Self::Moved),
"metadata_updated" => Ok(Self::MetadataUpdated),
_ => Err(format!("unknown sync change type: {}", s)),
_ => Err(format!("unknown sync change type: {s}")),
}
}
}
@ -171,6 +173,7 @@ pub struct SyncLogEntry {
}
impl SyncLogEntry {
#[must_use]
pub fn new(
change_type: SyncChangeType,
path: String,
@ -225,7 +228,7 @@ impl std::str::FromStr for FileSyncStatus {
"pending_download" => Ok(Self::PendingDownload),
"conflict" => Ok(Self::Conflict),
"deleted" => Ok(Self::Deleted),
_ => Err(format!("unknown file sync status: {}", s)),
_ => Err(format!("unknown file sync status: {s}")),
}
}
}
@ -260,6 +263,7 @@ pub struct SyncConflict {
}
impl SyncConflict {
#[must_use]
pub fn new(
device_id: DeviceId,
path: String,
@ -319,7 +323,7 @@ impl std::str::FromStr for UploadStatus {
"failed" => Ok(Self::Failed),
"expired" => Ok(Self::Expired),
"cancelled" => Ok(Self::Cancelled),
_ => Err(format!("unknown upload status: {}", s)),
_ => Err(format!("unknown upload status: {s}")),
}
}
}
@ -341,6 +345,7 @@ pub struct UploadSession {
}
impl UploadSession {
#[must_use]
pub fn new(
device_id: DeviceId,
target_path: String,