@@ -22,9 +22,6 @@ macro_rules! uuid_id {
|
||||
uuid_id!(MovieId);
|
||||
|
||||
impl MovieId {
|
||||
/// Derives a stable, deterministic UUID from an external metadata ID (e.g. `tmdb:12345`).
|
||||
/// All instances that know a movie by the same external ID will produce the same MovieId,
|
||||
/// enabling remote and local reviews to be linked to the same movie record.
|
||||
pub fn from_external(external_id: &crate::value_objects::ExternalMetadataId) -> Self {
|
||||
Self(Uuid::new_v5(
|
||||
&Uuid::NAMESPACE_URL,
|
||||
@@ -45,8 +42,6 @@ uuid_id!(GoalId);
|
||||
uuid_id!(PersonId);
|
||||
|
||||
impl PersonId {
|
||||
/// Deterministic UUIDv5 from an external person ID string.
|
||||
/// "tmdb:12345" always maps to the same PersonId.
|
||||
pub fn from_external(external_id: &crate::models::person::ExternalPersonId) -> Self {
|
||||
Self(Uuid::new_v5(
|
||||
&Uuid::NAMESPACE_URL,
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
use super::{SocialIdentity, UserId};
|
||||
|
||||
/// This instance's own identity on the network. Owns every URL and handle
|
||||
/// derivation that used to be spelled with a bare `base_url: &str`.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct InstanceIdentity {
|
||||
base_url: String,
|
||||
}
|
||||
|
||||
impl InstanceIdentity {
|
||||
/// Normalizes away a trailing slash so every derived URL has exactly one.
|
||||
pub fn new(base_url: impl Into<String>) -> Self {
|
||||
Self {
|
||||
base_url: base_url.into().trim_end_matches('/').to_string(),
|
||||
@@ -19,7 +16,6 @@ impl InstanceIdentity {
|
||||
&self.base_url
|
||||
}
|
||||
|
||||
/// Host and port, as it appears in a fediverse handle.
|
||||
pub fn host(&self) -> &str {
|
||||
self.base_url
|
||||
.split("://")
|
||||
@@ -47,7 +43,6 @@ impl InstanceIdentity {
|
||||
}
|
||||
}
|
||||
|
||||
/// Inverse of `actor_url_of`: decides whether an actor URL is ours.
|
||||
pub fn identify(&self, actor_url: &str) -> SocialIdentity {
|
||||
let prefix = format!("{}/users/", self.base_url);
|
||||
if let Some(uuid_str) = actor_url.strip_prefix(&prefix)
|
||||
|
||||
@@ -37,8 +37,6 @@ pub struct SocialActor {
|
||||
pub avatar_url: Option<String>,
|
||||
}
|
||||
|
||||
/// Both directions of the follow edge between a viewer and a target.
|
||||
/// `None` means no edge at all; `Some(Pending)` means requested but not accepted.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
|
||||
pub struct FollowRelation {
|
||||
pub following: Option<FollowStatus>,
|
||||
|
||||
@@ -25,8 +25,6 @@ impl Username {
|
||||
const MIN_LENGTH: usize = 2;
|
||||
const MAX_LENGTH: usize = 30;
|
||||
|
||||
/// Accepts 2–30 chars: lowercase letters, digits, underscores, hyphens.
|
||||
/// Lowercases input automatically.
|
||||
pub fn new(raw: String) -> Result<Self, DomainError> {
|
||||
let s = raw.trim().to_lowercase();
|
||||
if s.len() < Self::MIN_LENGTH || s.len() > Self::MAX_LENGTH {
|
||||
|
||||
Reference in New Issue
Block a user