This commit is contained in:
2025-12-09 17:02:27 +09:00
parent 26f8e1dab2
commit 83127da569
275 changed files with 139682 additions and 1 deletions

View File

@@ -0,0 +1,47 @@
import { Controller, Get, Post, Put, Delete, Body, Param, Query } from '@nestjs/common';
import { MptService } from './mpt.service';
import { MptModel } from './entities/mpt.entity';
@Controller('mpt')
export class MptController {
constructor(private readonly mptService: MptService) {}
@Get()
findAll(
@Query('farmId') farmId?: string,
@Query('cowShortNo') cowShortNo?: string,
) {
if (farmId) {
return this.mptService.findByFarmId(+farmId);
}
if (cowShortNo) {
return this.mptService.findByCowShortNo(cowShortNo);
}
return this.mptService.findAll();
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.mptService.findOne(+id);
}
@Post()
create(@Body() data: Partial<MptModel>) {
return this.mptService.create(data);
}
@Post('bulk')
bulkCreate(@Body() data: Partial<MptModel>[]) {
return this.mptService.bulkCreate(data);
}
@Put(':id')
update(@Param('id') id: string, @Body() data: Partial<MptModel>) {
return this.mptService.update(+id, data);
}
@Delete(':id')
remove(@Param('id') id: string) {
return this.mptService.remove(+id);
}
}