59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
import {
|
|
Controller,
|
|
Get,
|
|
Post,
|
|
Body,
|
|
Patch,
|
|
Param,
|
|
Delete,
|
|
} from '@nestjs/common';
|
|
import { MachinesService } from './machines.service';
|
|
import {
|
|
CreateMachineDto,
|
|
UpdateMachineDto,
|
|
ReconfigureMachineDto,
|
|
} from '../shared/dto/machine.dto';
|
|
|
|
@Controller('machines')
|
|
export class MachinesController {
|
|
constructor(private readonly machinesService: MachinesService) {}
|
|
|
|
@Post()
|
|
create(@Body() createMachineDto: CreateMachineDto) {
|
|
return this.machinesService.create(createMachineDto);
|
|
}
|
|
|
|
@Get()
|
|
findAll() {
|
|
return this.machinesService.findAll();
|
|
}
|
|
|
|
@Get(':id')
|
|
findOne(@Param('id') id: string) {
|
|
return this.machinesService.findOne(id);
|
|
}
|
|
|
|
@Patch(':id')
|
|
update(@Param('id') id: string, @Body() updateMachineDto: UpdateMachineDto) {
|
|
return this.machinesService.update(id, updateMachineDto);
|
|
}
|
|
|
|
@Patch(':id/skeleton')
|
|
reconfigure(
|
|
@Param('id') id: string,
|
|
@Body() reconfigureMachineDto: ReconfigureMachineDto,
|
|
) {
|
|
return this.machinesService.reconfigure(id, reconfigureMachineDto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
remove(@Param('id') id: string) {
|
|
return this.machinesService.remove(id);
|
|
}
|
|
|
|
@Post(':id/add-custom-fields')
|
|
addMissingCustomFields(@Param('id') id: string) {
|
|
return this.machinesService.addMissingCustomFields(id);
|
|
}
|
|
}
|