import { Body, Controller, Get, Param, Post } from '@nestjs/common';
import { CreateCordinatesDTO } from './dto/create-cordinates.dto';
import { RiderCordinatesService } from './rider-cordinates.service';

@Controller('rider-cordinates')
export class RiderCordinatesController {
  constructor(private readonly riderService: RiderCordinatesService) {}

  @Get()
  async getRiderCordinates() {
    return await this.riderService.getAll();
  }
  @Post()
  async saveRaider(
    @Body()
    createCordinateDTO: CreateCordinatesDTO,
  ) {
    return await this.riderService.saveCordinates(createCordinateDTO);
  }

  @Get(':id')
  async getRiderById(@Param('id') id: number) {
    return await this.riderService.getById(id);
  }
}
