import { Body, Controller, Delete, Get, Param, ParseIntPipe, Post } from '@nestjs/common';
import { ReceiptAliasService } from './receipt-alias.service';
import { CreateReceiptAliasDto } from './dto/create-receipt-alias.dto';
import { Roles } from '../auth/decorators/roles.decorator';

@Roles('admin')
@Controller('receipt-aliases')
export class ReceiptAliasController {
  constructor(private readonly receiptAliasService: ReceiptAliasService) {}

  @Get()
  findAll() {
    return this.receiptAliasService.findAll();
  }

  @Post()
  upsert(@Body() dto: CreateReceiptAliasDto) {
    return this.receiptAliasService.upsert(dto);
  }

  @Delete(':id')
  remove(@Param('id', ParseIntPipe) id: number) {
    return this.receiptAliasService.remove(id);
  }
}
