feat: ability to create a project #9

Merged
matous-volf merged 50 commits from feat/project-create into main 2024-08-18 21:36:06 +00:00
Showing only changes of commit 6c95d36361 - Show all commits

View File

@ -7,11 +7,6 @@ use diesel::{RunQueryDsl, SelectableHelper};
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

let connection = establish_database_connection().map_err(|e| {
    eprintln!("Failed to connect to the database: {}", e);
    ServerFnError::from(e)
})?;
**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 -->
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

let connection = establish_database_connection().map_err(|e| {
    eprintln!("Failed to connect to the database: {}", e);
    ServerFnError::from(e)
})?;
**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 -->
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 19:24:13 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 19:24:13 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 20:12:41 +00:00 (Migrated from github.com)
Review

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.

**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 -->
coderabbitai[bot] commented 2024-08-18 20:12:41 +00:00 (Migrated from github.com)
Review

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.

**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]
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

let connection = establish_database_connection().map_err(|e| {
    eprintln!("Failed to connect to the database: {}", e);
    ServerFnError::from(e)
})?;
**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 -->
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 19:24:13 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 20:12:41 +00:00 (Migrated from github.com)
Review

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.

**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> {
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

let connection = establish_database_connection().map_err(|e| {
    eprintln!("Failed to connect to the database: {}", e);
    ServerFnError::from(e)
})?;
**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 -->
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 19:24:13 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 20:12:41 +00:00 (Migrated from github.com)
Review

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.

**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)
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

let connection = establish_database_connection().map_err(|e| {
    eprintln!("Failed to connect to the database: {}", e);
    ServerFnError::from(e)
})?;
**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 -->
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 19:24:13 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 20:12:41 +00:00 (Migrated from github.com)
Review

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.

**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 -->
}
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

let connection = establish_database_connection().map_err(|e| {
    eprintln!("Failed to connect to the database: {}", e);
    ServerFnError::from(e)
})?;
**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 -->
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 19:24:13 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 20:12:41 +00:00 (Migrated from github.com)
Review

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.

**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 -->
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

let connection = establish_database_connection().map_err(|e| {
    eprintln!("Failed to connect to the database: {}", e);
    ServerFnError::from(e)
})?;
**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 -->
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 19:24:13 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 20:12:41 +00:00 (Migrated from github.com)
Review

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.

**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,

coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

let connection = establish_database_connection().map_err(|e| {
    eprintln!("Failed to connect to the database: {}", e);
    ServerFnError::from(e)
})?;
**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 -->
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

let connection = establish_database_connection().map_err(|e| {
    eprintln!("Failed to connect to the database: {}", e);
    ServerFnError::from(e)
})?;
**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 -->
coderabbitai[bot] commented 2024-08-16 22:39:19 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 19:24:13 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 19:24:13 +00:00 (Migrated from github.com)
Review

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.

.get_result(&mut connection)
.map_err(|e| {
    eprintln!("Error saving a new project: {}", e);
    ServerFnError::from(e)
})
**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 -->
coderabbitai[bot] commented 2024-08-18 20:12:41 +00:00 (Migrated from github.com)
Review

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.

**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 -->
coderabbitai[bot] commented 2024-08-18 20:12:41 +00:00 (Migrated from github.com)
Review

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.

**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 -->