Moved data registry to separate module.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m25s

This commit is contained in:
2026-01-05 09:59:56 -05:00
parent 9e88f84166
commit 8b95fbd458
5 changed files with 446 additions and 1441 deletions

View File

@@ -1,8 +1,4 @@
use crate::{
data_director::{Include, Path},
message::Route,
mtterror::MTTError,
};
use crate::mtterror::MTTError;
use isolang::Language;
use std::collections::HashMap;
use uuid::Uuid;
@@ -142,30 +138,6 @@ impl Names {
NameType::None => Ok(Uuid::nil()),
}
}
pub fn path_to_route(&self, path: &Path) -> Result<Route, MTTError> {
let doc_id = match &path.doc {
Include::Just(id_info) => match id_info {
NameType::ID(id) => {
if self.ids.contains_key(&id) {
Include::Just(id.clone())
} else {
return Err(MTTError::NameInvalidID(id.clone()));
}
}
NameType::Name(name) => {
let id = match self.get_id(name) {
Ok(data) => data,
Err(err) => return Err(err),
};
Include::Just(id.clone())
}
NameType::None => Include::Just(Uuid::nil()),
},
Include::All => Include::All,
};
Ok(Route::new(path.msg_id.clone(), doc_id, path.action.clone()))
}
}
#[cfg(test)]