summaryrefslogtreecommitdiff
path: root/src/repository/models.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/repository/models.rs')
-rw-r--r--src/repository/models.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/repository/models.rs b/src/repository/models.rs
index 54a93d7..c480cbe 100644
--- a/src/repository/models.rs
+++ b/src/repository/models.rs
@@ -9,6 +9,7 @@ use uuid::Uuid;
#[derive(Serialize, Deserialize, PostgresMapper)]
#[pg_mapper(table = "repository")]
+/// Repository model
pub struct Repository {
pub id: Uuid,
pub url: String,
@@ -18,6 +19,9 @@ pub struct Repository {
}
impl Repository {
+ /// Find all repositories inside the database.
+ /// Make a select query and order the repositories by descrescent updated
+ /// datetime
pub async fn find_all(pool: Pool) -> Result<Vec<Repository>, AppError> {
let client = get_client(pool.clone()).await.unwrap();
let statement = client
@@ -34,6 +38,7 @@ impl Repository {
Ok(repos)
}
+ /// Find a repository with an `id` equals to an Uuid element
pub async fn find(pool: Pool, id: &Uuid) -> Result<Repository, AppError> {
let client = get_client(pool.clone()).await.unwrap();
let statement = client