style: formatting
This commit is contained in:
		| @@ -51,7 +51,7 @@ pub(crate) async fn get_projects() | ||||
|  | ||||
| #[server] | ||||
| pub(crate) async fn edit_project(project_id: i32, new_project: NewProject) | ||||
|     -> Result<Project, ServerFnError<ErrorVec<ProjectError>>> { | ||||
|                                  -> Result<Project, ServerFnError<ErrorVec<ProjectError>>> { | ||||
|     use crate::schema::projects::dsl::*; | ||||
|  | ||||
|     new_project.validate() | ||||
| @@ -72,16 +72,19 @@ pub(crate) async fn edit_project(project_id: i32, new_project: NewProject) | ||||
|     Ok(updated_project) | ||||
| } | ||||
|  | ||||
| // TODO: Get rid of this suppression. | ||||
| //noinspection DuplicatedCode | ||||
| #[server] | ||||
| pub(crate) async fn delete_project(project_id: i32) | ||||
|     -> Result<(), ServerFnError<ErrorVec<Error>>> { | ||||
|                                    -> Result<(), ServerFnError<ErrorVec<Error>>> { | ||||
|     use crate::schema::projects::dsl::*; | ||||
|  | ||||
|     let mut connection = establish_database_connection() | ||||
|         .map_err::<ErrorVec<Error>, _>(|_| vec![Error::ServerInternal].into())?; | ||||
|  | ||||
|      | ||||
|     diesel::delete(projects.filter(id.eq(project_id))).execute(&mut connection) | ||||
|         .map_err::<ErrorVec<Error>, _>(|error| vec![error.into()].into())?; | ||||
|      | ||||
|  | ||||
|     Ok(()) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user