Split the Dashboard from All Tasks. (#10)
Reviewed-on: #10 Co-authored-by: Drew Galbraith <drew@tiramisu.one> Co-committed-by: Drew Galbraith <drew@tiramisu.one>
This commit is contained in:
parent
b0916990fb
commit
8e6ac03f70
10 changed files with 572 additions and 23 deletions
|
|
@ -94,6 +94,15 @@ impl TaskModel {
|
|||
.await?;
|
||||
Ok(tasks)
|
||||
}
|
||||
|
||||
pub async fn list_by_status(pool: &SqlitePool, status: TaskStatus) -> Result<Vec<TaskModel>> {
|
||||
let tasks =
|
||||
sqlx::query_as("SELECT * FROM tasks t WHERE t.status = $1 ORDER BY created_at DESC")
|
||||
.bind(status)
|
||||
.fetch_all(pool)
|
||||
.await?;
|
||||
Ok(tasks)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue