style: fix the rustfmt linted files
Some checks failed
actionlint check / actionlint check (pull_request) Successful in 5s
checkov check / checkov check (pull_request) Successful in 52s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 4s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 2s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 5s
GitLeaks check / GitLeaks check (pull_request) Successful in 6s
hadolint check / hadolint check (pull_request) Successful in 7s
htmlhint check / htmlhint check (pull_request) Successful in 9s
markdownlint check / markdownlint check (pull_request) Successful in 9s
Prettier check / Prettier check (pull_request) Successful in 10s
Rust check / Rust check (pull_request) Failing after 6m20s
ShellCheck check / ShellCheck check (pull_request) Successful in 12s
Stylelint check / Stylelint check (pull_request) Successful in 11s
yamllint check / yamllint check (pull_request) Successful in 13s
Some checks failed
actionlint check / actionlint check (pull_request) Successful in 5s
checkov check / checkov check (pull_request) Successful in 52s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 4s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 2s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 5s
GitLeaks check / GitLeaks check (pull_request) Successful in 6s
hadolint check / hadolint check (pull_request) Successful in 7s
htmlhint check / htmlhint check (pull_request) Successful in 9s
markdownlint check / markdownlint check (pull_request) Successful in 9s
Prettier check / Prettier check (pull_request) Successful in 10s
Rust check / Rust check (pull_request) Failing after 6m20s
ShellCheck check / ShellCheck check (pull_request) Successful in 12s
Stylelint check / Stylelint check (pull_request) Successful in 11s
yamllint check / yamllint check (pull_request) Successful in 13s
This commit is contained in:
@ -1,14 +1,16 @@
|
||||
use dioxus::prelude::ServerFnError;
|
||||
use dioxus_query::prelude::{use_get_query, QueryResult, UseQuery};
|
||||
use crate::models::category::Category;
|
||||
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
||||
use crate::server::tasks::{get_tasks_in_category, get_tasks_with_subtasks_in_category};
|
||||
use dioxus::prelude::ServerFnError;
|
||||
use dioxus_query::prelude::{use_get_query, QueryResult, UseQuery};
|
||||
|
||||
|
||||
|
||||
pub(crate) fn use_tasks_in_category_query(category: Category)
|
||||
-> UseQuery<QueryValue, QueryErrors, QueryKey> {
|
||||
use_get_query([QueryKey::TasksInCategory(category), QueryKey::Tasks], fetch_tasks_in_category)
|
||||
pub(crate) fn use_tasks_in_category_query(
|
||||
category: Category,
|
||||
) -> UseQuery<QueryValue, QueryErrors, QueryKey> {
|
||||
use_get_query(
|
||||
[QueryKey::TasksInCategory(category), QueryKey::Tasks],
|
||||
fetch_tasks_in_category,
|
||||
)
|
||||
}
|
||||
|
||||
async fn fetch_tasks_in_category(keys: Vec<QueryKey>) -> QueryResult<QueryValue, QueryErrors> {
|
||||
@ -16,34 +18,37 @@ async fn fetch_tasks_in_category(keys: Vec<QueryKey>) -> QueryResult<QueryValue,
|
||||
match get_tasks_in_category(category.clone()).await {
|
||||
Ok(tasks) => Ok(QueryValue::Tasks(tasks)),
|
||||
Err(ServerFnError::WrappedServerError(errors)) => Err(QueryErrors::Error(errors)),
|
||||
Err(error) => panic!("Unexpected error: {:?}", error)
|
||||
}.into()
|
||||
Err(error) => panic!("Unexpected error: {:?}", error),
|
||||
}
|
||||
.into()
|
||||
} else {
|
||||
panic!("Unexpected query keys: {:?}", keys);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn use_tasks_with_subtasks_in_category_query(category: Category)
|
||||
-> UseQuery<QueryValue, QueryErrors, QueryKey> {
|
||||
pub(crate) fn use_tasks_with_subtasks_in_category_query(
|
||||
category: Category,
|
||||
) -> UseQuery<QueryValue, QueryErrors, QueryKey> {
|
||||
use_get_query(
|
||||
[
|
||||
QueryKey::TasksWithSubtasksInCategory(
|
||||
category.clone()),
|
||||
QueryKey::TasksWithSubtasksInCategory(category.clone()),
|
||||
QueryKey::TasksInCategory(category),
|
||||
QueryKey::Tasks
|
||||
QueryKey::Tasks,
|
||||
],
|
||||
fetch_tasks_with_subtasks_in_category
|
||||
fetch_tasks_with_subtasks_in_category,
|
||||
)
|
||||
}
|
||||
|
||||
async fn fetch_tasks_with_subtasks_in_category(keys: Vec<QueryKey>)
|
||||
-> QueryResult<QueryValue, QueryErrors> {
|
||||
async fn fetch_tasks_with_subtasks_in_category(
|
||||
keys: Vec<QueryKey>,
|
||||
) -> QueryResult<QueryValue, QueryErrors> {
|
||||
if let Some(QueryKey::TasksWithSubtasksInCategory(category)) = keys.first() {
|
||||
match get_tasks_with_subtasks_in_category(category.clone()).await {
|
||||
Ok(tasks) => Ok(QueryValue::TasksWithSubtasks(tasks)),
|
||||
Err(ServerFnError::WrappedServerError(errors)) => Err(QueryErrors::Error(errors)),
|
||||
Err(error) => panic!("Unexpected error: {:?}", error)
|
||||
}.into()
|
||||
Err(error) => panic!("Unexpected error: {:?}", error),
|
||||
}
|
||||
.into()
|
||||
} else {
|
||||
panic!("Unexpected query keys: {:?}", keys);
|
||||
}
|
||||
|
Reference in New Issue
Block a user