feat: ability to create a task #14

Merged
matous-volf merged 12 commits from feat/task-create into main 2024-08-22 21:40:47 +00:00
Showing only changes of commit c4c1962de1 - Show all commits

View File

@ -24,7 +24,22 @@ pub(crate) async fn create_task(new_task: NewTask)
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
.values(&new_task) .values(&new_task)
.returning(Task::as_returning()) .returning(Task::as_returning())
.get_result(&mut connection) .get_result(&mut connection)
.unwrap(); .map_err::<ErrorVec<TaskCreateError>, _>(|error| {
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
let error = match error {
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
diesel::result::Error::DatabaseError(
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
diesel::result::DatabaseErrorKind::ForeignKeyViolation, info
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
) => {
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
match info.constraint_name() {
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
Some("tasks_project_id_fkey") => TaskCreateError::ProjectNotFound,
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
_ => TaskCreateError::Error(Error::ServerInternal)
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
}
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
},
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
_ => {
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
TaskCreateError::Error(Error::ServerInternal)
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
}
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
};
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
vec![error].into()
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
})?;
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
Ok(new_task) Ok(new_task)
} }

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

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2024-08-22 20:20:54 +00:00 (Migrated from github.com)
Review

Avoid using unwrap() for database operations.

Using unwrap() can lead to panics if the database operation fails. Consider handling the error with map_err or expect with a meaningful message.

Replace unwrap() with proper error handling to prevent potential panics.

**Avoid using `unwrap()` for database operations.** Using `unwrap()` can lead to panics if the database operation fails. Consider handling the error with `map_err` or `expect` with a meaningful message. Replace `unwrap()` with proper error handling to prevent potential panics. <!-- This is an auto-generated comment by CodeRabbit -->