style: formatting
This commit is contained in:
parent
823ae007e3
commit
7b635ea372
@ -63,8 +63,10 @@ pub struct NewTask {
|
|||||||
|
|
||||||
impl NewTask {
|
impl NewTask {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
title: String, deadline: Option<chrono::NaiveDate>,
|
title: String,
|
||||||
category: Category, project_id: Option<i32>,
|
deadline: Option<chrono::NaiveDate>,
|
||||||
|
category: Category,
|
||||||
|
project_id: Option<i32>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self { title, deadline, category, project_id }
|
Self { title, deadline, category, project_id }
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,8 @@ pub(crate) async fn edit_project(project_id: i32, new_project: NewProject)
|
|||||||
Ok(updated_project)
|
Ok(updated_project)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Get rid of this suppression.
|
||||||
|
//noinspection DuplicatedCode
|
||||||
#[server]
|
#[server]
|
||||||
pub(crate) async fn delete_project(project_id: i32)
|
pub(crate) async fn delete_project(project_id: i32)
|
||||||
-> Result<(), ServerFnError<ErrorVec<Error>>> {
|
-> Result<(), ServerFnError<ErrorVec<Error>>> {
|
||||||
@ -80,6 +82,7 @@ pub(crate) async fn delete_project(project_id: i32)
|
|||||||
let mut connection = establish_database_connection()
|
let mut connection = establish_database_connection()
|
||||||
.map_err::<ErrorVec<Error>, _>(|_| vec![Error::ServerInternal].into())?;
|
.map_err::<ErrorVec<Error>, _>(|_| vec![Error::ServerInternal].into())?;
|
||||||
|
|
||||||
|
|
||||||
diesel::delete(projects.filter(id.eq(project_id))).execute(&mut connection)
|
diesel::delete(projects.filter(id.eq(project_id))).execute(&mut connection)
|
||||||
.map_err::<ErrorVec<Error>, _>(|error| vec![error.into()].into())?;
|
.map_err::<ErrorVec<Error>, _>(|error| vec![error.into()].into())?;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user