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.
This commit is contained in:
Mathis H (Avnyr) 2024-10-08 14:00:04 +02:00
parent 3844153340
commit 64f9cd497f
Signed by: Mathis
GPG Key ID: DD9E0666A747D126

View File

@ -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,
);
}
}