Refactor response return statements in files controller
Reformat the return statements for better readability and consistency. The changes ensure that the status codes and response body are returned in a clearer and more maintainable format.
This commit is contained in:
parent
392446fa06
commit
fd1742e9dc
@ -77,24 +77,30 @@ export class FilesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log("Executing save procedure...");
|
console.log("Executing save procedure...");
|
||||||
return res
|
return (
|
||||||
// @ts-ignore
|
res
|
||||||
.status(HttpStatus.CREATED)
|
// @ts-ignore
|
||||||
.send(await this.filesService.save(fileBuffer, Params));
|
.status(HttpStatus.CREATED)
|
||||||
|
.send(await this.filesService.save(fileBuffer, Params))
|
||||||
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return res
|
return (
|
||||||
// @ts-ignore
|
res
|
||||||
.status(err.status || HttpStatus.INTERNAL_SERVER_ERROR)
|
// @ts-ignore
|
||||||
.send(err);
|
.status(err.status || HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
|
.send(err)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
req.on("error", (err) => {
|
req.on("error", (err) => {
|
||||||
return res
|
return (
|
||||||
// @ts-ignore
|
res
|
||||||
.status(err.status || HttpStatus.INTERNAL_SERVER_ERROR)
|
// @ts-ignore
|
||||||
.send(err);
|
.status(err.status || HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
|
.send(err)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -107,7 +113,7 @@ export class FilesController {
|
|||||||
@Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number,
|
@Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number,
|
||||||
@Query("search", new DefaultValuePipe("")) search: string,
|
@Query("search", new DefaultValuePipe("")) search: string,
|
||||||
) {
|
) {
|
||||||
return this.filesService.search(limit, offset, search)
|
return this.filesService.search(limit, offset, search);
|
||||||
}
|
}
|
||||||
|
|
||||||
@HttpCode(HttpStatus.FOUND)
|
@HttpCode(HttpStatus.FOUND)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user