Compare commits
52 Commits
3646aa91c4
...
main
Author | SHA1 | Date | |
---|---|---|---|
94059f14bb
![]() |
|||
744e23aa66
|
|||
e9a208a9d1
![]() |
|||
0f1dfbadf8
|
|||
907ddaacbe
|
|||
defddfadae
![]() |
|||
8a0fae3b32
![]() |
|||
f66b8301f0
|
|||
7112946e5b
|
|||
ac8a533079
|
|||
31e50e486b
![]() |
|||
69e43805b9
|
|||
ab7fbdd569
![]() |
|||
a0b7a23b7c
|
|||
8f3d144329
|
|||
3f9efeee3e
![]() |
|||
d592a81b7c
|
|||
145214e6cc
|
|||
4271ec7c21
![]() |
|||
1deffe8ee4
|
|||
bcac82b860
![]() |
|||
9da7515042
|
|||
a088d90c6a
![]() |
|||
9481498725
![]() |
|||
3d28254ae1
|
|||
1666c25d13
|
|||
a3ebf712f9
![]() |
|||
0ea3f3a118
|
|||
9d80e68a4e
|
|||
9ce77897d8
![]() |
|||
bf4afb03e6
|
|||
f134e6d4c3
|
|||
97a3a24378
![]() |
|||
7f5a524d4b
|
|||
dbd3a5841b
![]() |
|||
60cf0b641d
![]() |
|||
bfadb1c2b2
![]() |
|||
da2291b6e7
![]() |
|||
5b1df9577b
![]() |
|||
0548c6cbea
|
|||
8dda8ec0dd
|
|||
5725c3e7da
|
|||
f688c7c2fa
|
|||
3677cc343c
|
|||
d7c4b0788d
![]() |
|||
37ab61743f
|
|||
5a4716146e
![]() |
|||
2b719e0c0f
|
|||
45a20cdaef
![]() |
|||
da87cd95da
|
|||
6b2bfb5ebe
|
|||
a83b376f7b
|
@ -1,9 +1,11 @@
|
||||
/.dioxus/
|
||||
/.git/
|
||||
/.github/
|
||||
/debug/
|
||||
/node_modules/
|
||||
/static/
|
||||
/target/
|
||||
/.git
|
||||
/.github
|
||||
/node_modules
|
||||
/target
|
||||
|
||||
.dockerignore
|
||||
/docker-compose-dev.yaml
|
||||
/docker-compose-prod.yaml
|
||||
/docker-compose.yaml
|
||||
/docker/dev/*/Dockerfile
|
||||
/docker/prod/*/Dockerfile
|
||||
|
1
.gitea/default_merge_message/MERGE_TEMPLATE.md
Normal file
1
.gitea/default_merge_message/MERGE_TEMPLATE.md
Normal file
@ -0,0 +1 @@
|
||||
${PullRequestTitle} (${PullRequestReference})
|
2
.github/workflows/checkov-check.yaml
vendored
2
.github/workflows/checkov-check.yaml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
with:
|
||||
python-version: "3.13.1"
|
||||
- name: Rust toolchain installation
|
||||
uses: dtolnay/rust-toolchain@0579bb9e1907e560c2f263f705f93655a44a07e5
|
||||
uses: dtolnay/rust-toolchain@6691ebadcb18182cc1391d07c9f295f657c593cd
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
|
8
.github/workflows/rust-check.yaml
vendored
8
.github/workflows/rust-check.yaml
vendored
@ -21,18 +21,20 @@ jobs:
|
||||
run: >
|
||||
apt-get update && apt-get install -y
|
||||
libgtk-3-dev=3.24.33-1ubuntu2.2
|
||||
libjavascriptcoregtk-4.1-dev=2.46.4-0ubuntu0.22.04.1
|
||||
libjavascriptcoregtk-4.1-dev=2.48.3-0ubuntu0.22.04.1
|
||||
libsoup-3.0-dev=3.0.7-0ubuntu1
|
||||
libwebkit2gtk-4.1-dev=2.46.4-0ubuntu0.22.04.1
|
||||
libwebkit2gtk-4.1-dev=2.48.3-0ubuntu0.22.04.1
|
||||
libxdo-dev=1:3.20160805.1-4
|
||||
- name: Rust toolchain installation
|
||||
uses: dtolnay/rust-toolchain@0579bb9e1907e560c2f263f705f93655a44a07e5
|
||||
uses: dtolnay/rust-toolchain@6691ebadcb18182cc1391d07c9f295f657c593cd
|
||||
with:
|
||||
components: clippy, rustfmt
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: .env symlink creation
|
||||
run: ln -s .env.example .env
|
||||
- name: npm build
|
||||
run: npm install && npm run build
|
||||
- name: rustfmt check
|
||||
|
8
.github/workflows/shellcheck-check.yaml
vendored
8
.github/workflows/shellcheck-check.yaml
vendored
@ -25,4 +25,10 @@ jobs:
|
||||
fetch-depth: 0
|
||||
- name: ShellCheck check
|
||||
# https://www.shellcheck.net/wiki/Recursiveness
|
||||
run: find . -type f -name "*.sh" -print0 | xargs -0 shellcheck
|
||||
run: |
|
||||
if find . -type f -name "*.sh" -print0 | grep -qz .; then
|
||||
find . -type f -name "*.sh" -print0 | xargs -0 shellcheck
|
||||
exit 0
|
||||
else
|
||||
echo "No shell scripts found. Skipping ShellCheck."
|
||||
fi
|
||||
|
15
.gitignore
vendored
15
.gitignore
vendored
@ -1,10 +1,9 @@
|
||||
/target/
|
||||
/dist/
|
||||
/static/
|
||||
/.dioxus/
|
||||
/node_modules/
|
||||
/node_modules
|
||||
/target
|
||||
|
||||
**/*.rs.bk
|
||||
/**/*.rs.bk
|
||||
/.DS_Store
|
||||
/.env
|
||||
/.env.prod
|
||||
|
||||
.env
|
||||
.env.prod
|
||||
/docker-compose.yaml
|
||||
|
63
.idea/codeStyles/Project.xml
generated
Normal file
63
.idea/codeStyles/Project.xml
generated
Normal file
@ -0,0 +1,63 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<HTMLCodeStyleSettings>
|
||||
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
||||
</HTMLCodeStyleSettings>
|
||||
<JSCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
</JSCodeStyleSettings>
|
||||
<TypeScriptCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
</TypeScriptCodeStyleSettings>
|
||||
<VueCodeStyleSettings>
|
||||
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
||||
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
||||
</VueCodeStyleSettings>
|
||||
<codeStyleSettings language="HTML">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Markdown">
|
||||
<option name="RIGHT_MARGIN" value="80" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="TypeScript">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Vue">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="yaml">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
2
.idea/dataSources.local.xml
generated
2
.idea/dataSources.local.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="dataSourceStorageLocal" created-in="RR-243.22562.230">
|
||||
<component name="dataSourceStorageLocal" created-in="RR-243.23654.116">
|
||||
<data-source name="todo_baggins@localhost" uuid="1658668c-c2b8-426d-a22f-16fbad9eff0b">
|
||||
<database-info product="PostgreSQL" version="16.4 (Debian 16.4-1.pgdg120+1)" jdbc-version="4.2" driver-name="PostgreSQL JDBC Driver" driver-version="42.6.0" dbms="POSTGRES" exact-version="16.4" exact-driver-version="42.6">
|
||||
<identifier-quote-string>"</identifier-quote-string>
|
||||
|
1070
.idea/dataSources/1658668c-c2b8-426d-a22f-16fbad9eff0b.xml
generated
1070
.idea/dataSources/1658668c-c2b8-426d-a22f-16fbad9eff0b.xml
generated
File diff suppressed because it is too large
Load Diff
@ -1,2 +1,2 @@
|
||||
#n:public
|
||||
!<md> [785, 0, null, null, -2147483648, -2147483648]
|
||||
!<md> [946, 0, null, null, -2147483648, -2147483648]
|
||||
|
203
.idea/icon.svg
generated
Normal file
203
.idea/icon.svg
generated
Normal file
@ -0,0 +1,203 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="512"
|
||||
height="512"
|
||||
viewBox="0 0 512 512"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="icon.svg"
|
||||
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#505050"
|
||||
inkscape:document-units="px"
|
||||
inkscape:zoom="1.1020922"
|
||||
inkscape:cx="188.27826"
|
||||
inkscape:cy="204.15715"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1011"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs1">
|
||||
<inkscape:path-effect
|
||||
effect="fillet_chamfer"
|
||||
id="path-effect2"
|
||||
is_visible="true"
|
||||
lpeversion="1"
|
||||
nodesatellites_param="F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1"
|
||||
radius="0"
|
||||
unit="px"
|
||||
method="auto"
|
||||
mode="F"
|
||||
chamfer_steps="1"
|
||||
flexible="false"
|
||||
use_knot_distance="true"
|
||||
apply_no_radius="true"
|
||||
apply_with_radius="true"
|
||||
only_selected="false"
|
||||
hide_knots="false" />
|
||||
<inkscape:path-effect
|
||||
effect="fillet_chamfer"
|
||||
id="path-effect1"
|
||||
is_visible="true"
|
||||
lpeversion="1"
|
||||
nodesatellites_param="F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1"
|
||||
radius="0"
|
||||
unit="px"
|
||||
method="auto"
|
||||
mode="F"
|
||||
chamfer_steps="1"
|
||||
flexible="false"
|
||||
use_knot_distance="true"
|
||||
apply_no_radius="true"
|
||||
apply_with_radius="true"
|
||||
only_selected="false"
|
||||
hide_knots="false" />
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<rect
|
||||
style="display:inline;fill:#27272a;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect1"
|
||||
width="512"
|
||||
height="512"
|
||||
x="0"
|
||||
y="0"
|
||||
sodipodi:insensitive="true"
|
||||
inkscape:label="background"
|
||||
ry="128.00018"
|
||||
sodipodi:type="rect"
|
||||
rx="129.98714" />
|
||||
<g
|
||||
id="g17"
|
||||
inkscape:label="logo"
|
||||
transform="translate(8)">
|
||||
<g
|
||||
id="g8"
|
||||
inkscape:label="ring">
|
||||
<g
|
||||
id="g7"
|
||||
inkscape:label="back">
|
||||
<circle
|
||||
style="fill:#d97706;fill-opacity:1;stroke:#d97706;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path1"
|
||||
cx="224"
|
||||
cy="256"
|
||||
r="128"
|
||||
inkscape:label="ring back" />
|
||||
<rect
|
||||
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-width:21.8936;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect2"
|
||||
width="48"
|
||||
height="288"
|
||||
x="224"
|
||||
y="112"
|
||||
inkscape:label="rect2" />
|
||||
</g>
|
||||
<g
|
||||
id="g1"
|
||||
transform="translate(-4.163147,-0.69235229)"
|
||||
inkscape:label="front">
|
||||
<circle
|
||||
style="fill:#27272a;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path1-5-2"
|
||||
cx="276.16315"
|
||||
cy="256.69235"
|
||||
r="128" />
|
||||
<circle
|
||||
style="fill:none;fill-opacity:1;stroke:#fbbf24;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path1-5"
|
||||
cx="276.16315"
|
||||
cy="256.69235"
|
||||
r="128" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g16"
|
||||
inkscape:label="tick"
|
||||
transform="translate(16.000231,-8.3918418e-5)">
|
||||
<g
|
||||
id="g6"
|
||||
transform="rotate(45,-57.96574,415.4208)"
|
||||
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-opacity:1"
|
||||
inkscape:label="back">
|
||||
<rect
|
||||
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect9"
|
||||
width="32.000458"
|
||||
height="32"
|
||||
x="273.94067"
|
||||
y="210.74516"
|
||||
transform="rotate(-45,-57.96574,415.4208)" />
|
||||
<rect
|
||||
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect8"
|
||||
width="32.000458"
|
||||
height="32"
|
||||
x="206.05841"
|
||||
y="233.37257"
|
||||
transform="rotate(-45,-57.96574,415.4208)" />
|
||||
<rect
|
||||
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect7"
|
||||
height="16"
|
||||
x="228.686"
|
||||
y="285.255"
|
||||
width="32"
|
||||
transform="rotate(-45,-57.96574,415.4208)" />
|
||||
<rect
|
||||
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect5"
|
||||
width="64"
|
||||
height="32"
|
||||
x="0"
|
||||
y="100" />
|
||||
<rect
|
||||
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-width:39.1918;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect6"
|
||||
width="32"
|
||||
height="96"
|
||||
x="32"
|
||||
y="36" />
|
||||
</g>
|
||||
<g
|
||||
id="g4"
|
||||
transform="rotate(45,-41.965512,454.04877)"
|
||||
style="fill:#fbbf24;fill-opacity:1;stroke:none;stroke-opacity:1"
|
||||
inkscape:label="front">
|
||||
<rect
|
||||
style="fill:#fbbf24;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect3"
|
||||
width="64"
|
||||
height="32"
|
||||
x="0"
|
||||
y="100" />
|
||||
<rect
|
||||
style="fill:#fbbf24;fill-opacity:1;stroke:none;stroke-width:39.1918;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect4"
|
||||
width="32"
|
||||
height="96"
|
||||
x="32"
|
||||
y="36" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 6.4 KiB |
2
.idea/sqldialects.xml
generated
2
.idea/sqldialects.xml
generated
@ -1,8 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/migrations/00000000000000_diesel_initial_setup/down.sql" dialect="GenericSQL" />
|
||||
<file url="file://$PROJECT_DIR$/migrations/00000000000000_diesel_initial_setup/up.sql" dialect="PostgreSQL" />
|
||||
<file url="PROJECT" dialect="PostgreSQL" />
|
||||
</component>
|
||||
</project>
|
1284
Cargo.lock
generated
1284
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
54
Cargo.toml
54
Cargo.toml
@ -1,36 +1,50 @@
|
||||
[package]
|
||||
name = "todo-baggins"
|
||||
version = "0.1.0"
|
||||
authors = ["Matouš Volf <66163112+matous-volf@users.noreply.github.com>"]
|
||||
edition = "2021"
|
||||
authors = ["Matouš Volf <git@matousvolf.cz>"]
|
||||
edition = "2024"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dioxus = { version = "0.6.0", features = ["fullstack", "router"] }
|
||||
dioxus-query = "0.6.0"
|
||||
dioxus-i18n = "0.3.0"
|
||||
chrono = { version = "0.4.41", features = ["serde", "unstable-locales"] }
|
||||
dioxus = { version = "0.6.3", features = ["fullstack", "router"] }
|
||||
feruca = { version = "0.11.4" }
|
||||
serde = { version = "1.0.219" }
|
||||
serde_json = { version = "1.0.142" }
|
||||
serde_with = { version = "3.14.0", features = ["chrono_0_4"] }
|
||||
tracing = "0.1.41"
|
||||
unic-langid-impl = { version = "0.9.6", features = ["serde"] }
|
||||
validator = { version = "0.20.0", features = ["derive"] }
|
||||
|
||||
async-std = "1.12.0"
|
||||
chrono = { version = "0.4.38", features = ["serde", "unstable-locales"] }
|
||||
diesel = { version = "2.2.2", features = ["chrono", "postgres", "postgres_backend", "serde_json"] }
|
||||
diesel_migrations = { version = "2.2.0", features = ["postgres"] }
|
||||
dotenvy = "0.15.7"
|
||||
feruca = "0.10.0"
|
||||
serde = "1.0.208"
|
||||
serde_json = "1.0.125"
|
||||
serde_with = { version = "3.9.0", features = ["chrono_0_4"] }
|
||||
time = "0.3.36"
|
||||
tracing = "0.1.40"
|
||||
unic-langid-impl = { version = "0.9.5", features = ["serde"] }
|
||||
validator = { version = "0.19.0", features = ["derive"] }
|
||||
voca_rs = "1.15.2"
|
||||
diesel = { version = "2.2.12", features = ["chrono", "postgres", "postgres_backend", "serde_json"], optional = true }
|
||||
diesel_migrations = { version = "2.2.0", features = ["postgres"], optional = true }
|
||||
dotenvy = { version = "0.15.7", optional = true }
|
||||
time = { version = "0.3.41", optional = true }
|
||||
|
||||
async-std = { version = "1.13.1", optional = true }
|
||||
dioxus-i18n = { version = "0.4.3", optional = true }
|
||||
dioxus-query = { version = "0.6.1", optional = true }
|
||||
voca_rs = { version = "1.15.2", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["web"]
|
||||
desktop = ["dioxus/desktop"]
|
||||
mobile = ["dioxus/mobile"]
|
||||
web = ["dioxus/web"]
|
||||
web = [
|
||||
"dioxus/web",
|
||||
"dep:async-std",
|
||||
"dep:dioxus-query",
|
||||
"dep:dioxus-i18n",
|
||||
"dep:voca_rs"
|
||||
]
|
||||
server = [
|
||||
"dioxus/server",
|
||||
"dep:diesel",
|
||||
"dep:diesel_migrations",
|
||||
"dep:dotenvy",
|
||||
"dep:time",
|
||||
]
|
||||
|
||||
[profile]
|
||||
|
||||
|
23
Dioxus.toml
23
Dioxus.toml
@ -3,14 +3,7 @@
|
||||
# App (Project) Name
|
||||
name = "todo-baggins"
|
||||
|
||||
# Dioxus App Default Platform
|
||||
# web, desktop, fullstack
|
||||
default_platform = "fullstack"
|
||||
|
||||
# `build` & `serve` dist path
|
||||
out_dir = "dist"
|
||||
|
||||
# resource (assets) file folder
|
||||
# For font files to get referenced in CSS files by their original names, without the hash Dioxus appends.
|
||||
asset_dir = "assets"
|
||||
|
||||
[web.app]
|
||||
@ -18,22 +11,14 @@ asset_dir = "assets"
|
||||
# HTML title tag content
|
||||
title = "Todo Baggins"
|
||||
|
||||
[web.watcher]
|
||||
|
||||
# when watcher trigger, regenerate the `index.html`
|
||||
reload_html = true
|
||||
|
||||
# which files or dirs will be watcher monitoring
|
||||
watch_path = ["src", "assets"]
|
||||
|
||||
# include `assets` in web platform
|
||||
[web.resource]
|
||||
|
||||
# CSS style file
|
||||
# Additional CSS style files
|
||||
style = []
|
||||
|
||||
# Javascript code file
|
||||
script = ["https://kit.fontawesome.com/3c1b409f8f.js"]
|
||||
# Additional JavaScript files
|
||||
script = []
|
||||
|
||||
[web.resource.dev]
|
||||
|
||||
|
@ -12,11 +12,22 @@ services:
|
||||
- ./Cargo.toml:/srv/app/Cargo.toml
|
||||
- ./diesel.toml:/srv/app/diesel.toml
|
||||
- ./Dioxus.toml:/srv/app/Dioxus.toml
|
||||
- ./package.json:/srv/app/package.json
|
||||
- ./package-lock.json:/srv/app/package-lock.json
|
||||
restart: always
|
||||
ports: ["8000:8000"]
|
||||
depends_on: ["db"]
|
||||
depends_on: ["db", "style-builder"]
|
||||
|
||||
style-builder:
|
||||
build:
|
||||
dockerfile: docker/dev/style-builder/Dockerfile
|
||||
volumes:
|
||||
- ./assets:/srv/app/assets
|
||||
- ./src:/srv/app/src
|
||||
- ./package.json:/srv/app/package.json
|
||||
- ./package-lock.json:/srv/app/package-lock.json
|
||||
# To prevent the container from exiting.
|
||||
# See https://github.com/rails/rails/issues/44048.
|
||||
tty: true
|
||||
restart: always
|
||||
|
||||
db:
|
||||
image: postgres:16.4-bookworm
|
||||
|
@ -1,27 +1,16 @@
|
||||
FROM rust:1.83-bookworm
|
||||
FROM rust:1.88.0-bookworm@sha256:5771a3cc2081935c59ac52b92d49c9e164d4fed92c9f6420aa8cc50364aead6e
|
||||
|
||||
RUN cargo install dioxus-cli diesel_cli \
|
||||
&& apt-get update && apt-get install -y --no-install-recommends \
|
||||
nodejs=18.19.0+dfsg-6~deb12u2 \
|
||||
npm=9.2.0~ds1-1 \
|
||||
supervisor=4.2.5-1 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN cargo install dioxus-cli --version 0.6.3 \
|
||||
&& cargo install diesel_cli --version 2.2.7
|
||||
|
||||
COPY . /srv/app
|
||||
WORKDIR /srv/app
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY docker/dev/app/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
RUN chown -R 1000:1000 /srv/app \
|
||||
&& chown -R 1000:1000 /usr/local/cargo \
|
||||
&& mkdir -p /.local/share/dioxus \
|
||||
&& chown -R 1000:1000 /.local/share/dioxus
|
||||
RUN mkdir -p /.local/share/dioxus \
|
||||
&& chown -R 1000:1000 /srv/app /usr/local/cargo /.local/share/dioxus
|
||||
|
||||
HEALTHCHECK CMD curl --fail -H "Accept: text/html" http://localhost:8000 || exit 1
|
||||
|
||||
USER 1000:1000
|
||||
|
||||
CMD ["sh", "docker/dev/app/entrypoint.sh"]
|
||||
CMD ["sleep", "infinity"]
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
@ -1,23 +0,0 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/dev/null
|
||||
logfile_maxbytes=0
|
||||
pidfile=/dev/null
|
||||
|
||||
[program:npm]
|
||||
command=npm run watch
|
||||
directory=/srv/app
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
||||
|
||||
[program:dx]
|
||||
command=dx serve --addr 0.0.0.0 --port 8000
|
||||
directory=/srv/app
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
15
docker/dev/style-builder/Dockerfile
Normal file
15
docker/dev/style-builder/Dockerfile
Normal file
@ -0,0 +1,15 @@
|
||||
# 23-alpine3.21
|
||||
FROM node@sha256:c61b6b12a3c96373673cd52d7ecee2314e82bca5d541eecf0bc6aee870c8c6f7
|
||||
|
||||
WORKDIR /srv/app
|
||||
|
||||
COPY ./package.json ./package.json
|
||||
COPY ./package-lock.json ./package-lock.json
|
||||
|
||||
RUN npm install
|
||||
|
||||
USER 1000:1000
|
||||
|
||||
#checkov:skip=CKV_DOCKER_2: No need for (or even a simple way to do) a healthcheck.
|
||||
|
||||
CMD ["npm", "run", "watch"]
|
@ -1,25 +1,24 @@
|
||||
FROM rust:1.83-bookworm AS builder
|
||||
FROM rust:1.88.0-bookworm@sha256:5771a3cc2081935c59ac52b92d49c9e164d4fed92c9f6420aa8cc50364aead6e AS builder
|
||||
|
||||
RUN rustup target add wasm32-unknown-unknown \
|
||||
&& cargo install dioxus-cli diesel_cli \
|
||||
&& apt-get update && apt-get install -y --no-install-recommends \
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
nodejs=18.19.0+dfsg-6~deb12u2 \
|
||||
npm=9.2.0~ds1-1 \
|
||||
supervisor=4.2.5-1 \
|
||||
&& 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
|
||||
WORKDIR /srv/app
|
||||
|
||||
RUN npm install \
|
||||
&& npm run build \
|
||||
&& dx build --release
|
||||
&& dx bundle
|
||||
|
||||
FROM debian:bookworm-slim AS runner
|
||||
FROM debian:bookworm@sha256:b877a1a3fdf02469440f1768cf69c9771338a875b7add5e80c45b756c92ac20a AS runner
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends libpq5=15.8-0+deb12u1 \
|
||||
&& apt-get install -y --no-install-recommends libpq5=15.10-0+deb12u1 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
12
package-lock.json
generated
12
package-lock.json
generated
@ -5,14 +5,14 @@
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"tailwindcss": "^3.4.10"
|
||||
"tailwindcss": "3.4.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"htmlhint": "^1.1.4",
|
||||
"markdownlint-cli": "^0.43.0",
|
||||
"prettier": "^3.4.2",
|
||||
"stylelint": "^16.12.0",
|
||||
"stylelint-config-standard": "^36.0.1"
|
||||
"htmlhint": "1.1.4",
|
||||
"markdownlint-cli": "0.43.0",
|
||||
"prettier": "3.4.2",
|
||||
"stylelint": "16.12.0",
|
||||
"stylelint-config-standard": "36.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@alloc/quick-lru": {
|
||||
|
@ -35,10 +35,11 @@ pub(crate) fn App() -> Element {
|
||||
|
||||
rsx! {
|
||||
document::Link { rel: "icon", href: FAVICON }
|
||||
document::Link { rel: "stylesheet", href: TAILWIND_CSS }
|
||||
document::Link { rel: "stylesheet", href: FONTS_CSS }
|
||||
document::Link { rel: "stylesheet", href: INPUT_NUMBER_ARROWS_CSS }
|
||||
document::Link { rel: "stylesheet", href: INPUT_RANGE_CSS }
|
||||
document::Stylesheet { href: TAILWIND_CSS }
|
||||
document::Stylesheet { href: FONTS_CSS }
|
||||
document::Stylesheet { href: INPUT_NUMBER_ARROWS_CSS }
|
||||
document::Stylesheet { href: INPUT_RANGE_CSS }
|
||||
document::Script { src: "https://kit.fontawesome.com/3c1b409f8f.js" }
|
||||
|
||||
div {
|
||||
class: "min-h-screen text-zinc-200 bg-zinc-800 pt-4 pb-36",
|
||||
|
@ -2,8 +2,8 @@ use crate::components::task_list::TaskList;
|
||||
use crate::internationalization::LocaleFromLanguageIdentifier;
|
||||
use crate::models::category::Category;
|
||||
use crate::models::task::TaskWithSubtasks;
|
||||
use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
||||
use crate::query::QueryValue;
|
||||
use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
||||
use chrono::{Datelike, Local};
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::components::task_list::TaskList;
|
||||
use crate::models::category::Category;
|
||||
use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
||||
use crate::query::QueryValue;
|
||||
use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
|
@ -3,8 +3,8 @@ use crate::components::task_list_item::TaskListItem;
|
||||
use crate::internationalization::LocaleFromLanguageIdentifier;
|
||||
use crate::models::category::Category;
|
||||
use crate::models::task::TaskWithSubtasks;
|
||||
use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
||||
use crate::query::QueryValue;
|
||||
use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
||||
use chrono::Local;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_i18n::t;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::models::project::Project;
|
||||
use crate::query::projects::use_projects_query;
|
||||
use crate::query::QueryValue;
|
||||
use crate::query::projects::use_projects_query;
|
||||
use dioxus::prelude::*;
|
||||
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::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_query::prelude::{use_query_client, QueryResult};
|
||||
use dioxus_query::prelude::{QueryResult, use_query_client};
|
||||
|
||||
#[component]
|
||||
pub(crate) fn SubtasksForm(task: Task) -> Element {
|
||||
|
@ -13,7 +13,7 @@ use dioxus::core_macro::{component, rsx};
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_i18n::t;
|
||||
use dioxus_query::prelude::{use_query_client, QueryResult};
|
||||
use dioxus_query::prelude::{QueryResult, use_query_client};
|
||||
|
||||
const REMINDER_OFFSETS: [Option<Duration>; 17] = [
|
||||
None,
|
||||
|
@ -7,7 +7,6 @@ use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_query::prelude::use_query_client;
|
||||
use tracing::info;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>) -> Element {
|
||||
|
@ -15,7 +15,7 @@ pub(crate) fn TaskListItem(task: TaskWithSubtasks) -> Element {
|
||||
div {
|
||||
class: "flex flex-col",
|
||||
div {
|
||||
class: "mt-2 grow font-medium",
|
||||
class: "mt-1 grow font-medium",
|
||||
{task.task().title()}
|
||||
},
|
||||
div {
|
||||
|
@ -7,6 +7,7 @@ pub enum Error {
|
||||
ServerInternal,
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl From<diesel::result::Error> for Error {
|
||||
fn from(_: diesel::result::Error) -> Self {
|
||||
Self::ServerInternal
|
||||
|
@ -16,7 +16,7 @@ impl From<ValidationErrors> for ErrorVec<ProjectError> {
|
||||
validation_errors
|
||||
.errors()
|
||||
.iter()
|
||||
.flat_map(|(&field, error_kind)| match field {
|
||||
.flat_map(|(field, error_kind)| match field.as_ref() {
|
||||
"title" => match error_kind {
|
||||
ValidationErrorsKind::Field(validation_errors) => validation_errors
|
||||
.iter()
|
||||
@ -35,6 +35,7 @@ impl From<ValidationErrors> for ErrorVec<ProjectError> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl From<diesel::result::Error> for ProjectError {
|
||||
fn from(_: diesel::result::Error) -> Self {
|
||||
Self::Error(Error::ServerInternal)
|
||||
@ -44,7 +45,7 @@ impl From<diesel::result::Error> for ProjectError {
|
||||
// Has to be implemented for Dioxus server functions.
|
||||
impl Display for ProjectError {
|
||||
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
|
||||
.errors()
|
||||
.iter()
|
||||
.flat_map(|(&field, error_kind)| match field {
|
||||
.flat_map(|(field, error_kind)| match field.as_ref() {
|
||||
"title" => match error_kind {
|
||||
ValidationErrorsKind::Field(validation_errors) => validation_errors
|
||||
.iter()
|
||||
@ -36,6 +36,7 @@ impl From<ValidationErrors> for ErrorVec<SubtaskError> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl From<diesel::result::Error> for SubtaskError {
|
||||
fn from(diesel_error: diesel::result::Error) -> Self {
|
||||
match diesel_error {
|
||||
@ -64,7 +65,7 @@ impl From<ErrorVec<Error>> for ErrorVec<SubtaskError> {
|
||||
// Has to be implemented for Dioxus server functions.
|
||||
impl Display for SubtaskError {
|
||||
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
|
||||
.errors()
|
||||
.iter()
|
||||
.flat_map(|(&field, error_kind)| match field {
|
||||
.flat_map(|(field, error_kind)| match field.as_ref() {
|
||||
"title" => match error_kind {
|
||||
ValidationErrorsKind::Field(validation_errors) => validation_errors
|
||||
.iter()
|
||||
@ -36,6 +36,7 @@ impl From<ValidationErrors> for ErrorVec<TaskError> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl From<diesel::result::Error> for TaskError {
|
||||
fn from(diesel_error: diesel::result::Error) -> Self {
|
||||
match diesel_error {
|
||||
@ -54,7 +55,7 @@ impl From<diesel::result::Error> for TaskError {
|
||||
// Has to be implemented for Dioxus server functions.
|
||||
impl Display for TaskError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{:?}", self)
|
||||
write!(f, "{self:?}")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ pub(crate) static COLLATOR: Lazy<Mutex<Collator>> = Lazy::new(|| Mutex::new(Coll
|
||||
|
||||
pub(crate) struct LocaleFromLanguageIdentifier<'a>(&'a LanguageIdentifier);
|
||||
|
||||
impl<'a> Deref for LocaleFromLanguageIdentifier<'a> {
|
||||
impl Deref for LocaleFromLanguageIdentifier<'_> {
|
||||
type Target = LanguageIdentifier;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
@ -17,7 +17,7 @@ impl<'a> Deref for LocaleFromLanguageIdentifier<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<LocaleFromLanguageIdentifier<'a>> for Locale {
|
||||
impl From<LocaleFromLanguageIdentifier<'_>> for Locale {
|
||||
fn from(language_identifier: LocaleFromLanguageIdentifier) -> Self {
|
||||
language_identifier
|
||||
.to_string()
|
||||
|
@ -1,10 +1,12 @@
|
||||
mod components;
|
||||
mod errors;
|
||||
mod internationalization;
|
||||
#[cfg(feature = "server")]
|
||||
mod migrations;
|
||||
mod models;
|
||||
mod query;
|
||||
mod route;
|
||||
#[cfg(feature = "server")]
|
||||
mod schema;
|
||||
mod server;
|
||||
mod utils;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
|
||||
use diesel_migrations::{EmbeddedMigrations, MigrationHarness, embed_migrations};
|
||||
use std::error::Error;
|
||||
|
||||
const MIGRATIONS: EmbeddedMigrations = embed_migrations!("migrations");
|
||||
|
@ -1,19 +1,28 @@
|
||||
#[cfg(feature = "server")]
|
||||
use crate::schema::tasks;
|
||||
use chrono::{Duration, NaiveDate, NaiveTime};
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::deserialize::FromSql;
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::pg::{Pg, PgValue};
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::serialize::{Output, ToSql};
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::sql_types::{Bool, Jsonb};
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::{AsExpression, BoxableExpression, FromSqlRow, PgJsonbExpressionMethods};
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "server")]
|
||||
use serde_json::json;
|
||||
use serde_with::DurationSeconds;
|
||||
use std::hash::Hash;
|
||||
#[cfg(feature = "server")]
|
||||
use std::io::Write;
|
||||
|
||||
#[serde_with::serde_as]
|
||||
#[derive(AsExpression, FromSqlRow, Serialize, Deserialize, Clone, Debug)]
|
||||
#[diesel(sql_type = Jsonb)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[cfg_attr(feature = "server", derive(AsExpression, FromSqlRow))]
|
||||
#[cfg_attr(feature = "server", diesel(sql_type = Jsonb))]
|
||||
pub enum Category {
|
||||
Inbox,
|
||||
SomedayMaybe,
|
||||
@ -29,6 +38,7 @@ pub enum Category {
|
||||
Trash,
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl Category {
|
||||
pub fn eq_sql_predicate(&self) -> Box<dyn BoxableExpression<tasks::table, Pg, SqlType = Bool>> {
|
||||
use crate::schema::tasks::dsl::*;
|
||||
@ -60,6 +70,7 @@ impl PartialEq for Category {
|
||||
|
||||
impl Eq for Category {}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl ToSql<Jsonb, Pg> for Category {
|
||||
fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, Pg>) -> diesel::serialize::Result {
|
||||
let json = serde_json::to_string(self)?;
|
||||
@ -72,6 +83,7 @@ impl ToSql<Jsonb, Pg> for Category {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl FromSql<Jsonb, Pg> for Category {
|
||||
fn from_sql(bytes: PgValue) -> diesel::deserialize::Result<Self> {
|
||||
let bytes = bytes.as_bytes();
|
||||
|
@ -1,6 +1,8 @@
|
||||
use crate::internationalization::COLLATOR;
|
||||
#[cfg(feature = "server")]
|
||||
use crate::schema::projects;
|
||||
use chrono::NaiveDateTime;
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::cmp::Ordering;
|
||||
@ -9,9 +11,12 @@ use validator::Validate;
|
||||
const TITLE_LENGTH_MIN: u64 = 1;
|
||||
const TITLE_LENGTH_MAX: u64 = 255;
|
||||
|
||||
#[derive(Queryable, Selectable, Identifiable, Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
#[diesel(table_name = crate::schema::projects)]
|
||||
#[diesel(check_for_backend(diesel::pg::Pg))]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(feature = "server", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(
|
||||
feature = "server",
|
||||
diesel(table_name = crate::schema::projects, check_for_backend(diesel::pg::Pg))
|
||||
)]
|
||||
pub struct Project {
|
||||
id: i32,
|
||||
title: String,
|
||||
@ -19,6 +24,7 @@ pub struct Project {
|
||||
updated_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
impl Project {
|
||||
pub fn id(&self) -> i32 {
|
||||
self.id
|
||||
@ -54,8 +60,9 @@ impl Ord for Project {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Insertable, Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[diesel(table_name = projects)]
|
||||
#[derive(Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[cfg_attr(feature = "server", derive(Insertable))]
|
||||
#[cfg_attr(feature = "server", diesel(table_name = projects))]
|
||||
pub struct NewProject {
|
||||
#[validate(length(
|
||||
min = "TITLE_LENGTH_MIN",
|
||||
|
@ -1,6 +1,9 @@
|
||||
#[cfg(feature = "server")]
|
||||
use crate::models::task::Task;
|
||||
#[cfg(feature = "server")]
|
||||
use crate::schema::subtasks;
|
||||
use chrono::NaiveDateTime;
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::cmp::Ordering;
|
||||
@ -9,20 +12,19 @@ use validator::Validate;
|
||||
const TITLE_LENGTH_MIN: u64 = 1;
|
||||
const TITLE_LENGTH_MAX: u64 = 255;
|
||||
|
||||
#[derive(
|
||||
Queryable,
|
||||
Selectable,
|
||||
Identifiable,
|
||||
Associations,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
PartialEq,
|
||||
Clone,
|
||||
Debug,
|
||||
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "server",
|
||||
derive(Queryable, Selectable, Identifiable, Associations)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "server",
|
||||
diesel(
|
||||
table_name = subtasks,
|
||||
belongs_to(Task, foreign_key = task_id),
|
||||
check_for_backend(diesel::pg::Pg)
|
||||
)
|
||||
)]
|
||||
#[diesel(belongs_to(Task, foreign_key = task_id))]
|
||||
#[diesel(table_name = subtasks)]
|
||||
#[diesel(check_for_backend(diesel::pg::Pg))]
|
||||
pub struct Subtask {
|
||||
id: i32,
|
||||
task_id: i32,
|
||||
@ -74,8 +76,9 @@ impl Ord for Subtask {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Insertable, Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[diesel(table_name = subtasks)]
|
||||
#[derive(Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[cfg_attr(feature = "server", derive(Insertable))]
|
||||
#[cfg_attr(feature = "server", diesel(table_name = subtasks))]
|
||||
pub struct NewSubtask {
|
||||
pub task_id: i32,
|
||||
#[validate(length(
|
||||
|
@ -1,8 +1,10 @@
|
||||
use crate::models::category::Category;
|
||||
use crate::models::subtask::Subtask;
|
||||
#[cfg(feature = "server")]
|
||||
use crate::schema::tasks;
|
||||
use crate::utils::reverse_ord_option::ReverseOrdOption;
|
||||
use chrono::NaiveDateTime;
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::cmp::Ordering;
|
||||
@ -11,9 +13,9 @@ use validator::Validate;
|
||||
const TITLE_LENGTH_MIN: u64 = 1;
|
||||
const TITLE_LENGTH_MAX: u64 = 255;
|
||||
|
||||
#[derive(Queryable, Selectable, Identifiable, Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
#[diesel(table_name = tasks)]
|
||||
#[diesel(check_for_backend(diesel::pg::Pg))]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(feature = "server", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "server", diesel(table_name = tasks, check_for_backend(diesel::pg::Pg)))]
|
||||
pub struct Task {
|
||||
id: i32,
|
||||
title: String,
|
||||
@ -138,8 +140,9 @@ impl Ord for TaskWithSubtasks {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Insertable, Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[diesel(table_name = tasks)]
|
||||
#[derive(Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[cfg_attr(feature = "server", derive(Insertable))]
|
||||
#[cfg_attr(feature = "server", diesel(table_name = tasks))]
|
||||
pub struct NewTask {
|
||||
#[validate(length(
|
||||
min = "TITLE_LENGTH_MIN",
|
||||
|
@ -9,6 +9,7 @@ pub(crate) mod projects;
|
||||
pub(crate) mod subtasks;
|
||||
pub(crate) mod tasks;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub(crate) enum QueryValue {
|
||||
Projects(Vec<Project>),
|
||||
@ -17,6 +18,7 @@ pub(crate) enum QueryValue {
|
||||
Subtasks(Vec<Subtask>),
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum QueryErrors {
|
||||
Error(ErrorVec<Error>),
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
||||
use crate::server::projects::get_projects;
|
||||
use dioxus::prelude::ServerFnError;
|
||||
use dioxus_query::prelude::{use_get_query, QueryResult, UseQuery};
|
||||
use dioxus_query::prelude::{QueryResult, UseQuery, use_get_query};
|
||||
|
||||
pub(crate) fn use_projects_query() -> UseQuery<QueryValue, QueryErrors, QueryKey> {
|
||||
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 {
|
||||
Ok(projects) => Ok(QueryValue::Projects(projects)),
|
||||
Err(ServerFnError::WrappedServerError(errors)) => Err(QueryErrors::Error(errors)),
|
||||
Err(error) => panic!("Unexpected error: {:?}", error),
|
||||
Err(error) => panic!("Unexpected error: {error:?}"),
|
||||
}
|
||||
.into()
|
||||
} else {
|
||||
panic!("Unexpected query keys: {:?}", keys);
|
||||
panic!("Unexpected query keys: {keys:?}");
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
||||
use crate::server::subtasks::get_subtasks_of_task;
|
||||
use dioxus::prelude::ServerFnError;
|
||||
use dioxus_query::prelude::{use_get_query, QueryResult, UseQuery};
|
||||
use dioxus_query::prelude::{QueryResult, UseQuery, use_get_query};
|
||||
|
||||
pub(crate) fn use_subtasks_of_task_query(
|
||||
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 {
|
||||
Ok(subtasks) => Ok(QueryValue::Subtasks(subtasks)),
|
||||
Err(ServerFnError::WrappedServerError(errors)) => Err(QueryErrors::Error(errors)),
|
||||
Err(error) => panic!("Unexpected error: {:?}", error),
|
||||
Err(error) => panic!("Unexpected error: {error:?}"),
|
||||
}
|
||||
.into()
|
||||
} else {
|
||||
panic!("Unexpected query keys: {:?}", keys);
|
||||
panic!("Unexpected query keys: {keys:?}");
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,9 @@ 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};
|
||||
use dioxus_query::prelude::{QueryResult, UseQuery, use_get_query};
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn use_tasks_in_category_query(
|
||||
category: Category,
|
||||
) -> UseQuery<QueryValue, QueryErrors, QueryKey> {
|
||||
@ -18,11 +19,11 @@ 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),
|
||||
Err(error) => panic!("Unexpected error: {error:?}"),
|
||||
}
|
||||
.into()
|
||||
} else {
|
||||
panic!("Unexpected query keys: {:?}", keys);
|
||||
panic!("Unexpected query keys: {keys:?}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,10 +47,10 @@ async fn fetch_tasks_with_subtasks_in_category(
|
||||
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),
|
||||
Err(error) => panic!("Unexpected error: {error:?}"),
|
||||
}
|
||||
.into()
|
||||
} else {
|
||||
panic!("Unexpected query keys: {:?}", keys);
|
||||
panic!("Unexpected query keys: {keys:?}");
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
use dioxus::prelude::ServerFnError;
|
||||
use dioxus::prelude::*;
|
||||
#[cfg(feature = "server")]
|
||||
use dotenvy::dotenv;
|
||||
use std::env;
|
||||
use unic_langid_impl::LanguageIdentifier;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#[cfg(feature = "server")]
|
||||
pub(crate) mod database_connection;
|
||||
pub(crate) mod internationalization;
|
||||
pub(crate) mod projects;
|
||||
|
@ -2,9 +2,12 @@ use crate::errors::error::Error;
|
||||
use crate::errors::error_vec::ErrorVec;
|
||||
use crate::errors::project_error::ProjectError;
|
||||
use crate::models::project::{NewProject, Project};
|
||||
#[cfg(feature = "server")]
|
||||
use crate::server::database_connection::establish_database_connection;
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl, SelectableHelper};
|
||||
use dioxus::prelude::*;
|
||||
#[cfg(feature = "server")]
|
||||
use validator::Validate;
|
||||
|
||||
#[server]
|
||||
|
@ -2,10 +2,14 @@ use crate::errors::error::Error;
|
||||
use crate::errors::error_vec::ErrorVec;
|
||||
use crate::errors::subtask_error::SubtaskError;
|
||||
use crate::models::subtask::{NewSubtask, Subtask};
|
||||
#[cfg(feature = "server")]
|
||||
use crate::server::database_connection::establish_database_connection;
|
||||
#[cfg(feature = "server")]
|
||||
use crate::server::tasks::trigger_task_updated_at;
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl, SelectableHelper};
|
||||
use dioxus::prelude::*;
|
||||
#[cfg(feature = "server")]
|
||||
use validator::Validate;
|
||||
|
||||
#[server]
|
||||
|
@ -1,16 +1,26 @@
|
||||
use crate::errors::error::Error;
|
||||
use crate::errors::error_vec::ErrorVec;
|
||||
use crate::errors::task_error::TaskError;
|
||||
use crate::models::category::{Category, ReoccurrenceInterval};
|
||||
use crate::models::category::Category;
|
||||
#[cfg(feature = "server")]
|
||||
use crate::models::category::ReoccurrenceInterval;
|
||||
#[cfg(feature = "server")]
|
||||
use crate::models::subtask::Subtask;
|
||||
use crate::models::task::{NewTask, Task, TaskWithSubtasks};
|
||||
#[cfg(feature = "server")]
|
||||
use crate::server::database_connection::establish_database_connection;
|
||||
#[cfg(feature = "server")]
|
||||
use crate::server::subtasks::restore_subtasks_of_task;
|
||||
#[cfg(feature = "server")]
|
||||
use chrono::{Datelike, Days, Local, Months, NaiveDate};
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::prelude::*;
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::{ExpressionMethods, OptionalExtension, QueryDsl, RunQueryDsl, SelectableHelper};
|
||||
use dioxus::prelude::*;
|
||||
use time::util::days_in_year_month;
|
||||
#[cfg(feature = "server")]
|
||||
use time::Month;
|
||||
#[cfg(feature = "server")]
|
||||
use validator::Validate;
|
||||
|
||||
#[server]
|
||||
@ -168,10 +178,11 @@ pub(crate) async fn complete_task(task_id: i32) -> Result<Task, ServerFnError<Er
|
||||
*date = NaiveDate::from_ymd_opt(
|
||||
date.year(),
|
||||
date.month(),
|
||||
reoccurrence.start_date().day().min(days_in_year_month(
|
||||
date.year(),
|
||||
(date.month() as u8).try_into().unwrap(),
|
||||
) as u32),
|
||||
reoccurrence.start_date().day().min(
|
||||
Month::try_from(date.month() as u8)
|
||||
.unwrap()
|
||||
.length(date.year()) as u32,
|
||||
),
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
@ -204,6 +215,7 @@ pub(crate) async fn delete_task(task_id: i32) -> Result<(), ServerFnError<ErrorV
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub(crate) async fn trigger_task_updated_at(task_id: i32) -> Result<Task, ErrorVec<Error>> {
|
||||
use crate::schema::tasks::dsl::*;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
/** @type {import("tailwindcss").Config} */
|
||||
module.exports = {
|
||||
mode: "all",
|
||||
content: ["./src/**/*.{rs,html,css}", "./dist/**/*.html"],
|
||||
content: ["./src/**/*.{rs,html,css}"],
|
||||
theme: {
|
||||
fontFamily: {
|
||||
sans: ["Inter", "sans-serif"],
|
||||
|
@ -5,7 +5,7 @@ to reverse that. */
|
||||
#[derive(PartialEq)]
|
||||
pub(crate) struct ReverseOrdOption<'a, T>(&'a Option<T>);
|
||||
|
||||
impl<'a, T> Deref for ReverseOrdOption<'a, T> {
|
||||
impl<T> Deref for ReverseOrdOption<'_, T> {
|
||||
type Target = Option<T>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
@ -13,15 +13,15 @@ impl<'a, T> Deref for ReverseOrdOption<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Ord> Eq for ReverseOrdOption<'a, T> {}
|
||||
impl<T: Ord> Eq for ReverseOrdOption<'_, T> {}
|
||||
|
||||
impl<'a, T: Ord> PartialOrd<Self> for ReverseOrdOption<'a, T> {
|
||||
impl<T: Ord> PartialOrd<Self> for ReverseOrdOption<'_, T> {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Ord> Ord for ReverseOrdOption<'a, T> {
|
||||
impl<T: Ord> Ord for ReverseOrdOption<'_, T> {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
match (self.as_ref(), other.as_ref()) {
|
||||
(None, None) => Ordering::Equal,
|
||||
|
Reference in New Issue
Block a user