import { PlantationSiteQuery } from './plantationSite.query';
import { IQueryHandler, QueryHandler } from '@nestjs/cqrs';

import { Observable } from 'rxjs';
import { PlantationSiteRepository } from '../../repository/plantationSite-repository';

@QueryHandler(PlantationSiteQuery)
export class PlantationSiteHandler implements IQueryHandler<PlantationSiteQuery> {
  constructor(private plantationRepository: PlantationSiteRepository) {}

  async execute(payload: PlantationSiteQuery): Promise<Observable<any>> {
    return this.plantationRepository.query(payload);
  }
}