refactor(backend): drop redundant LoftError from Result return types
This commit is contained in:
@@ -27,7 +27,7 @@ async fn upload_file(
|
||||
State(file_repository): State<FileRepository>,
|
||||
ctx: Ctx,
|
||||
mut multipart: Multipart,
|
||||
) -> Result<Json<FileRecord>, LoftError> {
|
||||
) -> Result<Json<FileRecord>> {
|
||||
let mut uploaded: Option<(String, String, usize)> = None;
|
||||
|
||||
while let Some(field) = multipart.next_field().await? {
|
||||
@@ -52,7 +52,7 @@ async fn get_file(
|
||||
State(file_repository): State<FileRepository>,
|
||||
ctx: Ctx,
|
||||
Path(file_id): Path<u64>,
|
||||
) -> Result<Json<FileRecord>, LoftError> {
|
||||
) -> Result<Json<FileRecord>> {
|
||||
let record = file_repository
|
||||
.get_file(file_id as i64, ctx.user_id())
|
||||
.await?;
|
||||
@@ -121,7 +121,7 @@ async fn delete_file(
|
||||
State(file_repository): State<FileRepository>,
|
||||
ctx: Ctx,
|
||||
Path(file_id): Path<u64>,
|
||||
) -> Result<Json<FileRecord>, LoftError> {
|
||||
) -> Result<Json<FileRecord>> {
|
||||
let file = file_repository
|
||||
.delete_file(file_id as i64, ctx.user_id())
|
||||
.await?;
|
||||
@@ -131,7 +131,7 @@ async fn delete_file(
|
||||
async fn list_files(
|
||||
State(file_repository): State<FileRepository>,
|
||||
ctx: Ctx,
|
||||
) -> Result<Json<Vec<FileRecord>>, LoftError> {
|
||||
) -> Result<Json<Vec<FileRecord>>> {
|
||||
let files = file_repository.list_files(ctx.user_id()).await?;
|
||||
Ok(Json(files))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user