fix & chore: handle hostname/URL cleaning within trait implementation

SUMMARY
    Renamed function parameters from "hostname" to "url" wherever a
    url::Url is received

    db_core::get_hostname is renamed to db_core::clean_url, better
    describing its new implementation

    forge_core::get_hostname is renamed to forge_core::get_url to better
    describe its new implementation

URL PROCESSING METHODS

    federate/federate-core
	Parses URL and returns only the hostname

    db/db-core
	Parses URL, cleans it by removing path and query parameters and
	returns the end result
This commit is contained in:
Aravinth Manivannan 2022-07-14 23:47:37 +05:30
parent fe8bd2fb26
commit 9a3425eabe
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 1 additions and 2 deletions

View file

@ -210,7 +210,7 @@ pub trait SCDatabase: std::marker::Send + std::marker::Sync + CloneSPDatabase {
/// get user data
async fn get_user(&self, username: &str, url: &Url) -> DBResult<User>;
/// check if an user exists. When url of a forge instace is provided, username search is
/// check if an user exists. When url of a forge instance is provided, username search is
/// done only on that forge
async fn user_exists(&self, username: &str, url: Option<&Url>) -> DBResult<bool>;

View file

@ -161,7 +161,6 @@ impl Federate for PccFederate {
Ok(false)
}
}
/// create user instance
async fn create_user(&self, f: &AddUser<'_>) -> Result<(), Self::Error> {
let path = self.get_user_path(f.username, &f.url, true).await?;