58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
import {
|
|
Controller,
|
|
Get,
|
|
Post,
|
|
Body,
|
|
Patch,
|
|
Param,
|
|
Delete,
|
|
} from '@nestjs/common';
|
|
import { ComposantsService } from './composants.service';
|
|
import {
|
|
CreateComposantDto,
|
|
UpdateComposantDto,
|
|
} from '../shared/dto/composant.dto';
|
|
|
|
@Controller('composants')
|
|
export class ComposantsController {
|
|
constructor(private readonly composantsService: ComposantsService) {}
|
|
|
|
@Post()
|
|
create(@Body() createComposantDto: CreateComposantDto) {
|
|
return this.composantsService.create(createComposantDto);
|
|
}
|
|
|
|
@Get()
|
|
findAll() {
|
|
return this.composantsService.findAll();
|
|
}
|
|
|
|
@Get('hierarchy/:machineId')
|
|
findHierarchy(@Param('machineId') machineId: string) {
|
|
return this.composantsService.findHierarchy(machineId);
|
|
}
|
|
|
|
@Get('machine/:machineId')
|
|
findByMachine(@Param('machineId') machineId: string) {
|
|
return this.composantsService.findByMachine(machineId);
|
|
}
|
|
|
|
@Get(':id')
|
|
findOne(@Param('id') id: string) {
|
|
return this.composantsService.findOne(id);
|
|
}
|
|
|
|
@Patch(':id')
|
|
update(
|
|
@Param('id') id: string,
|
|
@Body() updateComposantDto: UpdateComposantDto,
|
|
) {
|
|
return this.composantsService.update(id, updateComposantDto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
remove(@Param('id') id: string) {
|
|
return this.composantsService.remove(id);
|
|
}
|
|
}
|