feat(backend): Ernten- und Schleuderungs-Module (Modul 10)
HarvestsModule und ExtractionsModule als Fundament der Rückverfolgbarkeitskette: eine Ernte kann mehrere Völker umfassen, eine Schleuderung mehrere Ernten zusammenführen.
This commit is contained in:
1 parent
d71785d531
commit
340397b34d
14 files changed
+705
-1
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
|
||||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
||||
import { Role } from '../../generated/prisma';
|
||||
import { Roles } from '../auth/decorators/roles.decorator';
|
||||
import { CurrentUser } from '../auth/decorators/current-user.decorator';
|
||||
import type { AuthenticatedUser } from '../auth/types/authenticated-user';
|
||||
import { CreateExtractionDto } from './dto/create-extraction.dto';
|
||||
import { ExtractionsService } from './extractions.service';
|
||||
|
||||
@ApiTags('extractions')
|
||||
@ApiBearerAuth()
|
||||
@Controller('extractions')
|
||||
export class ExtractionsController {
|
||||
constructor(private readonly extractionsService: ExtractionsService) {}
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.extractionsService.findAll();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.extractionsService.findById(id);
|
||||
}
|
||||
|
||||
@Roles(Role.ADMIN, Role.BEEKEEPER)
|
||||
@Post()
|
||||
create(
|
||||
@Body() dto: CreateExtractionDto,
|
||||
@CurrentUser() actor: AuthenticatedUser,
|
||||
) {
|
||||
return this.extractionsService.create(dto, actor.id);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user