feat: search repositories
This commit is contained in:
parent
359c0133b8
commit
0e040e4875
2 changed files with 10 additions and 0 deletions
|
@ -217,6 +217,9 @@ pub trait SCDatabase: std::marker::Send + std::marker::Sync + CloneSPDatabase {
|
|||
|
||||
/// add new repository to database.
|
||||
async fn create_repository(&self, r: &AddRepository) -> DBResult<()>;
|
||||
|
||||
/// Search all repositories
|
||||
async fn search_repository(&self, query: &str) -> DBResult<Vec<Repository>>;
|
||||
}
|
||||
|
||||
/// Trait to clone SCDatabase
|
||||
|
|
|
@ -81,6 +81,13 @@ pub async fn adding_forge_works<'a, T: SCDatabase>(
|
|||
.repository_exists(add_repo_msg.name, add_repo_msg.owner, &add_repo_msg.url)
|
||||
.await
|
||||
.unwrap());
|
||||
|
||||
assert!(db.get_all_repositories(00, 1000).await.unwrap().len() >= 1);
|
||||
let repo_search = db.search_repository(add_repo_msg.name).await.unwrap();
|
||||
|
||||
assert!(!repo_search.is_empty());
|
||||
assert_eq!(repo_search.first().unwrap().url, add_repo_msg.url.as_str());
|
||||
|
||||
// delete repository
|
||||
db.delete_repository(add_repo_msg.owner, add_repo_msg.name, &add_repo_msg.url)
|
||||
.await
|
||||
|
|
Loading…
Reference in a new issue