From 64f9cd497fad43f765c11d3c6179ac02bf28c5e1 Mon Sep 17 00:00:00 2001 From: Mathis Date: Tue, 8 Oct 2024 14:00:04 +0200 Subject: [PATCH] Add HTTP status and implement file fetching Included HTTP status code for the getFilesForMachine method. Implemented the service call to fetch files associated with a machine. --- apps/backend/src/app/machines/machines.controller.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/backend/src/app/machines/machines.controller.ts b/apps/backend/src/app/machines/machines.controller.ts index e70fda9..c1856a7 100644 --- a/apps/backend/src/app/machines/machines.controller.ts +++ b/apps/backend/src/app/machines/machines.controller.ts @@ -3,6 +3,8 @@ import { DefaultValuePipe, Delete, Get, + HttpCode, + HttpStatus, Param, ParseBoolPipe, ParseIntPipe, @@ -37,11 +39,19 @@ export class MachinesController { //TODO CRUD fileType associated to machine + @HttpCode(HttpStatus.OK) @Get("files/:machineId") async getFilesForMachine( @Query("limit", new DefaultValuePipe(20), ParseIntPipe) limit: number, @Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number, @Query("search", new DefaultValuePipe("")) search: string, @Param("machineId") machineId: string, - ) {} + ) { + return this.machineService.findFilesForMachine( + limit, + offset, + search, + machineId, + ); + } }