From fd1742e9dc57c1d9c2c44025e86ad63c8c6a24df Mon Sep 17 00:00:00 2001 From: Mathis Date: Tue, 8 Oct 2024 13:26:32 +0200 Subject: [PATCH] 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. --- .../backend/src/app/files/files.controller.ts | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/apps/backend/src/app/files/files.controller.ts b/apps/backend/src/app/files/files.controller.ts index 8dc62a2..ffaed1e 100644 --- a/apps/backend/src/app/files/files.controller.ts +++ b/apps/backend/src/app/files/files.controller.ts @@ -77,24 +77,30 @@ export class FilesController { } console.log("Executing save procedure..."); - return res - // @ts-ignore - .status(HttpStatus.CREATED) - .send(await this.filesService.save(fileBuffer, Params)); + return ( + res + // @ts-ignore + .status(HttpStatus.CREATED) + .send(await this.filesService.save(fileBuffer, Params)) + ); } catch (err) { console.error(err); - return res - // @ts-ignore - .status(err.status || HttpStatus.INTERNAL_SERVER_ERROR) - .send(err); + return ( + res + // @ts-ignore + .status(err.status || HttpStatus.INTERNAL_SERVER_ERROR) + .send(err) + ); } }); req.on("error", (err) => { - return res - // @ts-ignore - .status(err.status || HttpStatus.INTERNAL_SERVER_ERROR) - .send(err); + return ( + res + // @ts-ignore + .status(err.status || HttpStatus.INTERNAL_SERVER_ERROR) + .send(err) + ); }); return; @@ -107,7 +113,7 @@ export class FilesController { @Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number, @Query("search", new DefaultValuePipe("")) search: string, ) { - return this.filesService.search(limit, offset, search) + return this.filesService.search(limit, offset, search); } @HttpCode(HttpStatus.FOUND)