Compare commits
1 Commits
main
...
ed91853dcf
| Author | SHA1 | Date | |
|---|---|---|---|
|
ed91853dcf
|
2
.github/workflows/checkov-check.yaml
vendored
2
.github/workflows/checkov-check.yaml
vendored
@@ -22,7 +22,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.13.1"
|
python-version: "3.13.1"
|
||||||
- name: Rust toolchain installation
|
- name: Rust toolchain installation
|
||||||
uses: dtolnay/rust-toolchain@6691ebadcb18182cc1391d07c9f295f657c593cd
|
uses: dtolnay/rust-toolchain@0579bb9e1907e560c2f263f705f93655a44a07e5
|
||||||
- name: code checkout
|
- name: code checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||||
with:
|
with:
|
||||||
|
|||||||
8
.github/workflows/rust-check.yaml
vendored
8
.github/workflows/rust-check.yaml
vendored
@@ -21,20 +21,18 @@ jobs:
|
|||||||
run: >
|
run: >
|
||||||
apt-get update && apt-get install -y
|
apt-get update && apt-get install -y
|
||||||
libgtk-3-dev=3.24.33-1ubuntu2.2
|
libgtk-3-dev=3.24.33-1ubuntu2.2
|
||||||
libjavascriptcoregtk-4.1-dev=2.48.3-0ubuntu0.22.04.1
|
libjavascriptcoregtk-4.1-dev=2.46.4-0ubuntu0.22.04.1
|
||||||
libsoup-3.0-dev=3.0.7-0ubuntu1
|
libsoup-3.0-dev=3.0.7-0ubuntu1
|
||||||
libwebkit2gtk-4.1-dev=2.48.3-0ubuntu0.22.04.1
|
libwebkit2gtk-4.1-dev=2.46.4-0ubuntu0.22.04.1
|
||||||
libxdo-dev=1:3.20160805.1-4
|
libxdo-dev=1:3.20160805.1-4
|
||||||
- name: Rust toolchain installation
|
- name: Rust toolchain installation
|
||||||
uses: dtolnay/rust-toolchain@6691ebadcb18182cc1391d07c9f295f657c593cd
|
uses: dtolnay/rust-toolchain@0579bb9e1907e560c2f263f705f93655a44a07e5
|
||||||
with:
|
with:
|
||||||
components: clippy, rustfmt
|
components: clippy, rustfmt
|
||||||
- name: code checkout
|
- name: code checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: .env symlink creation
|
|
||||||
run: ln -s .env.example .env
|
|
||||||
- name: npm build
|
- name: npm build
|
||||||
run: npm install && npm run build
|
run: npm install && npm run build
|
||||||
- name: rustfmt check
|
- name: rustfmt check
|
||||||
|
|||||||
444
Cargo.lock
generated
444
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
28
Cargo.toml
28
Cargo.toml
@@ -2,29 +2,29 @@
|
|||||||
name = "todo-baggins"
|
name = "todo-baggins"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Matouš Volf <git@matousvolf.cz>"]
|
authors = ["Matouš Volf <git@matousvolf.cz>"]
|
||||||
edition = "2024"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = { version = "0.4.41", features = ["serde", "unstable-locales"] }
|
chrono = { version = "0.4.39", features = ["serde", "unstable-locales"] }
|
||||||
dioxus = { version = "0.6.3", features = ["fullstack", "router"] }
|
dioxus = { version = "0.6.1", features = ["fullstack", "router"] }
|
||||||
feruca = { version = "0.11.4" }
|
feruca = { version = "0.10.1" }
|
||||||
serde = { version = "1.0.219" }
|
serde = { version = "1.0.217" }
|
||||||
serde_json = { version = "1.0.142" }
|
serde_json = { version = "1.0.134" }
|
||||||
serde_with = { version = "3.14.0", features = ["chrono_0_4"] }
|
serde_with = { version = "3.12.0", features = ["chrono_0_4"] }
|
||||||
tracing = "0.1.41"
|
tracing = "0.1.41"
|
||||||
unic-langid-impl = { version = "0.9.6", features = ["serde"] }
|
unic-langid-impl = { version = "0.9.5", features = ["serde"] }
|
||||||
validator = { version = "0.20.0", features = ["derive"] }
|
validator = { version = "0.19.0", features = ["derive"] }
|
||||||
|
|
||||||
diesel = { version = "2.2.12", features = ["chrono", "postgres", "postgres_backend", "serde_json"], optional = true }
|
diesel = { version = "2.2.6", features = ["chrono", "postgres", "postgres_backend", "serde_json"], optional = true }
|
||||||
diesel_migrations = { version = "2.2.0", features = ["postgres"], optional = true }
|
diesel_migrations = { version = "2.2.0", features = ["postgres"], optional = true }
|
||||||
dotenvy = { version = "0.15.7", optional = true }
|
dotenvy = { version = "0.15.7", optional = true }
|
||||||
time = { version = "0.3.41", optional = true }
|
time = { version = "0.3.37", optional = true }
|
||||||
|
|
||||||
async-std = { version = "1.13.1", optional = true }
|
async-std = { version = "1.13.0", optional = true }
|
||||||
dioxus-i18n = { version = "0.4.3", optional = true }
|
dioxus-i18n = { version = "0.3.0", optional = true }
|
||||||
dioxus-query = { version = "0.6.1", optional = true }
|
dioxus-query = { version = "0.6.0", optional = true }
|
||||||
voca_rs = { version = "1.15.2", optional = true }
|
voca_rs = { version = "1.15.2", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
26
Dioxus.toml
26
Dioxus.toml
@@ -3,7 +3,14 @@
|
|||||||
# App (Project) Name
|
# App (Project) Name
|
||||||
name = "todo-baggins"
|
name = "todo-baggins"
|
||||||
|
|
||||||
# For font files to get referenced in CSS files by their original names, without the hash Dioxus appends.
|
# Dioxus App Default Platform
|
||||||
|
# web, desktop, fullstack
|
||||||
|
default_platform = "fullstack"
|
||||||
|
|
||||||
|
# `build` & `serve` dist path
|
||||||
|
out_dir = "dist"
|
||||||
|
|
||||||
|
# resource (assets) file folder
|
||||||
asset_dir = "assets"
|
asset_dir = "assets"
|
||||||
|
|
||||||
[web.app]
|
[web.app]
|
||||||
@@ -11,17 +18,10 @@ asset_dir = "assets"
|
|||||||
# HTML title tag content
|
# HTML title tag content
|
||||||
title = "Todo Baggins"
|
title = "Todo Baggins"
|
||||||
|
|
||||||
# include `assets` in web platform
|
[web.watcher]
|
||||||
[web.resource]
|
|
||||||
|
|
||||||
# Additional CSS style files
|
# when watcher trigger, regenerate the `index.html`
|
||||||
style = []
|
reload_html = true
|
||||||
|
|
||||||
# Additional JavaScript files
|
# which files or dirs will be watcher monitoring
|
||||||
script = []
|
watch_path = ["src", "assets"]
|
||||||
|
|
||||||
[web.resource.dev]
|
|
||||||
|
|
||||||
# Javascript code file
|
|
||||||
# serve: [dev-server] only
|
|
||||||
script = []
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"theme_color": "#27272a",
|
"theme_color": "#27272a",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/assets/images/icon.png",
|
"src": "/images/icon.png",
|
||||||
"sizes": "any",
|
"sizes": "any",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
FROM rust:1.88.0-bookworm@sha256:5771a3cc2081935c59ac52b92d49c9e164d4fed92c9f6420aa8cc50364aead6e
|
# 1.83.0-bookworm
|
||||||
|
FROM rust@sha256:a45bf1f5d9af0a23b26703b3500d70af1abff7f984a7abef5a104b42c02a292b
|
||||||
|
|
||||||
RUN cargo install dioxus-cli --version 0.6.3 \
|
RUN cargo install dioxus-cli diesel_cli
|
||||||
&& cargo install diesel_cli --version 2.2.7
|
|
||||||
|
|
||||||
COPY . /srv/app
|
COPY . /srv/app
|
||||||
WORKDIR /srv/app
|
WORKDIR /srv/app
|
||||||
@@ -13,4 +13,4 @@ HEALTHCHECK CMD curl --fail -H "Accept: text/html" http://localhost:8000 || exit
|
|||||||
|
|
||||||
USER 1000:1000
|
USER 1000:1000
|
||||||
|
|
||||||
CMD ["sleep", "infinity"]
|
CMD ["dx", "serve", "--addr", "0.0.0.0", "--port", "8000"]
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
FROM rust:1.88.0-bookworm@sha256:5771a3cc2081935c59ac52b92d49c9e164d4fed92c9f6420aa8cc50364aead6e AS builder
|
FROM rust@sha256:a45bf1f5d9af0a23b26703b3500d70af1abff7f984a7abef5a104b42c02a292b AS builder
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN cargo install dioxus-cli diesel_cli \
|
||||||
|
&& apt-get update && apt-get install -y --no-install-recommends \
|
||||||
nodejs=18.19.0+dfsg-6~deb12u2 \
|
nodejs=18.19.0+dfsg-6~deb12u2 \
|
||||||
npm=9.2.0~ds1-1 \
|
npm=9.2.0~ds1-1 \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
&& cargo install dioxus-cli --version 0.6.3 \
|
|
||||||
&& cargo install diesel_cli --version 2.2.7
|
|
||||||
|
|
||||||
COPY . /srv/app
|
COPY . /srv/app
|
||||||
WORKDIR /srv/app
|
WORKDIR /srv/app
|
||||||
@@ -15,10 +14,10 @@ RUN npm install \
|
|||||||
&& npm run build \
|
&& npm run build \
|
||||||
&& dx bundle
|
&& dx bundle
|
||||||
|
|
||||||
FROM debian:bookworm@sha256:b877a1a3fdf02469440f1768cf69c9771338a875b7add5e80c45b756c92ac20a AS runner
|
FROM debian@sha256:b877a1a3fdf02469440f1768cf69c9771338a875b7add5e80c45b756c92ac20a AS runner
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends libpq5=15.10-0+deb12u1 \
|
&& apt-get install -y --no-install-recommends libpq5=15.8-0+deb12u1 \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ const TAILWIND_CSS: Asset = asset!("/assets/styles/tailwind_output.css");
|
|||||||
const FONTS_CSS: Asset = asset!("/assets/styles/fonts.css");
|
const FONTS_CSS: Asset = asset!("/assets/styles/fonts.css");
|
||||||
const INPUT_NUMBER_ARROWS_CSS: Asset = asset!("/assets/styles/input_number_arrows.css");
|
const INPUT_NUMBER_ARROWS_CSS: Asset = asset!("/assets/styles/input_number_arrows.css");
|
||||||
const INPUT_RANGE_CSS: Asset = asset!("/assets/styles/input_range.css");
|
const INPUT_RANGE_CSS: Asset = asset!("/assets/styles/input_range.css");
|
||||||
const MANIFEST: Asset = asset!("/assets/manifest.json");
|
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub(crate) fn App() -> Element {
|
pub(crate) fn App() -> Element {
|
||||||
@@ -40,7 +39,6 @@ pub(crate) fn App() -> Element {
|
|||||||
document::Stylesheet { href: FONTS_CSS }
|
document::Stylesheet { href: FONTS_CSS }
|
||||||
document::Stylesheet { href: INPUT_NUMBER_ARROWS_CSS }
|
document::Stylesheet { href: INPUT_NUMBER_ARROWS_CSS }
|
||||||
document::Stylesheet { href: INPUT_RANGE_CSS }
|
document::Stylesheet { href: INPUT_RANGE_CSS }
|
||||||
document::Link { rel: "manifest", href: MANIFEST }
|
|
||||||
document::Script { src: "https://kit.fontawesome.com/3c1b409f8f.js" }
|
document::Script { src: "https://kit.fontawesome.com/3c1b409f8f.js" }
|
||||||
|
|
||||||
div {
|
div {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ use crate::components::task_list::TaskList;
|
|||||||
use crate::internationalization::LocaleFromLanguageIdentifier;
|
use crate::internationalization::LocaleFromLanguageIdentifier;
|
||||||
use crate::models::category::Category;
|
use crate::models::category::Category;
|
||||||
use crate::models::task::TaskWithSubtasks;
|
use crate::models::task::TaskWithSubtasks;
|
||||||
use crate::query::QueryValue;
|
|
||||||
use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
||||||
|
use crate::query::QueryValue;
|
||||||
use chrono::{Datelike, Local};
|
use chrono::{Datelike, Local};
|
||||||
use dioxus::core_macro::rsx;
|
use dioxus::core_macro::rsx;
|
||||||
use dioxus::dioxus_core::Element;
|
use dioxus::dioxus_core::Element;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use crate::components::task_list::TaskList;
|
use crate::components::task_list::TaskList;
|
||||||
use crate::models::category::Category;
|
use crate::models::category::Category;
|
||||||
use crate::query::QueryValue;
|
|
||||||
use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
||||||
|
use crate::query::QueryValue;
|
||||||
use dioxus::core_macro::rsx;
|
use dioxus::core_macro::rsx;
|
||||||
use dioxus::dioxus_core::Element;
|
use dioxus::dioxus_core::Element;
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ use crate::components::task_list_item::TaskListItem;
|
|||||||
use crate::internationalization::LocaleFromLanguageIdentifier;
|
use crate::internationalization::LocaleFromLanguageIdentifier;
|
||||||
use crate::models::category::Category;
|
use crate::models::category::Category;
|
||||||
use crate::models::task::TaskWithSubtasks;
|
use crate::models::task::TaskWithSubtasks;
|
||||||
use crate::query::QueryValue;
|
|
||||||
use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
||||||
|
use crate::query::QueryValue;
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus_i18n::t;
|
use dioxus_i18n::t;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::models::project::Project;
|
use crate::models::project::Project;
|
||||||
use crate::query::QueryValue;
|
|
||||||
use crate::query::projects::use_projects_query;
|
use crate::query::projects::use_projects_query;
|
||||||
|
use crate::query::QueryValue;
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus_query::prelude::QueryResult;
|
use dioxus_query::prelude::QueryResult;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use crate::server::subtasks::{create_subtask, delete_subtask, edit_subtask};
|
|||||||
use dioxus::core_macro::{component, rsx};
|
use dioxus::core_macro::{component, rsx};
|
||||||
use dioxus::dioxus_core::Element;
|
use dioxus::dioxus_core::Element;
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus_query::prelude::{QueryResult, use_query_client};
|
use dioxus_query::prelude::{use_query_client, QueryResult};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub(crate) fn SubtasksForm(task: Task) -> Element {
|
pub(crate) fn SubtasksForm(task: Task) -> Element {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use dioxus::core_macro::{component, rsx};
|
|||||||
use dioxus::dioxus_core::Element;
|
use dioxus::dioxus_core::Element;
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus_i18n::t;
|
use dioxus_i18n::t;
|
||||||
use dioxus_query::prelude::{QueryResult, use_query_client};
|
use dioxus_query::prelude::{use_query_client, QueryResult};
|
||||||
|
|
||||||
const REMINDER_OFFSETS: [Option<Duration>; 17] = [
|
const REMINDER_OFFSETS: [Option<Duration>; 17] = [
|
||||||
None,
|
None,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ impl From<ValidationErrors> for ErrorVec<ProjectError> {
|
|||||||
validation_errors
|
validation_errors
|
||||||
.errors()
|
.errors()
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|(field, error_kind)| match field.as_ref() {
|
.flat_map(|(&field, error_kind)| match field {
|
||||||
"title" => match error_kind {
|
"title" => match error_kind {
|
||||||
ValidationErrorsKind::Field(validation_errors) => validation_errors
|
ValidationErrorsKind::Field(validation_errors) => validation_errors
|
||||||
.iter()
|
.iter()
|
||||||
@@ -45,7 +45,7 @@ impl From<diesel::result::Error> for ProjectError {
|
|||||||
// Has to be implemented for Dioxus server functions.
|
// Has to be implemented for Dioxus server functions.
|
||||||
impl Display for ProjectError {
|
impl Display for ProjectError {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{self:?}")
|
write!(f, "{:?}", self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ impl From<ValidationErrors> for ErrorVec<SubtaskError> {
|
|||||||
validation_errors
|
validation_errors
|
||||||
.errors()
|
.errors()
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|(field, error_kind)| match field.as_ref() {
|
.flat_map(|(&field, error_kind)| match field {
|
||||||
"title" => match error_kind {
|
"title" => match error_kind {
|
||||||
ValidationErrorsKind::Field(validation_errors) => validation_errors
|
ValidationErrorsKind::Field(validation_errors) => validation_errors
|
||||||
.iter()
|
.iter()
|
||||||
@@ -65,7 +65,7 @@ impl From<ErrorVec<Error>> for ErrorVec<SubtaskError> {
|
|||||||
// Has to be implemented for Dioxus server functions.
|
// Has to be implemented for Dioxus server functions.
|
||||||
impl Display for SubtaskError {
|
impl Display for SubtaskError {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{self:?}")
|
write!(f, "{:?}", self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ impl From<ValidationErrors> for ErrorVec<TaskError> {
|
|||||||
validation_errors
|
validation_errors
|
||||||
.errors()
|
.errors()
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|(field, error_kind)| match field.as_ref() {
|
.flat_map(|(&field, error_kind)| match field {
|
||||||
"title" => match error_kind {
|
"title" => match error_kind {
|
||||||
ValidationErrorsKind::Field(validation_errors) => validation_errors
|
ValidationErrorsKind::Field(validation_errors) => validation_errors
|
||||||
.iter()
|
.iter()
|
||||||
@@ -55,7 +55,7 @@ impl From<diesel::result::Error> for TaskError {
|
|||||||
// Has to be implemented for Dioxus server functions.
|
// Has to be implemented for Dioxus server functions.
|
||||||
impl Display for TaskError {
|
impl Display for TaskError {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{self:?}")
|
write!(f, "{:?}", self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use diesel_migrations::{EmbeddedMigrations, MigrationHarness, embed_migrations};
|
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
const MIGRATIONS: EmbeddedMigrations = embed_migrations!("migrations");
|
const MIGRATIONS: EmbeddedMigrations = embed_migrations!("migrations");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
||||||
use crate::server::projects::get_projects;
|
use crate::server::projects::get_projects;
|
||||||
use dioxus::prelude::ServerFnError;
|
use dioxus::prelude::ServerFnError;
|
||||||
use dioxus_query::prelude::{QueryResult, UseQuery, use_get_query};
|
use dioxus_query::prelude::{use_get_query, QueryResult, UseQuery};
|
||||||
|
|
||||||
pub(crate) fn use_projects_query() -> UseQuery<QueryValue, QueryErrors, QueryKey> {
|
pub(crate) fn use_projects_query() -> UseQuery<QueryValue, QueryErrors, QueryKey> {
|
||||||
use_get_query([QueryKey::Projects, QueryKey::Tasks], fetch_projects)
|
use_get_query([QueryKey::Projects, QueryKey::Tasks], fetch_projects)
|
||||||
@@ -12,10 +12,10 @@ async fn fetch_projects(keys: Vec<QueryKey>) -> QueryResult<QueryValue, QueryErr
|
|||||||
match get_projects().await {
|
match get_projects().await {
|
||||||
Ok(projects) => Ok(QueryValue::Projects(projects)),
|
Ok(projects) => Ok(QueryValue::Projects(projects)),
|
||||||
Err(ServerFnError::WrappedServerError(errors)) => Err(QueryErrors::Error(errors)),
|
Err(ServerFnError::WrappedServerError(errors)) => Err(QueryErrors::Error(errors)),
|
||||||
Err(error) => panic!("Unexpected error: {error:?}"),
|
Err(error) => panic!("Unexpected error: {:?}", error),
|
||||||
}
|
}
|
||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
panic!("Unexpected query keys: {keys:?}");
|
panic!("Unexpected query keys: {:?}", keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
||||||
use crate::server::subtasks::get_subtasks_of_task;
|
use crate::server::subtasks::get_subtasks_of_task;
|
||||||
use dioxus::prelude::ServerFnError;
|
use dioxus::prelude::ServerFnError;
|
||||||
use dioxus_query::prelude::{QueryResult, UseQuery, use_get_query};
|
use dioxus_query::prelude::{use_get_query, QueryResult, UseQuery};
|
||||||
|
|
||||||
pub(crate) fn use_subtasks_of_task_query(
|
pub(crate) fn use_subtasks_of_task_query(
|
||||||
task_id: i32,
|
task_id: i32,
|
||||||
@@ -17,10 +17,10 @@ async fn fetch_subtasks_of_task(keys: Vec<QueryKey>) -> QueryResult<QueryValue,
|
|||||||
match get_subtasks_of_task(*task_id).await {
|
match get_subtasks_of_task(*task_id).await {
|
||||||
Ok(subtasks) => Ok(QueryValue::Subtasks(subtasks)),
|
Ok(subtasks) => Ok(QueryValue::Subtasks(subtasks)),
|
||||||
Err(ServerFnError::WrappedServerError(errors)) => Err(QueryErrors::Error(errors)),
|
Err(ServerFnError::WrappedServerError(errors)) => Err(QueryErrors::Error(errors)),
|
||||||
Err(error) => panic!("Unexpected error: {error:?}"),
|
Err(error) => panic!("Unexpected error: {:?}", error),
|
||||||
}
|
}
|
||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
panic!("Unexpected query keys: {keys:?}");
|
panic!("Unexpected query keys: {:?}", keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use crate::models::category::Category;
|
|||||||
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
||||||
use crate::server::tasks::{get_tasks_in_category, get_tasks_with_subtasks_in_category};
|
use crate::server::tasks::{get_tasks_in_category, get_tasks_with_subtasks_in_category};
|
||||||
use dioxus::prelude::ServerFnError;
|
use dioxus::prelude::ServerFnError;
|
||||||
use dioxus_query::prelude::{QueryResult, UseQuery, use_get_query};
|
use dioxus_query::prelude::{use_get_query, QueryResult, UseQuery};
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub(crate) fn use_tasks_in_category_query(
|
pub(crate) fn use_tasks_in_category_query(
|
||||||
@@ -19,11 +19,11 @@ async fn fetch_tasks_in_category(keys: Vec<QueryKey>) -> QueryResult<QueryValue,
|
|||||||
match get_tasks_in_category(category.clone()).await {
|
match get_tasks_in_category(category.clone()).await {
|
||||||
Ok(tasks) => Ok(QueryValue::Tasks(tasks)),
|
Ok(tasks) => Ok(QueryValue::Tasks(tasks)),
|
||||||
Err(ServerFnError::WrappedServerError(errors)) => Err(QueryErrors::Error(errors)),
|
Err(ServerFnError::WrappedServerError(errors)) => Err(QueryErrors::Error(errors)),
|
||||||
Err(error) => panic!("Unexpected error: {error:?}"),
|
Err(error) => panic!("Unexpected error: {:?}", error),
|
||||||
}
|
}
|
||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
panic!("Unexpected query keys: {keys:?}");
|
panic!("Unexpected query keys: {:?}", keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,10 +47,10 @@ async fn fetch_tasks_with_subtasks_in_category(
|
|||||||
match get_tasks_with_subtasks_in_category(category.clone()).await {
|
match get_tasks_with_subtasks_in_category(category.clone()).await {
|
||||||
Ok(tasks) => Ok(QueryValue::TasksWithSubtasks(tasks)),
|
Ok(tasks) => Ok(QueryValue::TasksWithSubtasks(tasks)),
|
||||||
Err(ServerFnError::WrappedServerError(errors)) => Err(QueryErrors::Error(errors)),
|
Err(ServerFnError::WrappedServerError(errors)) => Err(QueryErrors::Error(errors)),
|
||||||
Err(error) => panic!("Unexpected error: {error:?}"),
|
Err(error) => panic!("Unexpected error: {:?}", error),
|
||||||
}
|
}
|
||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
panic!("Unexpected query keys: {keys:?}");
|
panic!("Unexpected query keys: {:?}", keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user