import { Controller, Get, Post, Body, Param, UseGuards } from '@nestjs/common'; import { KontonummernService } from './kontonummern.service'; import { JwtOrApiKeyGuard } from '../auth/jwt-or-apikey.guard'; export class CreateKontonummerDto { correspondentId: number; nummer: string; } @Controller('api/kontonummern') @UseGuards(JwtOrApiKeyGuard) export class KontonummernController { constructor(private readonly kontonummernService: KontonummernService) {} @Get('FromCorrespondent/:id') async getByCorrespondent(@Param('id') id: string) { return this.kontonummernService.findByCorrespondent(parseInt(id, 10)); } @Post() async create(@Body() dto: CreateKontonummerDto) { return this.kontonummernService.create(dto.correspondentId, dto.nummer); } }