import { Controller, Get, Query } from '@nestjs/common';
import { FarmService } from './farm.service';

@Controller('farm')
export class FarmController {
  constructor(private readonly farmService: FarmService) {}

  @Get()
  findAll(@Query('userId') userId?: string) {
    if (userId) {
      return this.farmService.findByUserId(+userId);
    }
    return this.farmService.findAll();
  }
}
