feat: ability to create a project #9
@ -1,5 +1,5 @@
|
||||
|
||||
use crate::components::project_form::ProjectForm;
|
||||
use crate::server::projects::create_project;
|
||||
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
use crate::server::projects::{create_project, testing};
|
||||
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
@ -7,12 +7,6 @@ use dioxus::prelude::*;
|
||||
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
#[component]
|
||||
pub(crate) fn Home() -> Element {
|
||||
rsx! {
|
||||
ProjectForm {
|
||||
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
onsubmit: move |title| {
|
||||
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
spawn(async move {
|
||||
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
create_project(title).await;
|
||||
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
});
|
||||
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
}
|
||||
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
}
|
||||
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
ProjectForm {}
|
||||
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
}
|
||||
}
|
||||
|
||||
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() Consider adding error handling for the The
**Consider adding error handling for the `create_project` call.**
The `create_project` function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.
```rust
onsubmit: move |title| {
spawn(async move {
if let Err(e) = create_project(title).await {
// Handle the error, e.g., log it or display a message to the user
}
});
}
```
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() This will be addressed in a later development stage. The project creation should probably result in a redirect. This will be addressed in a later development stage. The project creation should probably result in a redirect.
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
![]() @matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out. <!-- [monologue]
[observations] The user plans to handle error management and possibly implement a redirect after project creation in a future development stage.
[analysis] Since the user has acknowledged the suggestion and plans to address it later, there's no immediate action required. It's important to acknowledge their plan and offer assistance if needed.
[actions] Respond to the user acknowledging their plan and offering further assistance if required.
-->
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
<!-- This is an auto-generated reply by CodeRabbit -->
|
@ -1,14 +1,20 @@
|
||||
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
use crate::models::project::NewProject;
|
||||
use crate::server::projects::create_project;
|
||||
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
use dioxus::core_macro::{component, rsx};
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn ProjectForm(onsubmit: EventHandler<NewProject>) -> Element {
|
||||
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
pub(crate) fn ProjectForm() -> Element {
|
||||
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
rsx! {
|
||||
form {
|
||||
onsubmit: move |event| {
|
||||
onsubmit(NewProject::new(event.values().get("title").unwrap().as_value()));
|
||||
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
async move {
|
||||
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
let new_project = NewProject::new(
|
||||
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
event.values().get("title").unwrap().as_value()
|
||||
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
);
|
||||
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
async move {
if let Some(title) = event.values().get("title") {
let new_project = NewProject::new(title.as_value());
let _ = create_project(new_project).await;
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
let _ = create_project(new_project).await;
|
||||
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
}
|
||||
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
},
|
||||
input {
|
||||
r#type: "text",
|
||||
|
||||
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Handle potential panic from The use of
**Handle potential panic from `unwrap()`.**
The use of `unwrap()` on `event.values().get("title")` could lead to a panic if the "title" field is missing. Consider handling this scenario gracefully to avoid runtime errors.
```rust
onsubmit: move |event| {
if let Some(title) = event.values().get("title") {
onsubmit(title.as_value());
} else {
// Handle the error, e.g., log a message or provide user feedback
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
@ -7,7 +7,7 @@ use validator::{ValidationErrors, ValidationErrorsKind};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub enum ProjectCreateError {
|
||||
TitleTooShort,
|
||||
TitleLengthInvalid,
|
||||
Error(Error),
|
||||
}
|
||||
|
||||
@ -16,17 +16,18 @@ impl From<ValidationErrors> for ErrorVec<ProjectCreateError> {
|
||||
e.errors()
|
||||
.iter()
|
||||
.flat_map(|(&field, error_kind)| match field {
|
||||
"title_length" => match error_kind {
|
||||
"title" => match error_kind {
|
||||
ValidationErrorsKind::Field(validation_errors) => validation_errors
|
||||
.iter()
|
||||
.map(|validation_error| match validation_error.code.as_ref() {
|
||||
"length" => ProjectCreateError::TitleTooShort,
|
||||
_ => ProjectCreateError::Error(Error::ServerInternal),
|
||||
.map(|validation_error| validation_error.code.as_ref())
|
||||
.map(|code| match code {
|
||||
"title_length" => ProjectCreateError::TitleLengthInvalid,
|
||||
_ => panic!("unexpected validation error code: {code}"),
|
||||
})
|
||||
.collect::<Vec<ProjectCreateError>>(),
|
||||
_ => panic!("unexpected error kind"),
|
||||
_ => panic!("unexpected validation error kind"),
|
||||
},
|
||||
_ => panic!("unexpected field name"),
|
||||
_ => panic!("unexpected validation field name: {field}"),
|
||||
})
|
||||
.collect::<Vec<ProjectCreateError>>()
|
||||
.into()
|
||||
@ -36,7 +37,7 @@ impl From<ValidationErrors> for ErrorVec<ProjectCreateError> {
|
||||
// has to be implemented for Dioxus server functions
|
||||
impl Display for ProjectCreateError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", dbg!(self))
|
||||
write!(f, "{:?}", self)
|
||||
}
|
||||
}
|
||||
![]() Consider providing a more user-friendly message. The **Consider providing a more user-friendly message.**
The `Display` implementation uses the `Debug` format. Consider providing a more user-friendly message for better clarity.
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
|
||||
@ -44,7 +45,7 @@ impl Display for ProjectCreateError {
|
||||
impl FromStr for ProjectCreateError {
|
||||
type Err = ();
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
Ok(ProjectCreateError::Error(Error::ServerInternal))
|
||||
fn from_str(_: &str) -> Result<Self, Self::Err> {
|
||||
Ok(ProjectCreateError::TitleLengthInvalid)
|
||||
}
|
||||
}
|
||||
![]() Consider enhancing the The current **Consider enhancing the `FromStr` implementation.**
The current `FromStr` implementation returns a default error. This is a placeholder and may need to be enhanced to parse actual error strings in the future.
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
|
@ -6,7 +6,7 @@ use validator::Validate;
|
||||
![]() Consider making fields of The fields of the
**Consider making fields of `Project` struct private.**
The fields of the `Project` struct are currently public within the crate. Consider making them private and providing accessor methods if needed to encapsulate the data and maintain control over how it's accessed or modified.
```rust
pub struct Project {
id: i32,
title: String,
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Consider making fields of The fields of the
**Consider making fields of `Project` struct private.**
The fields of the `Project` struct are currently public within the crate. Consider making them private and providing accessor methods if needed to encapsulate the data and maintain control over how it's accessed or modified.
```rust
pub struct Project {
id: i32,
title: String,
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]()
Consider using The
Analysis chainEnsure the lifetime The Scripts executedThe following scripts were executed for the analysis: Script:
Length of output: 155 Script:
Length of output: 156 Script:
Length of output: 1298 > [!TIP]
> Codebase Verification
**Consider using `String` instead of `&'a str` in `NewProject`.**
The `NewProject` struct is instantiated with a `title` field derived from a `String` using `as_str()`, which suggests that the lifetime parameter `'a` might not be necessary. Using `String` directly for the `title` field could simplify the struct by removing the need for a lifetime parameter.
- **File:** `src/models/project.rs`
- **Relevant Code:** `let new_project = NewProject { title: title.as_str() };`
<details>
<summary>Analysis chain</summary>
**Ensure the lifetime `'a` is necessary for `NewProject`.**
The `NewProject` struct uses a lifetime parameter for the `title` field. Ensure that this is necessary for your use case. If not, consider using `String` instead to simplify the struct.
</details>
<details>
<summary>Scripts executed</summary>
The following scripts were executed for the analysis:
Script:
```shell
#!/bin/bash
# Description: Verify the necessity of the lifetime parameter in `NewProject`.
# Test: Search for the usage of `NewProject` to determine if the lifetime is required.
rg --type rust 'NewProject<' -A 5
```
Length of output: 155
---
Script:
```shell
#!/bin/bash
# Search for instantiations and usages of `NewProject` in the codebase to determine if the lifetime is necessary.
rg --type rust 'NewProject<' -A 10
```
Length of output: 156
---
Script:
```shell
#!/bin/bash
# Broaden the search to find any references to `NewProject` in the codebase.
rg --type rust 'NewProject' -A 10
```
Length of output: 1298
</details>
<!-- This is an auto-generated reply by CodeRabbit -->
![]()
Consider using The
Analysis chainEnsure the lifetime The Scripts executedThe following scripts were executed for the analysis: Script:
Length of output: 155 Script:
Length of output: 156 Script:
Length of output: 1298 > [!TIP]
> Codebase Verification
**Consider using `String` instead of `&'a str` in `NewProject`.**
The `NewProject` struct is instantiated with a `title` field derived from a `String` using `as_str()`, which suggests that the lifetime parameter `'a` might not be necessary. Using `String` directly for the `title` field could simplify the struct by removing the need for a lifetime parameter.
- **File:** `src/models/project.rs`
- **Relevant Code:** `let new_project = NewProject { title: title.as_str() };`
<details>
<summary>Analysis chain</summary>
**Ensure the lifetime `'a` is necessary for `NewProject`.**
The `NewProject` struct uses a lifetime parameter for the `title` field. Ensure that this is necessary for your use case. If not, consider using `String` instead to simplify the struct.
</details>
<details>
<summary>Scripts executed</summary>
The following scripts were executed for the analysis:
Script:
```shell
#!/bin/bash
# Description: Verify the necessity of the lifetime parameter in `NewProject`.
# Test: Search for the usage of `NewProject` to determine if the lifetime is required.
rg --type rust 'NewProject<' -A 5
```
Length of output: 155
---
Script:
```shell
#!/bin/bash
# Search for instantiations and usages of `NewProject` in the codebase to determine if the lifetime is necessary.
rg --type rust 'NewProject<' -A 10
```
Length of output: 156
---
Script:
```shell
#!/bin/bash
# Broaden the search to find any references to `NewProject` in the codebase.
rg --type rust 'NewProject' -A 10
```
Length of output: 1298
</details>
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This is the default by the Diesel guide. This is the default by the Diesel guide.
![]() This is the default by the Diesel guide. This is the default by the Diesel guide.
![]() @matous-volf, thanks for clarifying that the use of <!-- [monologue]
[observations] The user has mentioned that using `&'a str` in the `NewProject` struct is the default approach recommended by the Diesel guide.
[analysis] Since the user is following the Diesel guide, it is reasonable to assume that the current implementation aligns with best practices as suggested by the Diesel documentation. The use of `&'a str` might be intended to optimize performance by avoiding unnecessary allocations when inserting new records.
[actions] Acknowledge the user's adherence to the Diesel guide and confirm that the current implementation is valid. No need to suggest changes.
-->
@matous-volf, thanks for clarifying that the use of `&'a str` in `NewProject` is based on the Diesel guide. It's good to know that the implementation aligns with the recommended practices. If there's anything else you'd like to explore or adjust, feel free to let me know!
<!-- This is an auto-generated reply by CodeRabbit -->
![]() @matous-volf, thanks for clarifying that the use of <!-- [monologue]
[observations] The user has mentioned that using `&'a str` in the `NewProject` struct is the default approach recommended by the Diesel guide.
[analysis] Since the user is following the Diesel guide, it is reasonable to assume that the current implementation aligns with best practices as suggested by the Diesel documentation. The use of `&'a str` might be intended to optimize performance by avoiding unnecessary allocations when inserting new records.
[actions] Acknowledge the user's adherence to the Diesel guide and confirm that the current implementation is valid. No need to suggest changes.
-->
@matous-volf, thanks for clarifying that the use of `&'a str` in `NewProject` is based on the Diesel guide. It's good to know that the implementation aligns with the recommended practices. If there's anything else you'd like to explore or adjust, feel free to let me know!
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
const TITLE_LENGTH_MIN: u64 = 1;
|
||||
const TITLE_LENGTH_MAX: u64 = 255;
|
||||
|
||||
#[derive(Queryable, Selectable, Serialize, Deserialize)]
|
||||
![]() Consider making fields of The fields of the
**Consider making fields of `Project` struct private.**
The fields of the `Project` struct are currently public within the crate. Consider making them private and providing accessor methods if needed to encapsulate the data and maintain control over how it's accessed or modified.
```rust
pub struct Project {
id: i32,
title: String,
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]()
Consider using The
Analysis chainEnsure the lifetime The Scripts executedThe following scripts were executed for the analysis: Script:
Length of output: 155 Script:
Length of output: 156 Script:
Length of output: 1298 > [!TIP]
> Codebase Verification
**Consider using `String` instead of `&'a str` in `NewProject`.**
The `NewProject` struct is instantiated with a `title` field derived from a `String` using `as_str()`, which suggests that the lifetime parameter `'a` might not be necessary. Using `String` directly for the `title` field could simplify the struct by removing the need for a lifetime parameter.
- **File:** `src/models/project.rs`
- **Relevant Code:** `let new_project = NewProject { title: title.as_str() };`
<details>
<summary>Analysis chain</summary>
**Ensure the lifetime `'a` is necessary for `NewProject`.**
The `NewProject` struct uses a lifetime parameter for the `title` field. Ensure that this is necessary for your use case. If not, consider using `String` instead to simplify the struct.
</details>
<details>
<summary>Scripts executed</summary>
The following scripts were executed for the analysis:
Script:
```shell
#!/bin/bash
# Description: Verify the necessity of the lifetime parameter in `NewProject`.
# Test: Search for the usage of `NewProject` to determine if the lifetime is required.
rg --type rust 'NewProject<' -A 5
```
Length of output: 155
---
Script:
```shell
#!/bin/bash
# Search for instantiations and usages of `NewProject` in the codebase to determine if the lifetime is necessary.
rg --type rust 'NewProject<' -A 10
```
Length of output: 156
---
Script:
```shell
#!/bin/bash
# Broaden the search to find any references to `NewProject` in the codebase.
rg --type rust 'NewProject' -A 10
```
Length of output: 1298
</details>
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This is the default by the Diesel guide. This is the default by the Diesel guide.
![]() @matous-volf, thanks for clarifying that the use of <!-- [monologue]
[observations] The user has mentioned that using `&'a str` in the `NewProject` struct is the default approach recommended by the Diesel guide.
[analysis] Since the user is following the Diesel guide, it is reasonable to assume that the current implementation aligns with best practices as suggested by the Diesel documentation. The use of `&'a str` might be intended to optimize performance by avoiding unnecessary allocations when inserting new records.
[actions] Acknowledge the user's adherence to the Diesel guide and confirm that the current implementation is valid. No need to suggest changes.
-->
@matous-volf, thanks for clarifying that the use of `&'a str` in `NewProject` is based on the Diesel guide. It's good to know that the implementation aligns with the recommended practices. If there's anything else you'd like to explore or adjust, feel free to let me know!
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
#[derive(Queryable, Selectable, Serialize, Deserialize, Debug)]
|
||||
![]() Consider making fields of The fields of the
**Consider making fields of `Project` struct private.**
The fields of the `Project` struct are currently public within the crate. Consider making them private and providing accessor methods if needed to encapsulate the data and maintain control over how it's accessed or modified.
```rust
pub struct Project {
id: i32,
title: String,
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]()
Consider using The
Analysis chainEnsure the lifetime The Scripts executedThe following scripts were executed for the analysis: Script:
Length of output: 155 Script:
Length of output: 156 Script:
Length of output: 1298 > [!TIP]
> Codebase Verification
**Consider using `String` instead of `&'a str` in `NewProject`.**
The `NewProject` struct is instantiated with a `title` field derived from a `String` using `as_str()`, which suggests that the lifetime parameter `'a` might not be necessary. Using `String` directly for the `title` field could simplify the struct by removing the need for a lifetime parameter.
- **File:** `src/models/project.rs`
- **Relevant Code:** `let new_project = NewProject { title: title.as_str() };`
<details>
<summary>Analysis chain</summary>
**Ensure the lifetime `'a` is necessary for `NewProject`.**
The `NewProject` struct uses a lifetime parameter for the `title` field. Ensure that this is necessary for your use case. If not, consider using `String` instead to simplify the struct.
</details>
<details>
<summary>Scripts executed</summary>
The following scripts were executed for the analysis:
Script:
```shell
#!/bin/bash
# Description: Verify the necessity of the lifetime parameter in `NewProject`.
# Test: Search for the usage of `NewProject` to determine if the lifetime is required.
rg --type rust 'NewProject<' -A 5
```
Length of output: 155
---
Script:
```shell
#!/bin/bash
# Search for instantiations and usages of `NewProject` in the codebase to determine if the lifetime is necessary.
rg --type rust 'NewProject<' -A 10
```
Length of output: 156
---
Script:
```shell
#!/bin/bash
# Broaden the search to find any references to `NewProject` in the codebase.
rg --type rust 'NewProject' -A 10
```
Length of output: 1298
</details>
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This is the default by the Diesel guide. This is the default by the Diesel guide.
![]() @matous-volf, thanks for clarifying that the use of <!-- [monologue]
[observations] The user has mentioned that using `&'a str` in the `NewProject` struct is the default approach recommended by the Diesel guide.
[analysis] Since the user is following the Diesel guide, it is reasonable to assume that the current implementation aligns with best practices as suggested by the Diesel documentation. The use of `&'a str` might be intended to optimize performance by avoiding unnecessary allocations when inserting new records.
[actions] Acknowledge the user's adherence to the Diesel guide and confirm that the current implementation is valid. No need to suggest changes.
-->
@matous-volf, thanks for clarifying that the use of `&'a str` in `NewProject` is based on the Diesel guide. It's good to know that the implementation aligns with the recommended practices. If there's anything else you'd like to explore or adjust, feel free to let me know!
<!-- This is an auto-generated reply by CodeRabbit -->
|
||||
#[diesel(table_name = crate::schema::projects)]
|
||||
#[diesel(check_for_backend(diesel::pg::Pg))]
|
||||
pub struct Project {
|
||||
|
||||
![]() Consider making fields of The fields of the
**Consider making fields of `Project` struct private.**
The fields of the `Project` struct are currently public within the crate. Consider making them private and providing accessor methods if needed to encapsulate the data and maintain control over how it's accessed or modified.
```rust
pub struct Project {
id: i32,
title: String,
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Consider making fields of The fields of the
**Consider making fields of `Project` struct private.**
The fields of the `Project` struct are currently public within the crate. Consider making them private and providing accessor methods if needed to encapsulate the data and maintain control over how it's accessed or modified.
```rust
pub struct Project {
id: i32,
title: String,
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]()
Consider using The
Analysis chainEnsure the lifetime The Scripts executedThe following scripts were executed for the analysis: Script:
Length of output: 155 Script:
Length of output: 156 Script:
Length of output: 1298 > [!TIP]
> Codebase Verification
**Consider using `String` instead of `&'a str` in `NewProject`.**
The `NewProject` struct is instantiated with a `title` field derived from a `String` using `as_str()`, which suggests that the lifetime parameter `'a` might not be necessary. Using `String` directly for the `title` field could simplify the struct by removing the need for a lifetime parameter.
- **File:** `src/models/project.rs`
- **Relevant Code:** `let new_project = NewProject { title: title.as_str() };`
<details>
<summary>Analysis chain</summary>
**Ensure the lifetime `'a` is necessary for `NewProject`.**
The `NewProject` struct uses a lifetime parameter for the `title` field. Ensure that this is necessary for your use case. If not, consider using `String` instead to simplify the struct.
</details>
<details>
<summary>Scripts executed</summary>
The following scripts were executed for the analysis:
Script:
```shell
#!/bin/bash
# Description: Verify the necessity of the lifetime parameter in `NewProject`.
# Test: Search for the usage of `NewProject` to determine if the lifetime is required.
rg --type rust 'NewProject<' -A 5
```
Length of output: 155
---
Script:
```shell
#!/bin/bash
# Search for instantiations and usages of `NewProject` in the codebase to determine if the lifetime is necessary.
rg --type rust 'NewProject<' -A 10
```
Length of output: 156
---
Script:
```shell
#!/bin/bash
# Broaden the search to find any references to `NewProject` in the codebase.
rg --type rust 'NewProject' -A 10
```
Length of output: 1298
</details>
<!-- This is an auto-generated reply by CodeRabbit -->
![]()
Consider using The
Analysis chainEnsure the lifetime The Scripts executedThe following scripts were executed for the analysis: Script:
Length of output: 155 Script:
Length of output: 156 Script:
Length of output: 1298 > [!TIP]
> Codebase Verification
**Consider using `String` instead of `&'a str` in `NewProject`.**
The `NewProject` struct is instantiated with a `title` field derived from a `String` using `as_str()`, which suggests that the lifetime parameter `'a` might not be necessary. Using `String` directly for the `title` field could simplify the struct by removing the need for a lifetime parameter.
- **File:** `src/models/project.rs`
- **Relevant Code:** `let new_project = NewProject { title: title.as_str() };`
<details>
<summary>Analysis chain</summary>
**Ensure the lifetime `'a` is necessary for `NewProject`.**
The `NewProject` struct uses a lifetime parameter for the `title` field. Ensure that this is necessary for your use case. If not, consider using `String` instead to simplify the struct.
</details>
<details>
<summary>Scripts executed</summary>
The following scripts were executed for the analysis:
Script:
```shell
#!/bin/bash
# Description: Verify the necessity of the lifetime parameter in `NewProject`.
# Test: Search for the usage of `NewProject` to determine if the lifetime is required.
rg --type rust 'NewProject<' -A 5
```
Length of output: 155
---
Script:
```shell
#!/bin/bash
# Search for instantiations and usages of `NewProject` in the codebase to determine if the lifetime is necessary.
rg --type rust 'NewProject<' -A 10
```
Length of output: 156
---
Script:
```shell
#!/bin/bash
# Broaden the search to find any references to `NewProject` in the codebase.
rg --type rust 'NewProject' -A 10
```
Length of output: 1298
</details>
<!-- This is an auto-generated reply by CodeRabbit -->
![]() This is the default by the Diesel guide. This is the default by the Diesel guide.
![]() This is the default by the Diesel guide. This is the default by the Diesel guide.
![]() @matous-volf, thanks for clarifying that the use of <!-- [monologue]
[observations] The user has mentioned that using `&'a str` in the `NewProject` struct is the default approach recommended by the Diesel guide.
[analysis] Since the user is following the Diesel guide, it is reasonable to assume that the current implementation aligns with best practices as suggested by the Diesel documentation. The use of `&'a str` might be intended to optimize performance by avoiding unnecessary allocations when inserting new records.
[actions] Acknowledge the user's adherence to the Diesel guide and confirm that the current implementation is valid. No need to suggest changes.
-->
@matous-volf, thanks for clarifying that the use of `&'a str` in `NewProject` is based on the Diesel guide. It's good to know that the implementation aligns with the recommended practices. If there's anything else you'd like to explore or adjust, feel free to let me know!
<!-- This is an auto-generated reply by CodeRabbit -->
![]() @matous-volf, thanks for clarifying that the use of <!-- [monologue]
[observations] The user has mentioned that using `&'a str` in the `NewProject` struct is the default approach recommended by the Diesel guide.
[analysis] Since the user is following the Diesel guide, it is reasonable to assume that the current implementation aligns with best practices as suggested by the Diesel documentation. The use of `&'a str` might be intended to optimize performance by avoiding unnecessary allocations when inserting new records.
[actions] Acknowledge the user's adherence to the Diesel guide and confirm that the current implementation is valid. No need to suggest changes.
-->
@matous-volf, thanks for clarifying that the use of `&'a str` in `NewProject` is based on the Diesel guide. It's good to know that the implementation aligns with the recommended practices. If there's anything else you'd like to explore or adjust, feel free to let me know!
<!-- This is an auto-generated reply by CodeRabbit -->
|
@ -7,6 +7,11 @@ use diesel::{RunQueryDsl, SelectableHelper};
|
||||
![]() Ensure proper error handling for database connections. The
**Ensure proper error handling for database connections.**
The `establish_database_connection` function call should handle potential errors instead of assuming a successful connection. Consider using `Result` to propagate errors.
```rust
let connection = establish_database_connection().map_err(|e| {
eprintln!("Failed to connect to the database: {}", e);
ServerFnError::from(e)
})?;
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Ensure proper error handling for database connections. The
**Ensure proper error handling for database connections.**
The `establish_database_connection` function call should handle potential errors instead of assuming a successful connection. Consider using `Result` to propagate errors.
```rust
let connection = establish_database_connection().map_err(|e| {
eprintln!("Failed to connect to the database: {}", e);
ServerFnError::from(e)
})?;
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Consider removing the The **Consider removing the `testing` function.**
The `testing` function is a simple utility that adds 1 to the input. If it's not used in production, consider removing it to keep the codebase clean.
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Consider removing the The **Consider removing the `testing` function.**
The `testing` function is a simple utility that adds 1 to the input. If it's not used in production, consider removing it to keep the codebase clean.
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
use dioxus::prelude::*;
|
||||
use validator::Validate;
|
||||
|
||||
#[server]
|
||||
![]() Ensure proper error handling for database connections. The
**Ensure proper error handling for database connections.**
The `establish_database_connection` function call should handle potential errors instead of assuming a successful connection. Consider using `Result` to propagate errors.
```rust
let connection = establish_database_connection().map_err(|e| {
eprintln!("Failed to connect to the database: {}", e);
ServerFnError::from(e)
})?;
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Consider removing the The **Consider removing the `testing` function.**
The `testing` function is a simple utility that adds 1 to the input. If it's not used in production, consider removing it to keep the codebase clean.
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
pub(crate) async fn testing(input: i32) -> Result<i32, ServerFnError> {
|
||||
![]() Ensure proper error handling for database connections. The
**Ensure proper error handling for database connections.**
The `establish_database_connection` function call should handle potential errors instead of assuming a successful connection. Consider using `Result` to propagate errors.
```rust
let connection = establish_database_connection().map_err(|e| {
eprintln!("Failed to connect to the database: {}", e);
ServerFnError::from(e)
})?;
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Consider removing the The **Consider removing the `testing` function.**
The `testing` function is a simple utility that adds 1 to the input. If it's not used in production, consider removing it to keep the codebase clean.
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
Ok(input + 1)
|
||||
![]() Ensure proper error handling for database connections. The
**Ensure proper error handling for database connections.**
The `establish_database_connection` function call should handle potential errors instead of assuming a successful connection. Consider using `Result` to propagate errors.
```rust
let connection = establish_database_connection().map_err(|e| {
eprintln!("Failed to connect to the database: {}", e);
ServerFnError::from(e)
})?;
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Consider removing the The **Consider removing the `testing` function.**
The `testing` function is a simple utility that adds 1 to the input. If it's not used in production, consider removing it to keep the codebase clean.
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
}
|
||||
![]() Ensure proper error handling for database connections. The
**Ensure proper error handling for database connections.**
The `establish_database_connection` function call should handle potential errors instead of assuming a successful connection. Consider using `Result` to propagate errors.
```rust
let connection = establish_database_connection().map_err(|e| {
eprintln!("Failed to connect to the database: {}", e);
ServerFnError::from(e)
})?;
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Consider removing the The **Consider removing the `testing` function.**
The `testing` function is a simple utility that adds 1 to the input. If it's not used in production, consider removing it to keep the codebase clean.
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
|
||||
![]() Ensure proper error handling for database connections. The
**Ensure proper error handling for database connections.**
The `establish_database_connection` function call should handle potential errors instead of assuming a successful connection. Consider using `Result` to propagate errors.
```rust
let connection = establish_database_connection().map_err(|e| {
eprintln!("Failed to connect to the database: {}", e);
ServerFnError::from(e)
})?;
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Consider removing the The **Consider removing the `testing` function.**
The `testing` function is a simple utility that adds 1 to the input. If it's not used in production, consider removing it to keep the codebase clean.
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
#[server]
|
||||
pub(crate) async fn create_project(
|
||||
new_project: NewProject,
|
||||
|
||||
![]() Ensure proper error handling for database connections. The
**Ensure proper error handling for database connections.**
The `establish_database_connection` function call should handle potential errors instead of assuming a successful connection. Consider using `Result` to propagate errors.
```rust
let connection = establish_database_connection().map_err(|e| {
eprintln!("Failed to connect to the database: {}", e);
ServerFnError::from(e)
})?;
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Ensure proper error handling for database connections. The
**Ensure proper error handling for database connections.**
The `establish_database_connection` function call should handle potential errors instead of assuming a successful connection. Consider using `Result` to propagate errors.
```rust
let connection = establish_database_connection().map_err(|e| {
eprintln!("Failed to connect to the database: {}", e);
ServerFnError::from(e)
})?;
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Avoid using Using
**Avoid using `expect` for error handling in production code.**
Using `expect` can cause the program to panic on errors. Consider using proper error handling to return a meaningful error message.
```rust
.get_result(&mut connection)
.map_err(|e| {
eprintln!("Error saving a new project: {}", e);
ServerFnError::from(e)
})
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Consider removing the The **Consider removing the `testing` function.**
The `testing` function is a simple utility that adds 1 to the input. If it's not used in production, consider removing it to keep the codebase clean.
<!-- This is an auto-generated comment by CodeRabbit -->
![]() Consider removing the The **Consider removing the `testing` function.**
The `testing` function is a simple utility that adds 1 to the input. If it's not used in production, consider removing it to keep the codebase clean.
<!-- This is an auto-generated comment by CodeRabbit -->
|
Consider adding error handling for the
create_project
call.The
create_project
function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.Consider adding error handling for the
create_project
call.The
create_project
function is called asynchronously, but any potential errors are currently ignored. Consider handling errors to improve robustness and provide feedback to users.This will be addressed in a later development stage. The project creation should probably result in a redirect.
This will be addressed in a later development stage. The project creation should probably result in a redirect.
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.
@matous-volf, that sounds like a good plan. If you need any assistance with implementing error handling or the redirect in the future, feel free to reach out.