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:
parent
3844153340
commit
64f9cd497f
@ -3,6 +3,8 @@ import {
|
|||||||
DefaultValuePipe,
|
DefaultValuePipe,
|
||||||
Delete,
|
Delete,
|
||||||
Get,
|
Get,
|
||||||
|
HttpCode,
|
||||||
|
HttpStatus,
|
||||||
Param,
|
Param,
|
||||||
ParseBoolPipe,
|
ParseBoolPipe,
|
||||||
ParseIntPipe,
|
ParseIntPipe,
|
||||||
@ -37,11 +39,19 @@ export class MachinesController {
|
|||||||
|
|
||||||
//TODO CRUD fileType associated to machine
|
//TODO CRUD fileType associated to machine
|
||||||
|
|
||||||
|
@HttpCode(HttpStatus.OK)
|
||||||
@Get("files/:machineId")
|
@Get("files/:machineId")
|
||||||
async getFilesForMachine(
|
async getFilesForMachine(
|
||||||
@Query("limit", new DefaultValuePipe(20), ParseIntPipe) limit: number,
|
@Query("limit", new DefaultValuePipe(20), ParseIntPipe) limit: number,
|
||||||
@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,
|
||||||
@Param("machineId") machineId: string,
|
@Param("machineId") machineId: string,
|
||||||
) {}
|
) {
|
||||||
|
return this.machineService.findFilesForMachine(
|
||||||
|
limit,
|
||||||
|
offset,
|
||||||
|
search,
|
||||||
|
machineId,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user