Closed freedit-dev closed 3 weeks ago
This update focuses on enhancing form validation and template handling across the codebase. Dependencies like askama_axum
and garde
were integrated, replacing older libraries (askama
and validator
). The changes streamline form validation processes, improve template rendering, and ensure more robust and efficient handling of form data.
File(s) | Change Summary |
---|---|
Cargo.toml |
Added and updated dependencies: askama_axum , axum_garde , garde , reqwest , etc. |
src/controller/admin.rs , .../feed.rs , .../inn.rs |
Updated imports and function signatures to use askama_axum and garde for validation. |
src/controller/message.rs , .../notification.rs , .../solo.rs , .../tantivy.rs , .../upload.rs , .../user.rs |
Replaced askama::Template with askama_axum::{into_response, Template} . |
src/controller/meta_handler.rs |
Refactored to remove ValidatedForm and unused imports, restructured into_response . |
src/controller/mod.rs |
Updated FormPost and SiteConfig structs to use garde for validation. |
src/error.rs |
Replaced validator::ValidationErrors with garde::Error in AppError . |
src/main.rs |
Changed GLOBAL static variable declaration to use tikv_jemallocator::Jemalloc . |
sequenceDiagram
participant User
participant Controller
participant Validator
participant Renderer
User ->> Controller: Submit Form
Controller ->> Validator: Validate Form Data
Validator -->> Controller: Validation Result
Controller ->> Renderer: Render Response
Renderer -->> User: Display Result
In the code where templates lie,
New dependencies reach the sky,
Validation's now a smoother ride,
Withgarde
andaskama_axum
by our side.
Forms and data, clean and neat,
In Rust, we've made a feat!
🌟🚀
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit
Dependencies
askama_axum
,axum-extra
,cached
,reqwest
,ring
,webpki-roots
.axum_garde
,garde
.New Features
garde
for form validation, replacingvalidator
.Refactor
askama::Template
withaskama_axum::Template
across multiple controllers.ValidatedForm
toWithValidation
.Bug Fixes
Chores
Cargo.toml
to reflect new and updated dependencies.